Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Overholt2011-02-28 03:09:25 +0000
committerAndrew Overholt2011-02-28 03:09:27 +0000
commitcc7f24352e76c246980d5401f8f2c9076965a67e (patch)
tree04f0a7b0c2c6fbf7da1d9f3095bec991b1ea435d
parent54895308ba11da04cce93c41a0f936ce02046073 (diff)
parenta6934406763a6ef33a58606ae2b3e9d58be98eaa (diff)
downloadorg.eclipse.linuxtools-cc7f24352e76c246980d5401f8f2c9076965a67e.tar.gz
org.eclipse.linuxtools-cc7f24352e76c246980d5401f8f2c9076965a67e.tar.xz
org.eclipse.linuxtools-cc7f24352e76c246980d5401f8f2c9076965a67e.zip
Merge gcov 0.6.0
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.classpath7
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.project28
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/META-INF/MANIFEST.MF24
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/about.html28
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/build.properties8
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/icons/c_file_obj.gifbin0 -> 617 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/plugin.properties12
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/plugin.xml58
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/AbstractSTAnnotatedSourceEditorInput.java82
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTAnnotationColumn.java19
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTTextEditorActionConstants.java19
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTTextEditorActionDefinitionIds.java20
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STAnnotatedCSourceEditor.java449
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STAnnotatedSourceEditorActivator.java76
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STChangeRulerColumn.java390
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STConstructedTextEditorMessages.properties4
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STContributedRulerColumn.java798
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STJFaceTextMessages.java67
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STOverviewRuler.java1309
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STRulerColumn.java876
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STRulerMessages.java34
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STTextEditorMessages.java37
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/AbstractOpenSourceFileAction.java93
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/OpenFileFullPathAction.java32
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/OpenWksRelFilePathAction.java63
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/hyperlink/ISTAnnotationHyperlink.java17
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/preferencespages/STAnnotatedSourceEditorPreferencePage.java59
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/.classpath7
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/.project28
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/META-INF/MANIFEST.MF26
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/about.html26
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/build.properties8
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/icons/Thumbs.dbbin0 -> 3584 bytes
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/icons/chart_icon.pngbin0 -> 573 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/icons/dexport.gifbin0 -> 142 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/icons/dimport.gifbin0 -> 143 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/icons/eexport.gifbin0 -> 329 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/icons/eimport.gifbin0 -> 327 bytes
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/icons/save_chart.gifbin0 -> 583 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/plugin.properties14
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/plugin.xml21
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/Activator.java88
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/ChartConstants.java85
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/UIHelper.java143
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/ChartAction.java67
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/ChartActionRenderer.java46
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/OpenChartAction.java77
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/SaveChartAction.java286
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/SaveXMLAction.java132
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/BindDataEngine.java364
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/FlatFileDataSource.java70
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/FlatFileDataSourceFactory.java40
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/GroupedRowExpressionsEvaluator.java280
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dialogs/ChartDialog.java427
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/ChartFactory.java251
-rw-r--r--gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/ChartUpdateNotifier.java41
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/IChartField.java30
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/view/ChartView.java204
-rwxr-xr-xgcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/viewer/ChartViewer.java252
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov-feature/.project17
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov-feature/build.properties8
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov-feature/epl-v10.html256
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov-feature/feature.properties138
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov-feature/feature.xml59
-rw-r--r--gcov/org.eclipse.linuxtools.gcov-feature/license.html107
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/.classpath7
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/.project28
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/META-INF/MANIFEST.MF9
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/about.html33
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/build.properties9
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/plugin.properties12
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/AllGcovTests.java29
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovGCDARetrieverTest.java68
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovParserTest.java59
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovTestUtils.java66
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovViewTest.java111
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/STJunitUtils.java267
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/test.xml54
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/Makefile8
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/test_c/a.outbin0 -> 30722 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.c19
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.gcdabin0 -> 168 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.gcnobin0 -> 480 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/main.c28
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/main.gcdabin0 -> 176 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/main.gcnobin0 -> 676 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.c21
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.gcdabin0 -> 152 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.gcnobin0 -> 500 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/testProcessCovFiles.ref30
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/testView.ref8
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/testViewFolder.ref9
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_c/testViewFunction.ref5
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/Makefile8
-rwxr-xr-xgcov/org.eclipse.linuxtools.gcov.test/test_cpp/a.outbin0 -> 34593 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.cpp31
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.gcdabin0 -> 320 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.gcnobin0 -> 1268 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.hpp26
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.cpp30
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.gcdabin0 -> 864 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.gcnobin0 -> 8992 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.cpp29
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.gcdabin0 -> 280 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.gcnobin0 -> 1140 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.hpp22
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testProcessCovFiles.ref148
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testView.ref36
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testViewFolder.ref39
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testViewFunction.ref27
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/.classpath7
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/.project28
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/META-INF/MANIFEST.MF26
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/about.html28
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/build.properties8
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/icons/c_file_obj.gifbin0 -> 1019 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/icons/directory_obj.gifbin0 -> 162 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/icons/function_obj.gifbin0 -> 617 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/icons/src_file_obj.gifbin0 -> 617 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/icons/toggle.gifbin0 -> 610 bytes
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/plugin.properties16
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/plugin.xml38
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/Activator.java71
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java166
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/action/SwitchContentProviderAction.java44
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/dialog/OpenGCDialog.java303
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/AbstractTreeElement.java79
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFileTreeElement.java25
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFolderTreeElement.java24
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFunctionTreeElement.java57
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovRootTreeElement.java26
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/TreeElement.java27
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Arc.java131
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Block.java177
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/CovManager.java359
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/CoverageInfo.java52
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Folder.java65
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/GcdaRecordsParser.java272
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/GcnoFunction.java255
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/GcnoRecordsParser.java241
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Line.java50
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/SourceFile.java110
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/utils/BEDataInputStream.java191
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/utils/GcovStringReader.java38
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/utils/LEDataInputStream.java208
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/utils/MasksGenerator.java15
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/utils/STGcovProgramChecker.java85
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/CovFileContentProvider.java60
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/CovFolderContentProvider.java61
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/CovFunctionContentProvider.java52
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/CovView.java261
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/CovViewer.java119
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/FieldCoveragePercentage.java99
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/FieldExecutedLines.java68
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/FieldInstrumentedLines.java77
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/FieldName.java69
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/FieldTotalLines.java82
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/annotatedsource/CoverageAnnotationColumn.java79
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/annotatedsource/OpenSourceFileAction.java136
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceEditorInput.java73
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditor.java50
-rw-r--r--gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/view/annotatedsource/STAnnotatedSourceNotFoundEditorInput.java69
-rw-r--r--rpm/org.eclipse.linuxtools.rpm-feature/.classpath5
-rw-r--r--rpm/org.eclipse.linuxtools.rpm-feature/.project23
-rw-r--r--rpm/org.eclipse.linuxtools.rpm-feature/ChangeLog51
-rw-r--r--rpm/org.eclipse.linuxtools.rpm-feature/about.html33
-rw-r--r--rpm/org.eclipse.linuxtools.rpm-feature/build.properties19
-rw-r--r--rpm/org.eclipse.linuxtools.rpm-feature/feature.properties16
-rw-r--r--rpm/org.eclipse.linuxtools.rpm-feature/feature.xml50
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/.classpath7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/.cvsignore1
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/.project28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/ChangeLog65
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/META-INF/MANIFEST.MF18
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/build.properties14
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/plugin.xml4
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/resources/specs/helloworld.spec30
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/resources/srpms/helloworld-2-2.src.rpmbin0 -> 3344 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/internal/tests/RPMCoreInternalTestSuite.java23
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/internal/tests/RPMProjectTest.java301
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/internal/tests/SpecFileParserTest.java100
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/AllTests.java25
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMCoreTestSuite.java23
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMCoreTestsPlugin.java76
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectFactoryTest.java62
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectNatureTest.java59
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/.classpath7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/.cvsignore1
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/.project28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/.template4
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/ChangeLog435
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/META-INF/MANIFEST.MF19
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/about.html33
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/build.properties23
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/plugin.xml13
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IPatch.java57
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IRPMConfiguration.java50
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IRPMConstants.java114
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IRPMProject.java157
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/ISourceRPM.java43
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/ISpecFile.java92
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMCorePlugin.java176
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMExportDelta.java107
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectFactory.java83
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectNature.java121
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/internal/Messages.java28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/internal/Patch.java38
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/internal/RPMConfiguration.java143
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/internal/RPMProject.java419
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/internal/SourceRPM.java33
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/internal/SpecFile.java207
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/internal/SpecFileParser.java657
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/internal/rpm_strings.properties220
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Diff.java56
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/RPM.java58
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/RPMBuild.java113
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/RPMQuery.java84
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/internal/Command.java74
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/internal/ShellScript.java81
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/internal/StreamReaderThread.java38
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/.project11
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/ChangeLog87
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/about.html33
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/build.properties12
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/build.xml76
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/plugin.properties10
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/plugin.xml20
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/book.css206
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/hglegal2004.htm20
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/01_eclipse_rpm_prefs_page1.pngbin0 -> 40730 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/02_eclipse_rpm_Cproject_create.pngbin0 -> 33658 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/03_eclipse_rpm_Cproject_create.pngbin0 -> 30803 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/04_eclipse_rpm_srpm_import.pngbin0 -> 35803 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/05_eclipse_rpm_srpm_import.pngbin0 -> 33381 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/06_eclipse_rpm_srpm_import.pngbin0 -> 25763 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/07_eclipse_rpm_srpm_import.pngbin0 -> 39097 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/07_eclipse_rpm_srpm_import_2.pngbin0 -> 35680 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/08_eclipse_rpm_cproject_view.pngbin0 -> 130370 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/09_eclipse_rpm_export.pngbin0 -> 33881 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/10_eclipse_rpm_export.pngbin0 -> 43965 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/11_eclipse_rpm_export.pngbin0 -> 36026 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/12_eclipse_rpm_export.pngbin0 -> 26201 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/13_eclipse_rpm_export.pngbin0 -> 28644 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/14_eclipse_rpm_export.pngbin0 -> 13860 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/15_eclipse_rpm_logviewer.pngbin0 -> 19752 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/images/16_eclipse_rpm_logviewer.pngbin0 -> 71055 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/notnetscape4.css14
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/raw/rpmguide/RPM_Plugin.htm317
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.doc/toc.xml7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.releng/ChangeLog50
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.releng/build.properties80
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.releng/build.xml46
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.releng/customTargets.xml165
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.releng/maps/rpm.map4
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/.classpath7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/.cvsignore1
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/.project28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/.settings/org.eclipse.jdt.core.prefs83
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/ChangeLog423
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/META-INF/MANIFEST.MF25
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/build.properties6
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/plugin.properties12
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/plugin.xml97
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/Activator.java86
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/Messages.java26
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/RpmlintLog.java103
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/actions/Messages.java26
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/actions/RunRpmlintAction.java87
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java105
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/actions/messages.properties11
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/builder/Messages.java28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/builder/RpmlintBuilder.java138
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/builder/RpmlintDeltaVisitor.java52
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/builder/RpmlintMarkerRemoveVisitor.java43
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/builder/RpmlintMarkerVisitor.java173
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/builder/RpmlintNature.java90
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/builder/RpmlintPreVisitor.java40
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/builder/messages.properties13
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/messages.properties11
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/parser/RpmlintItem.java130
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/parser/RpmlintParser.java304
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/preferences/Messages.java29
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/preferences/PreferenceConstants.java30
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/preferences/PreferenceInitializer.java37
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/preferences/RpmlintPreferencePage.java63
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/preferences/messages.properties14
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/AInsertLineResolution.java66
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/ARemoveLineResolution.java40
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/AReplaceTextResolution.java58
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/ARpmlintResolution.java64
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/HardcodedPackagerTag.java37
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/HardcodedPrefixTag.java37
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/MacroInChangelog.java55
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/Messages.java38
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/NoBuildSection.java49
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/NoBuildrootTag.java51
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/NoCleanSection.java44
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/NoCleaningOfBuildroot.java49
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/NoInstallSection.java44
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/NoPrepSection.java44
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/PatchNotApplied.java31
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/RpmBuildrootUsage.java33
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/RpmlintMarkerResolutionGenerator.java108
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/SetupNotQuiet.java47
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/rpm/rpmlint/resolutions/messages.properties23
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor-feature/.project17
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor-feature/ChangeLog36
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor-feature/build.properties4
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor-feature/epl-v10.html256
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor-feature/feature.properties140
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor-feature/feature.xml59
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor-feature/license.html81
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/.project22
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/ChangeLog50
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/META-INF/MANIFEST.MF5
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/build.properties4
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/generic.html55
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/Unti.xcfbin0 -> 240040 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/enable_rpmlint.pngbin0 -> 129551 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/generic.pngbin0 -> 194908 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/macros_long.pngbin0 -> 4573 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/macros_short.pngbin0 -> 5034 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/new_from_template.pngbin0 -> 53602 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/problems_rpmlint.pngbin0 -> 72383 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/rpmlint_fix_after.pngbin0 -> 15655 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/rpmlint_fix_before.pngbin0 -> 14117 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/rpmlint_quickfix.pngbin0 -> 68669 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/settings_changelog.pngbin0 -> 69746 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/settings_macros.pngbin0 -> 68593 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/settings_rpmlint.pngbin0 -> 53836 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/settings_rpms_details.pngbin0 -> 81211 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/settings_rpms_generic.pngbin0 -> 83169 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/settings_tasks.pngbin0 -> 44515 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/settings_templates.pngbin0 -> 139665 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/warnings_rpmlint.pngbin0 -> 230637 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/images/wizard.pngbin0 -> 29257 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/macro_settings.html28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/package_settings.html26
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/rpmlint.html43
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/settings.html54
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/support.html27
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/html/toc.html39
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/plugin.xml8
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/toc.xml14
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/.classpath7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/.cvsignore1
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/.project28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/.settings/org.eclipse.jdt.core.prefs70
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/.settings/org.eclipse.jdt.ui.prefs54
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/ChangeLog489
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/META-INF/MANIFEST.MF19
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/build.properties6
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/plugin.properties12
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AScannerTest.java60
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AllTests.java47
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/EpochTagTest.java101
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/FileTestCase.java72
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/HeaderRecognitionTest.java175
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LicenseTagTest.java39
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LinePositionTests.java50
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/NameTagTests.java91
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/PatchApplicationTest.java54
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/ReleaseTagTests.java85
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmMacroProposalsListTest.java79
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmPackageProposalsListTest.java82
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileCompletionProcessorTest.java72
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestProject.java59
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/VersionTagTests.java86
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/actions/ActionsAllTests.java24
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/actions/SpecfileChangelogFormatterTest.java54
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/actions/SpecfileChangelogParserTest.java36
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/actions/SpecfileEditorShowOutlineActionDelegateTest.java37
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/hyperlink/HyperlinkAllTests.java25
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/hyperlink/MailHyperlinkDetectorTest.java65
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/hyperlink/SourcesFileHyperlinkDetectorTest.java59
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/hyperlink/SpecfileElementHyperlinkDetectorTest.java80
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/hyperlink/URLHyperlinkWithMacroDetectorTest.java47
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/ParserAllTests.java24
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SourceComparatorTest.java49
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileDefineTest.java162
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileTest.java101
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/scanners/ScannersAllTests.java24
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/scanners/SpecfileChangelogScannerTest.java84
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/scanners/SpecfilePackagesScannerTest.java141
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/scanners/SpecfileScannerTest.java120
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/test.xml59
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/.classpath7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/.cvsignore1
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/.project28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/.settings/org.eclipse.jdt.core.prefs83
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/.settings/org.moreunit.prefs6
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/ChangeLog2176
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/META-INF/MANIFEST.MF30
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/build.properties18
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/icons/macro_obj.gifbin0 -> 155 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/icons/occurrence_obj.gifbin0 -> 200 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/icons/package_obj.gifbin0 -> 176 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/icons/packages_obj.gifbin0 -> 191 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/icons/preamble_obj.gifbin0 -> 185 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/icons/rpm.gifbin0 -> 1019 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/icons/section_obj.gifbin0 -> 114 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/icons/template_obj.gifbin0 -> 359 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.properties12
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml292
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/Activator.java216
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/ColorManager.java38
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileColorConstants.java32
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileSpecialSymbols.java36
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/Messages.java38
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/NonRuleBasedDamagerRepairer.java148
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/RpmMacroOccurrencesUpdater.java239
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/RpmMacroProposalsList.java227
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/RpmPackageBuildProposalsJob.java204
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/RpmPackageProposalsList.java166
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/RpmSections.java34
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/RpmTags.java43
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileCompletionProcessor.java586
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java252
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDocumentProvider.java36
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDoubleClickStrategy.java123
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileEditor.java248
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileEditorMessages.properties13
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileFoldingStructureProvider.java136
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java277
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileLog.java105
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitioner.java22
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileReconcilingStrategy.java95
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/UiUtils.java88
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/Utils.java121
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/actions/Messages.java32
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogAction.java199
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogFormatter.java206
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogParser.java32
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java77
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileEditorShowOutlineActionDelegate.java58
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileEditorToggleCommentActionDelegate.java141
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/actions/messages.properties18
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/compare/Messages.java26
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/compare/SpecMergeViewer.java77
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/compare/SpecMergeViewerCreator.java31
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/compare/SpecStructureCreator.java233
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/compare/SpecStructureMergeViewerCreator.java36
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/compare/messages.properties12
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/derived/AnnotationHover.java490
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/derived/HTML2TextReader.java330
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/derived/HTMLTextPresenter.java202
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/derived/LineBreakingReader.java133
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/derived/SingleCharReader.java70
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/derived/SubstitutionTextReader.java164
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/detectors/IStrictWordDetector.java18
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/detectors/KeywordWordDetector.java26
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/detectors/MacroWordDetector.java26
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/detectors/PackageWordDetector.java25
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/detectors/PatchNumberDetector.java30
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/detectors/SuffixNumberDetector.java30
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/detectors/TagWordDetector.java25
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/forms/MainPackagePage.java114
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/forms/Messages.java35
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/forms/RpmSectionPage.java52
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/forms/RpmTagText.java84
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/forms/SpecfileFormEditor.java64
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/forms/messages.properties20
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/MailHyperlink.java44
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/MailHyperlinkDetector.java217
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/Messages.java25
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java191
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/SourcesFileHyperlink.java98
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/SourcesFileHyperlinkDetector.java89
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/SpecfileElementHyperlink.java83
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/SpecfileElementHyperlinkDetector.java159
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/URLHyperlinkWithMacroDetector.java57
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/hyperlink/messages.properties11
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileErrorHandler.java72
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileMarkerHandler.java61
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileTaskHandler.java66
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/messages.properties24
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/outline/ContainsFilter.java61
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/outline/Messages.java26
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentOutlinePage.java109
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentProvider.java117
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileLabelProvider.java83
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java166
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/outline/messages.properties12
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Messages.java32
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SourceComparator.java29
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java227
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java36
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java101
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileMacro.java16
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java72
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java97
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParseException.java62
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java584
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePatchMacro.java41
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePreamble.java16
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java63
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSource.java128
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileTag.java79
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/messages.properties28
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/MacroProposalsPreferencePage.java427
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/MainPreferencePage.java153
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/Messages.java58
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/PreferenceConstants.java107
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/PreferenceInitializer.java61
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/RpmInformationsPreferencePage.java72
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/RpmProposalsPreferencePage.java135
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/SpecTemplatePreferencePage.java52
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/TaskTagsPreferencePage.java79
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/preferences/messages.properties44
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/rules/AuthorEmailRule.java134
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/rules/CommentRule.java32
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/rules/MacroRule.java34
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/rules/SectionRule.java140
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/rules/StringWithEndingRule.java106
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/rules/VersionReleaseRule.java164
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/scanners/SpecfileChangelogScanner.java81
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/scanners/SpecfilePackagesScanner.java94
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/scanners/SpecfilePartitionScanner.java98
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/scanners/SpecfileScanner.java160
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/Messages.java50
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/NoExecutableWizardPage.java53
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/SpecfileNewWizard.java154
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/SpecfileNewWizardPage.java442
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/messages.properties36
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/templates/templates.xml96
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/.classpath7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/.cvsignore1
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/.project29
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/.template4
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/ChangeLog403
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/META-INF/MANIFEST.MF25
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/about.html33
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/build.properties24
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/icons/rpm.gifbin0 -> 1019 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml95
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/IRPMUIConstants.java22
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/Messages.java29
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportOperation.java122
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportPage.java640
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportPatchPage.java279
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportWizard.java94
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMUIPlugin.java122
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/SRPMImportOperation.java119
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/SRPMImportPage.java455
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/SRPMImportWizard.java79
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/logviewer/LogReader.java117
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/logviewer/RPMLogViewer.java112
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/preferences/RPMPluginPreferencesPage.java295
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/propertypage/ChangelogPage.java108
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/propertypage/InstallScriptsPage.java157
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/propertypage/Messages.java30
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/propertypage/ProvidesPage.java111
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/propertypage/SpecFileHeaderPage.java107
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/propertypage/TargetPage.java167
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/propertypage/messages.properties13
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/redhat-system_tools.pngbin0 -> 2438 bytes
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/rpm_strings.properties166
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/util/ExceptionHandler.java137
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/ChangeLog25
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/META-INF/MANIFEST.MF3
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/AllTests.java3
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/ConfigurationTest.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandGeneratorTest.java19
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandLineTest.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapCommandTest.java8
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapErrorHandlerTest.java89
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch.tests/src/org/eclipse/linuxtools/callgraph/launch/tests/SystemTapTabTest.java4
572 files changed, 47295 insertions, 32 deletions
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.classpath b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.classpath
new file mode 100644
index 0000000000..751c8f2e50
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.project b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.project
new file mode 100644
index 0000000000..0e6347dcc2
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.dataviewers.annotatedsourceeditor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.settings/org.eclipse.jdt.core.prefs b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..5466d964b5
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,3 @@
+#Tue Jun 03 09:41:19 CEST 2008
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.settings/org.eclipse.jdt.ui.prefs b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000000..fbc03a966e
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+#Tue Jun 03 09:41:19 CEST 2008
+eclipse.preferences.version=1
+internal.default.compliance=default
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/META-INF/MANIFEST.MF b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..b32e17f897
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/META-INF/MANIFEST.MF
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;singleton:=true
+Bundle-Version: 4.1.0.qualifier
+Bundle-Activator: org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STAnnotatedSourceEditorActivator
+Bundle-Vendor: %bundleProvider
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.filesystem,
+ org.eclipse.ui.ide,
+ org.eclipse.jface.text,
+ org.eclipse.ui.editors,
+ org.eclipse.cdt.ui,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.core.resources,
+ org.eclipse.cdt.core
+Export-Package: org.eclipse.linuxtools.dataviewers.annotatedsourceeditor,
+ org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.actions,
+ org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.hyperlink,
+ org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.preferencespages
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/about.html b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/build.properties b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/build.properties
new file mode 100644
index 0000000000..d9e236776e
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ META-INF/,\
+ icons/,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/icons/c_file_obj.gif b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/icons/c_file_obj.gif
new file mode 100644
index 0000000000..8fd6adbd9f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/icons/c_file_obj.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/plugin.properties b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/plugin.properties
new file mode 100644
index 0000000000..ad2f7d2b46
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/plugin.properties
@@ -0,0 +1,12 @@
+#******************************************************************************
+# Copyright (c) 2009 STMicroelectronics.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# STMicroelectronics - initial API and implementation
+#*******************************************************************************
+bundleProvider = Eclipse Linux Tools
+bundleName = Annotated Source Editor Plug-in (Incubation) \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/plugin.xml b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/plugin.xml
new file mode 100644
index 0000000000..9cf43ea2a4
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/plugin.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.workbench.texteditor.rulerColumns">
+ <column
+ class="org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STContributedRulerColumn"
+ enabled="false"
+ global="false"
+ id="org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.column"
+ includeInMenu="false"
+ name="ST Column">
+ <placement
+ gravity="0.8"></placement>
+ <targetEditor
+ id="org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.editor">
+ </targetEditor>
+ </column>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors.markerAnnotationSpecification">
+ <specification
+ annotationType="org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.coloredLines"
+ colorPreferenceKey="coloredLinesResultIndicationColor"
+ colorPreferenceValue="250,0,0"
+ highlightPreferenceKey="coloredLinesHighlighting"
+ includeOnPreferencePage="false"
+ label="Colored Lines"
+ overviewRulerPreferenceKey="coloredLinesIndicationInOverviewRuler"
+ overviewRulerPreferenceValue="true"
+ presentationLayer="1"
+ textPreferenceKey="coloredLinedResultIndication"
+ verticalRulerPreferenceKey="coloredLinesIndicationInVerticalRuler">
+ </specification>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STAnnotatedCSourceEditor"
+ icon="icons/c_file_obj.gif"
+ id="org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.editor"
+ name="ST Annotated Source Editor">
+ </editor>
+ <editor
+ id="org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.editor2"
+ name="name">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="%ActionDefinition.STColumnToggle.description"
+ id=" org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STColumnToggle"
+ name="Show Annotation Columns">
+ </command>
+ </extension>
+
+</plugin>
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/AbstractSTAnnotatedSourceEditorInput.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/AbstractSTAnnotatedSourceEditorInput.java
new file mode 100644
index 0000000000..1a4a0f503e
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/AbstractSTAnnotatedSourceEditorInput.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+
+public abstract class AbstractSTAnnotatedSourceEditorInput extends FileStoreEditorInput{
+ private ArrayList<ISTAnnotationColumn> columns;
+
+ public AbstractSTAnnotatedSourceEditorInput(IFileStore fileStore) {
+ super(fileStore);
+ }
+
+ /** gets how many STColumn exist
+ *
+ * @return
+ */
+ public int getColumnCount(){
+ if (columns == null){
+ columns = getColumns();
+ }
+ return columns!=null ? columns.size() : 0;
+ }
+
+ /** gets the title of a ST Column
+ *
+ * @param column
+ * @return
+ */
+ public String getTitle(ISTAnnotationColumn column){
+ if (columns == null){
+ columns = getColumns();
+ }
+ return column!=null ? column.getTitle() : null;
+ }
+
+ /** gets the background column of a editor line
+ *
+ * @param line
+ * @return
+ */
+ public abstract Color getColor(int line);
+
+ public String getAnnotation(int line, ISTAnnotationColumn column){
+ if (columns == null){
+ columns = getColumns();
+ }
+ return column!=null ? column.getAnnotation(line) : null;
+ }
+
+ public String getLongDescription(int line, ISTAnnotationColumn column){
+ if (columns == null){
+ columns = getColumns();
+ }
+ return column!=null ? column.getLongDescription(line) : null;
+ }
+
+ public String getTooltip(int line, ISTAnnotationColumn column){
+ if (columns == null){
+ columns = getColumns();
+ }
+ return column!=null ? column.getTooltip(line) : null;
+ }
+
+ /** gets the ISTAnnotationColumn objects list
+ *
+ * @return
+ */
+ public abstract ArrayList<ISTAnnotationColumn> getColumns();
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTAnnotationColumn.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTAnnotationColumn.java
new file mode 100644
index 0000000000..0d7291eb1f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTAnnotationColumn.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+public interface ISTAnnotationColumn {
+ String getTitle();
+ String getAnnotation(int line);
+ String getTooltip(int line);
+ String getLongDescription(int line);
+ String getHeaderTooltip();
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTTextEditorActionConstants.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTTextEditorActionConstants.java
new file mode 100644
index 0000000000..9e24ca9a11
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTTextEditorActionConstants.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
+public interface ISTTextEditorActionConstants extends
+ ITextEditorActionConstants {
+
+ String ST_TOGGLE= "ST.Toggle"; //$NON-NLS-1$
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTTextEditorActionDefinitionIds.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTTextEditorActionDefinitionIds.java
new file mode 100644
index 0000000000..88915bb724
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/ISTTextEditorActionDefinitionIds.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+
+public interface ISTTextEditorActionDefinitionIds extends
+ ITextEditorActionDefinitionIds {
+
+ String ST_TOGGLE= "org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STColumnToggle"; //$NON-NLS-1$
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STAnnotatedCSourceEditor.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STAnnotatedCSourceEditor.java
new file mode 100644
index 0000000000..3b77d6cea7
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STAnnotatedCSourceEditor.java
@@ -0,0 +1,449 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.internal.ui.editor.CEditor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationModel;
+import org.eclipse.jface.text.source.CompositeRuler;
+import org.eclipse.jface.text.source.IChangeRulerColumn;
+import org.eclipse.jface.text.source.IOverviewRuler;
+import org.eclipse.jface.text.source.ISharedTextColors;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.jface.text.source.IVerticalRulerColumn;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.window.DefaultToolTip;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.LineBackgroundEvent;
+import org.eclipse.swt.custom.LineBackgroundListener;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyledTextContent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+import org.eclipse.ui.internal.texteditor.AnnotationColumn;
+import org.eclipse.ui.internal.texteditor.LineNumberColumn;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
+import org.eclipse.ui.texteditor.AnnotationPreference;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
+import org.eclipse.ui.texteditor.ResourceAction;
+import org.eclipse.ui.texteditor.rulers.IColumnSupport;
+import org.eclipse.ui.texteditor.rulers.IContributedRulerColumn;
+import org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor;
+import org.eclipse.ui.texteditor.rulers.RulerColumnRegistry;
+
+
+public class STAnnotatedCSourceEditor extends CEditor implements LineBackgroundListener {
+ private final static String ST_RULER= "STRuler";
+
+ protected STContributedRulerColumn fAbstractSTRulerColumn;
+
+ private IColumnSupport fColumnSupport;
+
+ private LineNumberColumn fLineColumn;
+
+ private STContributedRulerColumn fColumn;
+
+ private StyledText fCachedTextWidget;
+
+ private AbstractSTAnnotatedSourceEditorInput fInput;
+
+ private ArrayList<ISTAnnotationColumn> fListColumns;
+
+ private STChangeRulerColumn fSTChangeRulerColumn;
+
+ @Override
+ public void createPartControl(Composite parent){
+ if (fInput == null){
+ super.createPartControl(parent);
+ return;
+ }
+
+ GridLayout layout= new GridLayout();
+ layout.numColumns=fInput.getColumnCount()+1;
+ layout.horizontalSpacing=0;
+ parent.setLayout(layout);
+ GridData gd =new GridData();
+ gd.grabExcessHorizontalSpace =false;
+ gd.grabExcessVerticalSpace =true;
+
+ parent.setLayoutData(gd );
+
+ Composite fParentSv= new Composite(parent, SWT.NONE);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan =fInput.getColumnCount()+1;
+ gd.horizontalIndent=gd.verticalIndent=0;
+ fParentSv.setLayoutData(gd);
+ FillLayout fillLayout= new FillLayout(SWT.HORIZONTAL|SWT.VERTICAL);
+ fillLayout.marginWidth=fillLayout.marginHeight=0;
+ fParentSv.setLayout(fillLayout);
+
+ super.createPartControl(fParentSv);
+
+ STColumnSupport columnSupport= (STColumnSupport)getAdapter(IColumnSupport.class);
+ RulerColumnRegistry registry = RulerColumnRegistry.getDefault();
+
+ for(int i=1;i<=fInput.getColumnCount();i++){
+ RulerColumnDescriptor abstractSTColumnDescriptor= registry.getColumnDescriptor(STContributedRulerColumn.ID);
+ columnSupport.addSTColumn((CompositeRuler)getVerticalRuler(), abstractSTColumnDescriptor,fListColumns.get(i-1));
+
+ }
+
+ CompositeRuler vr = (CompositeRuler)super.getVerticalRuler();
+ int count = 0;
+ Font font = parent.getFont();
+ FontData fd = font.getFontData()[0];
+ fd.setStyle(SWT.BOLD);
+ for(Iterator<?> iter = vr.getDecoratorIterator();iter.hasNext();){
+ IVerticalRulerColumn column = (IVerticalRulerColumn)iter.next();
+ if (column instanceof STContributedRulerColumn){
+ STContributedRulerColumn fSTColumn = (STContributedRulerColumn)column;
+ Label label = new Label(parent, SWT.BORDER);
+ gd = new GridData();
+ count++;
+ if (count==1) gd.horizontalIndent=VERTICAL_RULER_WIDTH+5;
+ else gd.horizontalIndent=0;
+ gd.widthHint = fSTColumn.getWidth();
+ label.setFont(new Font(label.getDisplay(), fd));
+ label.setLayoutData(gd);
+ label.moveAbove(fParentSv);
+ label.setText(fSTColumn.getAnnotationColumn(0).getTitle());
+ fSTColumn.setLabelColumn(label);
+
+ if (fSTColumn.isShowingSTRuler()){
+ ToolTipSupport.enableFor(fSTColumn);
+ }
+ }
+ }
+
+ Label label = new Label(parent, SWT.BORDER);
+ gd = new GridData();
+ gd.horizontalAlignment = SWT.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ label.setFont(new Font(label.getDisplay(), fd));
+ label.setLayoutData(gd);
+ label.moveAbove(fParentSv);
+ label.setText(getTitle());
+
+ showLinesColored();
+
+ if (getViewer() != null){
+ ISourceViewer sv = getViewer();
+
+ if (sv.getTextWidget() != null){
+
+ fCachedTextWidget = sv.getTextWidget();
+ fCachedTextWidget.addLineBackgroundListener(this);
+ }
+ }
+ }
+
+ @Override
+ protected void rulerContextMenuAboutToShow(IMenuManager menu) {
+ super.rulerContextMenuAboutToShow(menu);
+
+ CompositeRuler vr = (CompositeRuler)super.getVerticalRuler();
+
+ for(Iterator<?> iter = vr.getDecoratorIterator();iter.hasNext();){
+ IVerticalRulerColumn column = (IVerticalRulerColumn)iter.next();
+ if (column instanceof STContributedRulerColumn){
+ STContributedRulerColumn fSTColumn = (STContributedRulerColumn)column;
+ IAction stprofcolAction = getAction(ISTTextEditorActionConstants.ST_TOGGLE);
+ stprofcolAction.setChecked(fSTColumn != null && fSTColumn.isShowingSTRuler());
+ }
+ else if (column instanceof LineNumberColumn){
+ LineNumberColumn fLineColumn = (LineNumberColumn)column;
+ IAction lineNumberAction= getAction(ITextEditorActionConstants.LINENUMBERS_TOGGLE);
+ lineNumberAction.setChecked(fLineColumn != null && fLineColumn.isShowingLineNumbers());
+ }
+ }
+
+ if (fInput != null){
+ IAction stAction= getAction(ISTTextEditorActionConstants.ST_TOGGLE);
+ menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, stAction);
+ }
+
+
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object getAdapter(Class required) {
+ if (IColumnSupport.class.equals(required)) {
+ if (fColumnSupport == null)
+ fColumnSupport= createSTColumnSupport();
+ return fColumnSupport;
+ }
+
+ return super.getAdapter(required);
+ }
+
+ protected IColumnSupport createSTColumnSupport() {
+ return new STColumnSupport(this,RulerColumnRegistry.getDefault());
+ }
+
+ protected class STColumnSupport extends AbstractDecoratedTextEditor.ColumnSupport{
+ private final STAnnotatedCSourceEditor fEditor;
+ private final RulerColumnRegistry fRegistry;
+ private final ArrayList<ISTAnnotationColumn> fColumns;
+
+ public STColumnSupport(STAnnotatedCSourceEditor editor, RulerColumnRegistry registry) {
+ super(editor, registry);
+ fEditor = editor;
+ fRegistry = registry;
+ fColumns= new ArrayList<ISTAnnotationColumn>();
+ }
+
+ private int computeIndex(CompositeRuler ruler, RulerColumnDescriptor descriptor) {
+ int index= 0;
+ List<?> all= fRegistry.getColumnDescriptors();
+ int newPos= all.indexOf(descriptor);
+ for (Iterator<?> it= ruler.getDecoratorIterator(); it.hasNext();) {
+ IVerticalRulerColumn column= (IVerticalRulerColumn) it.next();
+ if (column instanceof IContributedRulerColumn) {
+ RulerColumnDescriptor rcd= ((IContributedRulerColumn)column).getDescriptor();
+ if (rcd != null && all.indexOf(rcd) > newPos)
+ break;
+ } else if ("org.eclipse.jface.text.source.projection.ProjectionRulerColumn".equals(column.getClass().getName())) { //$NON-NLS-1$
+ // projection column is always the rightmost column
+ break;
+ }
+ index++;
+ }
+ return index;
+ }
+
+ public void addSTColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor,final ISTAnnotationColumn annotationColumn) {
+
+ final int idx= computeIndex(ruler, descriptor);
+
+ SafeRunnable runnable= new SafeRunnable() {
+ public void run() throws Exception {
+ IContributedRulerColumn column= descriptor.createColumn(fEditor);
+ fColumns.add(annotationColumn);
+ initializeColumn(column);
+ ruler.addDecorator(idx, column);
+ }
+ };
+ SafeRunner.run(runnable);
+ }
+
+ protected void initializeColumn(IContributedRulerColumn column) {
+ super.initializeColumn(column);
+ RulerColumnDescriptor descriptor= column.getDescriptor();
+ IVerticalRuler ruler= getVerticalRuler();
+ if (ruler instanceof CompositeRuler) {
+ if (AnnotationColumn.ID.equals(descriptor.getId())) {
+ ((AnnotationColumn)column).setDelegate(createAnnotationRulerColumn((CompositeRuler) ruler));
+ } else if (LineNumberColumn.ID.equals(descriptor.getId())) {
+ fLineColumn= ((LineNumberColumn) column);
+ fLineColumn.setForwarder(new LineNumberColumn.ICompatibilityForwarder() {
+ public IVerticalRulerColumn createLineNumberRulerColumn() {
+ return fEditor.createLineNumberRulerColumn();
+ }
+ public boolean isQuickDiffEnabled() {
+ return fEditor.isPrefQuickDiffAlwaysOn();
+ }
+ public boolean isLineNumberRulerVisible() {
+ return fEditor.isLineNumberRulerVisible();
+ }
+ });
+ }
+ if (STContributedRulerColumn.ID.equals(descriptor.getId())){
+ fColumn = ((STContributedRulerColumn) column);
+ //this is a workaround...
+ fColumn.setForwarder(new STContributedRulerColumn.ICompatibilityForwarder() {
+ public IVerticalRulerColumn createSTRulerColumn() {
+ if (fColumns != null && fColumns.size() > 0){
+ IVerticalRulerColumn fDelegate = fEditor.createSTRulerColumn(fColumns.get(fColumns.size()-1));
+ return fDelegate;
+ }
+ return null;
+ }
+ public boolean isQuickDiffEnabled() {
+ return fEditor.isPrefQuickDiffAlwaysOn();
+ }
+ public boolean isSTRulerVisible() {
+ return fEditor.isSTRulerVisible();
+ }
+ });
+ }
+ }
+ }
+ }
+
+ protected IVerticalRulerColumn createSTRulerColumn(ISTAnnotationColumn annotationColumn) {
+ fSTChangeRulerColumn= new STChangeRulerColumn(getSharedColors(),annotationColumn);
+ ((IChangeRulerColumn) fSTChangeRulerColumn).setHover(createChangeHover());
+ initializeLineNumberRulerColumn(fLineNumberRulerColumn);
+
+ return fSTChangeRulerColumn;
+ }
+
+ public void lineGetBackground(LineBackgroundEvent event) {
+ if (fInput != null){
+ StyledTextContent c = (StyledTextContent)event.data;
+ int line = c.getLineAtOffset(event.lineOffset);
+ event.lineBackground = fInput.getColor(line);
+ }
+ }
+
+ @Override
+ protected void doSetInput(IEditorInput input) throws CoreException {
+ super.doSetInput(input);
+
+ if (input!=null && input instanceof AbstractSTAnnotatedSourceEditorInput){
+ fInput = (AbstractSTAnnotatedSourceEditorInput)input;
+ fListColumns = fInput.getColumns();
+ }
+ }
+
+ @Override
+ protected void createActions() {
+ super.createActions();
+
+ ResourceAction action;
+
+ action= new ResourceAction(STTextEditorMessages.getBundleForConstructedKeys(), "Editor.ToggleSTColumnAction.", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ toggleSTRuler();
+ }
+ };
+
+ if (fInput != null){
+ action.setActionDefinitionId(ISTTextEditorActionDefinitionIds.ST_TOGGLE);
+ setAction(ISTTextEditorActionConstants.ST_TOGGLE, action);
+ }
+ }
+
+ private void toggleSTRuler() {
+ // globally
+ IPreferenceStore store= EditorsUI.getPreferenceStore();
+ store.setValue(ST_RULER, !isSTRulerVisible());
+ }
+
+ protected boolean isSTRulerVisible() {
+ IPreferenceStore store= getPreferenceStore();
+ return store != null ? store.getBoolean(ST_RULER) : true;
+ }
+
+ private static class ToolTipSupport extends DefaultToolTip{
+ private STContributedRulerColumn control;
+ class ToolTipArea{
+ int line;
+ ISTAnnotationColumn ac;
+
+ ToolTipArea(int line,ISTAnnotationColumn ac){
+ this.line = line;
+ this.ac = ac;
+ }
+
+ public String getToolTip(){
+ return ac.getTooltip(line);
+ }
+
+ }
+
+ protected ToolTipSupport(STContributedRulerColumn control, int style,boolean manualActivation) {
+ super(control.getControl(), style, manualActivation);
+ this.control = control;
+ }
+
+ protected Object getToolTipArea(Event event) {
+
+ int line = control.toDocumentLineNumber(event.y);
+
+ return new ToolTipArea(line,control.getAnnotationColumn(line));
+ }
+
+ protected Composite createToolTipContentArea(Event event,
+ Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new FillLayout());
+ Label b = new Label(comp,SWT.NONE);
+ ToolTipArea area = (ToolTipArea)getToolTipArea(event);
+ if (area != null && area.getToolTip().trim().length()>0){
+ b.setText(area.getToolTip());
+ }
+ return comp;
+ }
+
+ public static void enableFor(STContributedRulerColumn control) {
+ new ToolTipSupport(control, ToolTip.NO_RECREATE, false);
+ }
+ }
+
+ protected IOverviewRuler createOverviewRuler(ISharedTextColors sharedColors) {
+ IOverviewRuler ruler= new STOverviewRuler(getAnnotationAccess(), VERTICAL_RULER_WIDTH, sharedColors);
+ MarkerAnnotationPreferences fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
+ Iterator<?> e= fAnnotationPreferences.getAnnotationPreferences().iterator();
+ while (e.hasNext()) {
+ AnnotationPreference preference= (AnnotationPreference) e.next();
+ if (preference.contributesToHeader())
+ ruler.addHeaderAnnotationType(preference.getAnnotationType());
+ }
+ return ruler;
+
+ }
+
+ private void showLinesColored(){
+ STOverviewRuler or = (STOverviewRuler)getOverviewRuler();
+ AnnotationModel am = (AnnotationModel)or.getModel();
+ IDocument doc = getSourceViewer().getDocument();
+ int lines = doc.getNumberOfLines();
+
+ for(int i=0;i<lines;i++){
+ try {
+ Color color = fInput.getColor(i);
+ int r = color.getRed();
+ int g = color.getGreen();
+ int b = color.getBlue();
+ if (r !=255 || g != 255 || b!= 255){
+ int offset = doc.getLineOffset(i);
+ String type = STAnnotatedSourceEditorActivator.getUniqueIdentifier() + STAnnotatedSourceEditorActivator.getAnnotationType();
+ Annotation annotation = new Annotation(type,true,"");
+ or.setAnnotationColor(annotation, color);
+ am.addAnnotation(annotation,new Position(offset));
+ }
+ } catch (BadLocationException e) {
+ Status s =new Status(Status.ERROR,STAnnotatedSourceEditorActivator.PLUGIN_ID,Status.ERROR,e.getMessage(),e);
+ STAnnotatedSourceEditorActivator.getDefault().getLog().log(s);
+ }
+ }
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STAnnotatedSourceEditorActivator.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STAnnotatedSourceEditorActivator.java
new file mode 100644
index 0000000000..90cedbfa8c
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STAnnotatedSourceEditorActivator.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+
+**********************************************************************
+*********/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class STAnnotatedSourceEditorActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.dataviewers.annotatedsourceeditor";
+
+ private static final String ANNOTATION_TYPE = ".coloredLines";
+
+ // The shared instance
+ private static STAnnotatedSourceEditorActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public STAnnotatedSourceEditorActivator() {
+ }
+
+ /*
+ * (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;
+ EditorsUI.getPreferenceStore().setValue("STRuler",true);
+ }
+
+ /*
+ * (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 STAnnotatedSourceEditorActivator getDefault() {
+ return plugin;
+ }
+
+ public static String getAnnotationType()
+ {
+ return ANNOTATION_TYPE;
+ }
+
+ public static String getUniqueIdentifier()
+ {
+ return PLUGIN_ID;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STChangeRulerColumn.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STChangeRulerColumn.java
new file mode 100644
index 0000000000..fa2e0571a3
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STChangeRulerColumn.java
@@ -0,0 +1,390 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.internal.text.revisions.RevisionPainter;
+import org.eclipse.jface.internal.text.source.DiffPainter;
+import org.eclipse.jface.text.revisions.IRevisionListener;
+import org.eclipse.jface.text.revisions.IRevisionRulerColumn;
+import org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension;
+import org.eclipse.jface.text.revisions.RevisionInformation;
+import org.eclipse.jface.text.source.CompositeRuler;
+import org.eclipse.jface.text.source.IAnnotationHover;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IChangeRulerColumn;
+import org.eclipse.jface.text.source.ILineRange;
+import org.eclipse.jface.text.source.ISharedTextColors;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.text.source.IVerticalRulerInfoExtension;
+import org.eclipse.jface.text.source.IVerticalRulerListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * A vertical ruler column displaying line numbers and serving as a UI for quick diff.
+ * Clients usually instantiate and configure object of this class.
+ *
+ * @since 3.0
+ */
+public final class STChangeRulerColumn extends STRulerColumn implements IVerticalRulerInfo, IVerticalRulerInfoExtension, IChangeRulerColumn, IRevisionRulerColumn, IRevisionRulerColumnExtension {
+ /** The ruler's annotation model. */
+ private IAnnotationModel fAnnotationModel;
+ /** <code>true</code> if changes should be displayed using character indications instead of background colors. */
+ private boolean fCharacterDisplay;
+ /**
+ * The revision painter strategy.
+ *
+ * @since 3.2
+ */
+ private final RevisionPainter fRevisionPainter;
+ /**
+ * The diff information painter strategy.
+ *
+ * @since 3.2
+ */
+ private final DiffPainter fDiffPainter;
+ /**
+ * Whether to show number or to behave like a change ruler column.
+ * @since 3.3
+ */
+ private boolean fShowSTRuler= true;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param sharedColors the shared colors provider to use
+ */
+ public STChangeRulerColumn(ISharedTextColors sharedColors,ISTAnnotationColumn ac) {
+ super(ac);
+ Assert.isNotNull(sharedColors);
+ fRevisionPainter= new RevisionPainter(this, sharedColors);
+ fDiffPainter= new DiffPainter(this, sharedColors);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.LineNumberRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite)
+ */
+ public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
+ Control control= super.createControl(parentRuler, parentControl);
+ fRevisionPainter.setParentRuler(parentRuler);
+ fDiffPainter.setParentRuler(parentRuler);
+ return control;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
+ */
+ public int getLineOfLastMouseButtonActivity() {
+ return getParentRuler().getLineOfLastMouseButtonActivity();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfo#toDocumentLineNumber(int)
+ */
+ public int toDocumentLineNumber(int y_coordinate) {
+ return getParentRuler().toDocumentLineNumber(y_coordinate);
+ }
+
+ /*
+ * @see IVerticalRulerColumn#setModel(IAnnotationModel)
+ */
+ public void setModel(IAnnotationModel model) {
+ setAnnotationModel(model);
+ fRevisionPainter.setModel(model);
+ fDiffPainter.setModel(model);
+ updateNumberOfDigits();
+ computeIndentations();
+ layout(true);
+ postRedraw();
+ }
+
+ private void setAnnotationModel(IAnnotationModel model) {
+ if (fAnnotationModel != model)
+ fAnnotationModel= model;
+ }
+
+
+ /**
+ * Sets the display mode of the ruler. If character mode is set to <code>true</code>, diff
+ * information will be displayed textually on the line number ruler.
+ *
+ * @param characterMode <code>true</code> if diff information is to be displayed textually.
+ */
+ public void setDisplayMode(boolean characterMode) {
+ if (characterMode != fCharacterDisplay) {
+ fCharacterDisplay= characterMode;
+ updateNumberOfDigits();
+ computeIndentations();
+ layout(true);
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#getModel()
+ */
+ public IAnnotationModel getModel() {
+ return fAnnotationModel;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.LineNumberRulerColumn#createDisplayString(int)
+ */
+ protected String createDisplayString(int line) {
+ StringBuffer buffer= new StringBuffer();
+ if (fShowSTRuler)
+ buffer.append(super.createDisplayString(line));
+ if (fCharacterDisplay && getModel() != null)
+ buffer.append(fDiffPainter.getDisplayCharacter(line));
+ return buffer.toString();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.LineNumberRulerColumn#computeNumberOfDigits()
+ */
+ protected int computeNumberOfDigits() {
+ int digits;
+ if (fCharacterDisplay && getModel() != null) {
+ if (fShowSTRuler)
+ digits= super.computeNumberOfDigits() + 1;
+ else
+ digits= 1;
+ } else {
+ if (fShowSTRuler)
+ digits= super.computeNumberOfDigits();
+ else
+ digits= 0;
+ }
+ if (fRevisionPainter.hasInformation())
+ digits+= fRevisionPainter.getRequiredWidth();
+ return digits;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#addVerticalRulerListener(org.eclipse.jface.text.source.IVerticalRulerListener)
+ */
+ public void addVerticalRulerListener(IVerticalRulerListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#removeVerticalRulerListener(org.eclipse.jface.text.source.IVerticalRulerListener)
+ */
+ public void removeVerticalRulerListener(IVerticalRulerListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.LineNumberRulerColumn#doPaint(org.eclipse.swt.graphics.GC)
+ */
+ void doPaint(GC gc, ILineRange visibleLines) {
+ Color foreground= gc.getForeground();
+ if (visibleLines != null) {
+ if (fRevisionPainter.hasInformation())
+ fRevisionPainter.paint(gc, visibleLines);
+ else if (fDiffPainter.hasInformation()) // don't paint quick diff colors if revisions are painted
+ fDiffPainter.paint(gc, visibleLines);
+ }
+ gc.setForeground(foreground);
+ if (fShowSTRuler || fCharacterDisplay)
+ super.doPaint(gc, visibleLines);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#getHover()
+ */
+ public IAnnotationHover getHover() {
+ int activeLine= getParentRuler().getLineOfLastMouseButtonActivity();
+ if (fRevisionPainter.hasHover(activeLine))
+ return fRevisionPainter.getHover();
+ if (fDiffPainter.hasHover(activeLine))
+ return fDiffPainter.getHover();
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IChangeRulerColumn#setHover(org.eclipse.jface.text.source.IAnnotationHover)
+ */
+ public void setHover(IAnnotationHover hover) {
+ fRevisionPainter.setHover(hover);
+ fDiffPainter.setHover(hover);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IChangeRulerColumn#setBackground(org.eclipse.swt.graphics.Color)
+ */
+ public void setBackground(Color background) {
+ super.setBackground(background);
+ fRevisionPainter.setBackground(background);
+ fDiffPainter.setBackground(background);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IChangeRulerColumn#setAddedColor(org.eclipse.swt.graphics.Color)
+ */
+ public void setAddedColor(Color addedColor) {
+ fDiffPainter.setAddedColor(addedColor);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IChangeRulerColumn#setChangedColor(org.eclipse.swt.graphics.Color)
+ */
+ public void setChangedColor(Color changedColor) {
+ fDiffPainter.setChangedColor(changedColor);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IChangeRulerColumn#setDeletedColor(org.eclipse.swt.graphics.Color)
+ */
+ public void setDeletedColor(Color deletedColor) {
+ fDiffPainter.setDeletedColor(deletedColor);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.revisions.IRevisionRulerColumn#setRevisionInformation(org.eclipse.jface.text.revisions.RevisionInformation)
+ */
+ public void setRevisionInformation(RevisionInformation info) {
+ fRevisionPainter.setRevisionInformation(info);
+ updateNumberOfDigits();
+ computeIndentations();
+ layout(true);
+ postRedraw();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension#getRevisionSelectionProvider()
+ * @since 3.2
+ */
+ public ISelectionProvider getRevisionSelectionProvider() {
+ return fRevisionPainter.getRevisionSelectionProvider();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension#setRenderingMode(org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension.RenderingMode)
+ * @since 3.3
+ */
+ public void setRevisionRenderingMode(RenderingMode renderingMode) {
+ fRevisionPainter.setRenderingMode(renderingMode);
+ }
+
+ /**
+ * Sets the line number display mode.
+ *
+ * @param showNumbers <code>true</code> to show numbers, <code>false</code> to only show
+ * diff / revision info.
+ * @since 3.3
+ */
+ public void showLineNumbers(boolean showNumbers) {
+ if (fShowSTRuler != showNumbers) {
+ fShowSTRuler= showNumbers;
+ updateNumberOfDigits();
+ computeIndentations();
+ layout(true);
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.LineNumberRulerColumn#getWidth()
+ * @since 3.3
+ */
+ public int getWidth() {
+ int width= super.getWidth();
+ return width > 0 ? width : 8; // minimal width to display quick diff / revisions if no textual info is shown
+ }
+
+ /**
+ * Returns <code>true</code> if the ruler is showing line numbers, <code>false</code>
+ * otherwise
+ *
+ * @return <code>true</code> if line numbers are shown, <code>false</code> otherwise
+ * @since 3.3
+ */
+ public boolean isShowingSTRuler() {
+ return fShowSTRuler;
+ }
+
+ /**
+ * Returns <code>true</code> if the ruler is showing revision information, <code>false</code>
+ * otherwise
+ *
+ * @return <code>true</code> if revision information is shown, <code>false</code> otherwise
+ * @since 3.3
+ */
+ public boolean isShowingRevisionInformation() {
+ return fRevisionPainter.hasInformation();
+ }
+
+ /**
+ * Returns <code>true</code> if the ruler is showing change information, <code>false</code>
+ * otherwise
+ *
+ * @return <code>true</code> if change information is shown, <code>false</code> otherwise
+ * @since 3.3
+ */
+ public boolean isShowingChangeInformation() {
+ return fDiffPainter.hasInformation();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension#showRevisionAuthor(boolean)
+ * @since 3.3
+ */
+ public void showRevisionAuthor(boolean show) {
+ fRevisionPainter.showRevisionAuthor(show);
+ updateNumberOfDigits();
+ computeIndentations();
+ layout(true);
+ postRedraw();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension#showRevisionId(boolean)
+ * @since 3.3
+ */
+ public void showRevisionId(boolean show) {
+ fRevisionPainter.showRevisionId(show);
+ updateNumberOfDigits();
+ computeIndentations();
+ layout(true);
+ postRedraw();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension#addRevisionListener(org.eclipse.jface.text.revisions.IRevisionListener)
+ * @since 3.3
+ */
+ public void addRevisionListener(IRevisionListener listener) {
+ fRevisionPainter.addRevisionListener(listener);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension#removeRevisionListener(org.eclipse.jface.text.revisions.IRevisionListener)
+ * @since 3.3
+ */
+ public void removeRevisionListener(IRevisionListener listener) {
+ fRevisionPainter.removeRevisionListener(listener);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.LineNumberRulerColumn#handleDispose()
+ * @since 3.3
+ */
+ protected void handleDispose() {
+ fRevisionPainter.setParentRuler(null);
+ fRevisionPainter.setModel(null);
+ fDiffPainter.setParentRuler(null);
+ fDiffPainter.setModel(null);
+ super.handleDispose();
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STConstructedTextEditorMessages.properties b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STConstructedTextEditorMessages.properties
new file mode 100644
index 0000000000..0c9d76cd67
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STConstructedTextEditorMessages.properties
@@ -0,0 +1,4 @@
+Editor.ToggleSTColumnAction.label=Show Annotation &Columns
+Editor.ToggleSTColumnAction.description=Show Annotation Columns
+Editor.STColumnAction.tooltip=Display the Annotation Column Ruler
+Editor.STColumnAction.image=
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STContributedRulerColumn.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STContributedRulerColumn.java
new file mode 100644
index 0000000000..0836fd7613
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STContributedRulerColumn.java
@@ -0,0 +1,798 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.revisions.IRevisionRulerColumn;
+import org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension;
+import org.eclipse.jface.text.revisions.RevisionInformation;
+import org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension.RenderingMode;
+import org.eclipse.jface.text.source.AnnotationModel;
+import org.eclipse.jface.text.source.CompositeRuler;
+import org.eclipse.jface.text.source.IAnnotationHover;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IAnnotationModelExtension;
+import org.eclipse.jface.text.source.IChangeRulerColumn;
+import org.eclipse.jface.text.source.ILineDifferExtension;
+import org.eclipse.jface.text.source.ILineDifferExtension2;
+import org.eclipse.jface.text.source.ISharedTextColors;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRulerColumn;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.text.source.IVerticalRulerInfoExtension;
+import org.eclipse.jface.text.source.IVerticalRulerListener;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.preferencespages.STAnnotatedSourceEditorPreferencePage;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+import org.eclipse.ui.internal.texteditor.PropertyEventDispatcher;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
+import org.eclipse.ui.texteditor.AnnotationPreference;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorExtension;
+import org.eclipse.ui.texteditor.ITextEditorExtension2;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
+import org.eclipse.ui.texteditor.quickdiff.QuickDiff;
+import org.eclipse.ui.texteditor.rulers.AbstractContributedRulerColumn;
+
+
+public class STContributedRulerColumn extends AbstractContributedRulerColumn implements IVerticalRulerInfo, IVerticalRulerInfoExtension {
+ /**
+ * Forwarder for preference checks and ruler creation. Needed to maintain the forwarded APIs in
+ * {@link AbstractDecoratedTextEditor}.
+ */
+ public static interface ICompatibilityForwarder {
+ IVerticalRulerColumn createSTRulerColumn();
+ boolean isQuickDiffEnabled();
+ boolean isSTRulerVisible();
+ }
+
+ public static final String ID= "org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.column"; //$NON-NLS-1$
+
+ private static final String FG_COLOR_KEY= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR;
+ private static final String BG_COLOR_KEY= AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND;
+ private static final String USE_DEFAULT_BG_KEY= AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT;
+ private final static String ST_KEY= STAnnotatedSourceEditorPreferencePage.EDITOR_ST_RULER;
+ private final static String REVISION_ASK_BEFORE_QUICKDIFF_SWITCH_KEY= AbstractDecoratedTextEditorPreferenceConstants.REVISION_ASK_BEFORE_QUICKDIFF_SWITCH;
+
+ private IVerticalRulerColumn fDelegate;
+ /**
+ * The annotation preferences.
+ */
+ private final MarkerAnnotationPreferences fAnnotationPreferences= EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
+
+ /**
+ * Preference dispatcher that registers a single listener so we don't have to manage every
+ * single preference listener.
+ */
+ private PropertyEventDispatcher fDispatcher;
+ private ISourceViewer fViewer;
+ private ICompatibilityForwarder fForwarder;
+
+
+ private Label labelColumn;
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite)
+ */
+ public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
+ Assert.isTrue(fDelegate != null);
+ ITextViewer viewer= parentRuler.getTextViewer();
+ Assert.isLegal(viewer instanceof ISourceViewer);
+ fViewer= (ISourceViewer) viewer;
+ initialize();
+ Control control= fDelegate.createControl(parentRuler, parentControl);
+ return control;
+ }
+
+ public void setLabelColumn(Label label){
+ labelColumn = label;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerColumn#getControl()
+ */
+ public Control getControl() {
+ return fDelegate.getControl();
+ }
+
+ public ISTAnnotationColumn getAnnotationColumn(int line){
+ if (fDelegate instanceof STChangeRulerColumn){
+ return ((STChangeRulerColumn)fDelegate).getSTAnnotationColumn();
+ }
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerColumn#getWidth()
+ */
+ public int getWidth() {
+ return fDelegate.getWidth();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerColumn#redraw()
+ */
+ public void redraw() {
+ fDelegate.redraw();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerColumn#setFont(org.eclipse.swt.graphics.Font)
+ */
+ public void setFont(Font font) {
+ fDelegate.setFont(font);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerColumn#setModel(org.eclipse.jface.text.source.IAnnotationModel)
+ */
+ public void setModel(IAnnotationModel model) {
+ if (getQuickDiffPreference())
+ fDelegate.setModel(model);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
+ */
+ public int getLineOfLastMouseButtonActivity() {
+ if (fDelegate instanceof IVerticalRulerInfo)
+ ((IVerticalRulerInfo) fDelegate).getLineOfLastMouseButtonActivity();
+ return -1;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfo#toDocumentLineNumber(int)
+ */
+ public int toDocumentLineNumber(int y_coordinate) {
+ if (fDelegate instanceof IVerticalRulerInfo)
+ return ((IVerticalRulerInfo) fDelegate).toDocumentLineNumber(y_coordinate);
+ return -1;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#addVerticalRulerListener(org.eclipse.jface.text.source.IVerticalRulerListener)
+ */
+ public void addVerticalRulerListener(IVerticalRulerListener listener) {
+ if (fDelegate instanceof IVerticalRulerInfoExtension)
+ ((IVerticalRulerInfoExtension) fDelegate).addVerticalRulerListener(listener);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#getHover()
+ */
+ public IAnnotationHover getHover() {
+ if (fDelegate instanceof IVerticalRulerInfoExtension)
+ return ((IVerticalRulerInfoExtension) fDelegate).getHover();
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#getModel()
+ */
+ public IAnnotationModel getModel() {
+ if (fDelegate instanceof IVerticalRulerInfoExtension)
+ return ((IVerticalRulerInfoExtension) fDelegate).getModel();
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#removeVerticalRulerListener(org.eclipse.jface.text.source.IVerticalRulerListener)
+ */
+ public void removeVerticalRulerListener(IVerticalRulerListener listener) {
+ if (fDelegate instanceof IVerticalRulerInfoExtension)
+ ((IVerticalRulerInfoExtension) fDelegate).removeVerticalRulerListener(listener);
+ }
+
+ /*
+ * @see org.eclipse.ui.texteditor.rulers.AbstractContributedRulerColumn#columnRemoved()
+ */
+ public void columnRemoved() {
+ if (fDispatcher != null) {
+ fDispatcher.dispose();
+ fDispatcher= null;
+ }
+ }
+
+ private IPreferenceStore getPreferenceStore() {
+ return EditorsUI.getPreferenceStore();
+ }
+
+ private ISharedTextColors getSharedColors() {
+ return EditorsUI.getSharedTextColors();
+ }
+
+ /**
+ * Initializes the given line number ruler column from the preference store.
+ */
+ private void initialize() {
+ final IPreferenceStore store= getPreferenceStore();
+ if (store == null)
+ return;
+
+ // initial set up
+ updateForegroundColor(store, fDelegate);
+ updateBackgroundColor(store, fDelegate);
+
+ updateLineNumbersVisibility(fDelegate);
+ updateQuickDiffVisibility(fDelegate);
+ updateCharacterMode(store, fDelegate);
+ updateRevisionRenderingMode(store, fDelegate);
+ updateRevisionAuthorVisibility(store, fDelegate);
+ updateRevisionIdVisibility(store, fDelegate);
+
+ Map<Object, AnnotationPreference> annotationPrefs= getAnnotationPreferenceMap();
+ final AnnotationPreference changedPref= annotationPrefs.get("org.eclipse.ui.workbench.texteditor.quickdiffChange"); //$NON-NLS-1$
+ final AnnotationPreference addedPref= annotationPrefs.get("org.eclipse.ui.workbench.texteditor.quickdiffAddition"); //$NON-NLS-1$
+ final AnnotationPreference deletedPref= annotationPrefs.get("org.eclipse.ui.workbench.texteditor.quickdiffDeletion"); //$NON-NLS-1$
+ updateChangedColor(changedPref, store, fDelegate);
+ updateAddedColor(addedPref, store, fDelegate);
+ updateDeletedColor(deletedPref, store, fDelegate);
+
+ if (fDelegate != null)
+ fDelegate.redraw();
+
+ // listen to changes
+ fDispatcher= new PropertyEventDispatcher(store);
+
+ fDispatcher.addPropertyChangeListener(FG_COLOR_KEY, new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateForegroundColor(store, fDelegate);
+ fDelegate.redraw();
+ }
+ });
+ IPropertyChangeListener backgroundHandler= new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateBackgroundColor(store, fDelegate);
+ fDelegate.redraw();
+ }
+ };
+ fDispatcher.addPropertyChangeListener(BG_COLOR_KEY, backgroundHandler);
+ fDispatcher.addPropertyChangeListener(USE_DEFAULT_BG_KEY, backgroundHandler);
+
+ fDispatcher.addPropertyChangeListener(ST_KEY, new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ // only handle quick diff on/off information, but not ruler visibility (handled by AbstractDecoratedTextEditor)
+
+ updateLineNumbersVisibility(fDelegate);
+ }
+ });
+
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE, new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateCharacterMode(store, fDelegate);
+ }
+ });
+
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE, new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateRevisionRenderingMode(store, fDelegate);
+ }
+ });
+
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_AUTHOR, new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateRevisionAuthorVisibility(store, fDelegate);
+ }
+ });
+
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_REVISION, new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateRevisionIdVisibility(store, fDelegate);
+ }
+ });
+
+ fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON, new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateQuickDiffVisibility(fDelegate);
+ }
+ });
+
+ if (changedPref != null) {
+ fDispatcher.addPropertyChangeListener(changedPref.getColorPreferenceKey(), new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateChangedColor(changedPref, store, fDelegate);
+ fDelegate.redraw();
+ }
+ });
+ }
+ if (addedPref != null) {
+ fDispatcher.addPropertyChangeListener(addedPref.getColorPreferenceKey(), new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateAddedColor(addedPref, store, fDelegate);
+ fDelegate.redraw();
+ }
+ });
+ }
+ if (deletedPref != null) {
+ fDispatcher.addPropertyChangeListener(deletedPref.getColorPreferenceKey(), new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateDeletedColor(deletedPref, store, fDelegate);
+ fDelegate.redraw();
+ }
+ });
+ }
+ }
+
+ private Map<Object, AnnotationPreference> getAnnotationPreferenceMap() {
+ Map<Object, AnnotationPreference> annotationPrefs= new HashMap<Object, AnnotationPreference>();
+ Iterator<?> iter= fAnnotationPreferences.getAnnotationPreferences().iterator();
+ while (iter.hasNext()) {
+ AnnotationPreference pref= (AnnotationPreference) iter.next();
+ Object type= pref.getAnnotationType();
+ annotationPrefs.put(type, pref);
+ }
+ return annotationPrefs;
+ }
+
+ private void updateForegroundColor(IPreferenceStore store, IVerticalRulerColumn column) {
+ RGB rgb= getColorFromStore(store, FG_COLOR_KEY);
+ if (rgb == null)
+ rgb= new RGB(0, 0, 0);
+ ISharedTextColors sharedColors= getSharedColors();
+ if (column instanceof STRulerColumn)
+ ((STRulerColumn) column).setForeground(sharedColors.getColor(rgb));
+ }
+
+ private void updateBackgroundColor(IPreferenceStore store, IVerticalRulerColumn column) {
+ // background color: same as editor, or system default
+ RGB rgb;
+ if (store.getBoolean(USE_DEFAULT_BG_KEY))
+ rgb= null;
+ else
+ rgb= getColorFromStore(store, BG_COLOR_KEY);
+ ISharedTextColors sharedColors= getSharedColors();
+ if (column instanceof STRulerColumn)
+ ((STRulerColumn) column).setBackground(sharedColors.getColor(rgb));
+ }
+
+ private void updateChangedColor(AnnotationPreference pref, IPreferenceStore store, IVerticalRulerColumn column) {
+ if (pref != null && column instanceof IChangeRulerColumn) {
+ RGB rgb= getColorFromAnnotationPreference(store, pref);
+ ((IChangeRulerColumn) column).setChangedColor(getSharedColors().getColor(rgb));
+ }
+ }
+
+ private void updateAddedColor(AnnotationPreference pref, IPreferenceStore store, IVerticalRulerColumn column) {
+ if (pref != null && column instanceof IChangeRulerColumn) {
+ RGB rgb= getColorFromAnnotationPreference(store, pref);
+ ((IChangeRulerColumn) column).setAddedColor(getSharedColors().getColor(rgb));
+ }
+ }
+
+ private void updateDeletedColor(AnnotationPreference pref, IPreferenceStore store, IVerticalRulerColumn column) {
+ if (pref != null && column instanceof IChangeRulerColumn) {
+ RGB rgb= getColorFromAnnotationPreference(store, pref);
+ ((IChangeRulerColumn) column).setDeletedColor(getSharedColors().getColor(rgb));
+ }
+ }
+
+ private void updateCharacterMode(IPreferenceStore store, IVerticalRulerColumn column) {
+ if (column instanceof STChangeRulerColumn) {
+ STChangeRulerColumn lncrc= (STChangeRulerColumn) column;
+ lncrc.setDisplayMode(store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE));
+ }
+ }
+
+ private void updateLineNumbersVisibility(IVerticalRulerColumn column) {
+ if (column instanceof STChangeRulerColumn){
+ if (labelColumn != null){
+ labelColumn.setVisible(getLineNumberPreference());
+ Label labelName = (Label)labelColumn.getParent().getChildren()[labelColumn.getParent().getChildren().length-2];
+ labelName.setVisible(labelColumn.isVisible());
+
+ }
+ ((STChangeRulerColumn) column).showLineNumbers(getLineNumberPreference());
+ }
+ }
+
+ private void updateRevisionRenderingMode(IPreferenceStore store, IVerticalRulerColumn column) {
+ if (column instanceof IRevisionRulerColumnExtension) {
+ String option= store.getString(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE);
+ RenderingMode[] modes= { IRevisionRulerColumnExtension.AUTHOR, IRevisionRulerColumnExtension.AGE, IRevisionRulerColumnExtension.AUTHOR_SHADED_BY_AGE };
+ for (int i= 0; i < modes.length; i++) {
+ if (modes[i].name().equals(option)) {
+ ((IRevisionRulerColumnExtension) column).setRevisionRenderingMode(modes[i]);
+ return;
+ }
+ }
+ }
+ }
+
+ private void updateRevisionAuthorVisibility(IPreferenceStore store, IVerticalRulerColumn column) {
+ if (column instanceof IRevisionRulerColumnExtension) {
+ boolean show= store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_AUTHOR);
+ ((IRevisionRulerColumnExtension) column).showRevisionAuthor(show);
+ }
+ }
+
+ private void updateRevisionIdVisibility(IPreferenceStore store, IVerticalRulerColumn column) {
+ if (column instanceof IRevisionRulerColumnExtension) {
+ boolean show= store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_REVISION);
+ ((IRevisionRulerColumnExtension) column).showRevisionId(show);
+ }
+ }
+
+ private void updateQuickDiffVisibility(IVerticalRulerColumn column) {
+ boolean show= getQuickDiffPreference();
+ if (show == isShowingChangeInformation())
+ return;
+
+ if (show)
+ installChangeRulerModel(column);
+ else
+ uninstallChangeRulerModel(column);
+ }
+
+ /**
+ * Returns whether the line number ruler column should be
+ * visible according to the preference store settings. Subclasses may override this
+ * method to provide a custom preference setting.
+ *
+ * @return <code>true</code> if the line numbers should be visible
+ */
+ private boolean getLineNumberPreference() {
+ if (fForwarder != null)
+ return fForwarder.isSTRulerVisible();
+ IPreferenceStore store= getPreferenceStore();
+ return store != null ? store.getBoolean(ST_KEY) : false;
+ }
+
+ /**
+ * Returns whether quick diff info should be visible upon opening an editor
+ * according to the preference store settings.
+ *
+ * @return <code>true</code> if the line numbers should be visible
+ */
+ private boolean getQuickDiffPreference() {
+ if (fForwarder != null)
+ return fForwarder.isQuickDiffEnabled();
+ IPreferenceStore store= getPreferenceStore();
+ boolean setting= store != null ? store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON) : false;
+ if (!setting)
+ return false;
+
+ boolean modifiable;
+ ITextEditor editor= getEditor();
+ if (editor instanceof ITextEditorExtension2) {
+ ITextEditorExtension2 ext= (ITextEditorExtension2) editor;
+ modifiable= ext.isEditorInputModifiable();
+ } else if (editor instanceof ITextEditorExtension) {
+ ITextEditorExtension ext= (ITextEditorExtension) editor;
+ modifiable= ext.isEditorInputReadOnly();
+ } else if (editor != null) {
+ modifiable= editor.isEditable();
+ } else {
+ modifiable= true;
+ }
+ return modifiable;
+ }
+
+ /**
+ * Extracts the color preference for the given preference from the given store.
+ * If the given store indicates that the default value is to be used, or
+ * the value stored in the preferences store is <code>null</code>,
+ * the value is taken from the <code>AnnotationPreference</code>'s default
+ * color value.
+ * <p>
+ * The return value is
+ * </p>
+ *
+ * @param store the preference store
+ * @param pref the annotation preference
+ * @return the RGB color preference, not <code>null</code>
+ */
+ private static RGB getColorFromAnnotationPreference(IPreferenceStore store, AnnotationPreference pref) {
+ String key= pref.getColorPreferenceKey();
+ RGB rgb= null;
+ if (store.contains(key)) {
+ if (store.isDefault(key))
+ rgb= pref.getColorPreferenceValue();
+ else
+ rgb= PreferenceConverter.getColor(store, key);
+ }
+ if (rgb == null)
+ rgb= pref.getColorPreferenceValue();
+ return rgb;
+ }
+
+ private static RGB getColorFromStore(IPreferenceStore store, String key) {
+ RGB rgb= null;
+ if (store.contains(key)) {
+ if (store.isDefault(key))
+ rgb= PreferenceConverter.getDefaultColor(store, key);
+ else
+ rgb= PreferenceConverter.getColor(store, key);
+ }
+ return rgb;
+ }
+
+ /**
+ * Ensures that quick diff information is displayed and the quick diff provider is the one with
+ * the specified id. If a different quick diff provider is in use, the user may be asked whether
+ * he wants to switch.
+ *
+ * @param diffProviderId the quick diff provider id to use
+ * @return <code>true</code> if quick diff could be enabled for the given id,
+ * <code>false</code> otherwise
+ */
+ private boolean ensureQuickDiffProvider(String diffProviderId) {
+ if (!isShowingChangeInformation())
+ installChangeRulerModel(fDelegate); // FIXME pass provider id
+
+ IAnnotationModel annotationModel= fViewer.getAnnotationModel();
+ IAnnotationModel oldDiffer= getDiffer();
+ if (oldDiffer == null && annotationModel != null)
+ return false; // quick diff is enabled, but no differ? not working for whatever reason
+
+ if (annotationModel == null)
+ annotationModel= new AnnotationModel();
+ if (!(annotationModel instanceof IAnnotationModelExtension))
+ return false;
+
+ QuickDiff util= new QuickDiff();
+ Object oldDifferId= util.getConfiguredQuickDiffProvider(oldDiffer);
+ if (oldDifferId.equals(diffProviderId)) {
+ if (oldDiffer instanceof ILineDifferExtension)
+ ((ILineDifferExtension) oldDiffer).resume();
+ return true;
+ }
+
+ // Check whether the desired provider is available at all
+ IAnnotationModel newDiffer= util.createQuickDiffAnnotationModel(getEditor(), diffProviderId);
+ if (util.getConfiguredQuickDiffProvider(newDiffer).equals(oldDifferId)) {
+ if (oldDiffer instanceof ILineDifferExtension)
+ ((ILineDifferExtension) oldDiffer).resume();
+ return true;
+ }
+
+ // quick diff is showing with the wrong provider - ask the user whether he wants to switch
+ IPreferenceStore store= EditorsUI.getPreferenceStore();
+ if (oldDiffer != null && !store.getString(REVISION_ASK_BEFORE_QUICKDIFF_SWITCH_KEY).equals(MessageDialogWithToggle.ALWAYS)) {
+ MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openOkCancelConfirm(
+ fViewer.getTextWidget().getShell(),
+ STRulerMessages.AbstractDecoratedTextEditor_revision_quickdiff_switch_title,
+ STRulerMessages.AbstractDecoratedTextEditor_revision_quickdiff_switch_message,
+ STRulerMessages.AbstractDecoratedTextEditor_revision_quickdiff_switch_rememberquestion,
+ true,
+ store,
+ REVISION_ASK_BEFORE_QUICKDIFF_SWITCH_KEY);
+ if (toggleDialog.getReturnCode() != Window.OK)
+ return false;
+ }
+
+ IAnnotationModelExtension modelExtension=(IAnnotationModelExtension) annotationModel;
+ modelExtension.removeAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
+
+
+ modelExtension.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, newDiffer);
+
+ if (fDelegate instanceof IChangeRulerColumn)
+ ((IChangeRulerColumn) fDelegate).setModel(annotationModel); // picks up the new model attachment
+
+ return true;
+ }
+
+ /**
+ * Installs the differ annotation model with the current quick diff display.
+ *
+ * @param column the column to install the model on
+ */
+ private void installChangeRulerModel(IVerticalRulerColumn column) {
+ if (column instanceof IChangeRulerColumn) {
+ IAnnotationModel model= getAnnotationModelWithDiffer();
+ ((IChangeRulerColumn) column).setModel(model);
+ if (model != null) {
+ ISourceViewer viewer= fViewer;
+ if (viewer != null && viewer.getAnnotationModel() == null)
+ viewer.showAnnotations(true);
+ }
+ }
+ }
+
+ /**
+ * Uninstalls the differ annotation model from the current quick diff display.
+ *
+ * @param column the column to remove the model from
+ */
+ private void uninstallChangeRulerModel(IVerticalRulerColumn column) {
+ if (column instanceof IChangeRulerColumn)
+ ((IChangeRulerColumn) column).setModel(null);
+ IAnnotationModel model= getDiffer();
+ if (model instanceof ILineDifferExtension)
+ ((ILineDifferExtension) model).suspend();
+
+ ISourceViewer viewer= fViewer;
+ if (viewer != null && viewer.getAnnotationModel() == null)
+ viewer.showAnnotations(false);
+ }
+
+ /**
+ * Returns the annotation model that contains the quick diff annotation model.
+ * <p>
+ * Extracts the line differ from the displayed document's annotation model. If none can be found,
+ * a new differ is created and attached to the annotation model.</p>
+ *
+ * @return the annotation model that contains the line differ, or <code>null</code> if none could be found or created
+ * @see IChangeRulerColumn#QUICK_DIFF_MODEL_ID
+ */
+ private IAnnotationModel getAnnotationModelWithDiffer() {
+ ISourceViewer viewer= fViewer;
+ if (viewer == null)
+ return null;
+
+ IAnnotationModel m= viewer.getAnnotationModel();
+ IAnnotationModelExtension model= null;
+ if (m instanceof IAnnotationModelExtension)
+ model= (IAnnotationModelExtension) m;
+
+ IAnnotationModel differ= getDiffer();
+ // create diff model if it doesn't
+ if (differ == null) {
+ IPreferenceStore store= getPreferenceStore();
+ if (store != null) {
+ String defaultId= store.getString(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER);
+ differ= new QuickDiff().createQuickDiffAnnotationModel(getEditor(), defaultId);
+ if (differ != null) {
+ if (model == null)
+ model= new AnnotationModel();
+ model.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, differ);
+ }
+ }
+ } else if (differ instanceof ILineDifferExtension2) {
+ if (((ILineDifferExtension2) differ).isSuspended())
+ ((ILineDifferExtension) differ).resume();
+ } else if (differ instanceof ILineDifferExtension) {
+ ((ILineDifferExtension) differ).resume();
+ }
+
+ return (IAnnotationModel)model;
+ }
+
+ /**
+ * Extracts the line differ from the displayed document's annotation model. If none can be found,
+ * <code>null</code> is returned.
+ *
+ * @return the line differ, or <code>null</code> if none could be found
+ */
+ private IAnnotationModel getDiffer() {
+ // get annotation model extension
+ ISourceViewer viewer= fViewer;
+ if (viewer == null)
+ return null;
+
+ IAnnotationModel m= viewer.getAnnotationModel();
+ if (m == null && fDelegate instanceof IChangeRulerColumn)
+ m= ((IChangeRulerColumn)fDelegate).getModel();
+
+ if (!(m instanceof IAnnotationModelExtension))
+ return null;
+
+ IAnnotationModelExtension model= (IAnnotationModelExtension)m;
+
+ // get diff model if it exists already
+ return model.getAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
+ }
+
+ /**
+ * Sets the forwarder. Used by {@link AbstractDecoratedTextEditor} to maintain the contract of
+ * its {@link AbstractDecoratedTextEditor#createLineNumberRulerColumn} method.
+ *
+ * @param forwarder the forwarder
+ */
+ public void setForwarder(ICompatibilityForwarder forwarder) {
+ fForwarder= forwarder;
+ fDelegate= forwarder.createSTRulerColumn();
+ }
+
+ /**
+ * Initializes the given line number ruler column from the preference store.
+ *
+ * @param rulerColumn the ruler column to be initialized
+ */
+ public void initializeSTRulerColumn(STRulerColumn rulerColumn) {
+ IPreferenceStore store= getPreferenceStore();
+ if (store != null) {
+ updateForegroundColor(store, rulerColumn);
+ updateBackgroundColor(store, rulerColumn);
+ updateLineNumbersVisibility(rulerColumn);
+ rulerColumn.redraw();
+ }
+ }
+
+ /**
+ * Returns <code>true</code> if the ruler is showing line numbers, <code>false</code> if it
+ * is only showing change information.
+ *
+ * @return <code>true</code> if line numbers are shown, <code>false</code> otherwise
+ */
+ public boolean isShowingSTRuler() {
+ boolean b = fDelegate instanceof STRulerColumn && ((STChangeRulerColumn) fDelegate).isShowingSTRuler();
+ return b;
+ }
+
+ /**
+ * Returns <code>true</code> if the ruler is showing change information, <code>false</code>
+ * if it is only showing line numbers.
+ *
+ * @return <code>true</code> if change information is shown, <code>false</code> otherwise
+ */
+ public boolean isShowingChangeInformation() {
+ return fDelegate instanceof STChangeRulerColumn && ((STChangeRulerColumn) fDelegate).isShowingChangeInformation();
+ }
+
+ /**
+ * Shows revision information on the receiver.
+ *
+ * @param info the revision information to show
+ * @param quickDiffProviderId the id of the corresponding quick diff provider
+ */
+ public void showRevisionInformation(RevisionInformation info, String quickDiffProviderId) {
+ if (!ensureQuickDiffProvider(quickDiffProviderId))
+ return;
+
+ if (fDelegate instanceof IRevisionRulerColumn)
+ ((IRevisionRulerColumn) fDelegate).setRevisionInformation(info);
+ }
+
+ /**
+ * Hides revision information.
+ */
+ public void hideRevisionInformation() {
+ if (fDelegate instanceof IRevisionRulerColumn)
+ ((IRevisionRulerColumn) fDelegate).setRevisionInformation(null);
+ }
+
+ /**
+ * Returns <code>true</code> if the ruler is showing revision information, <code>false</code>
+ * if it is only showing line numbers.
+ *
+ * @return <code>true</code> if revision information is shown, <code>false</code> otherwise
+ */
+ public boolean isShowingRevisionInformation() {
+ if (fDelegate instanceof STChangeRulerColumn)
+ return ((STChangeRulerColumn) fDelegate).isShowingRevisionInformation();
+ return false;
+ }
+
+ /**
+ * Returns the selection provider of the revision column, <code>null</code> if none is
+ * available.
+ *
+ * @return the revision selection provider
+ */
+ public ISelectionProvider getRevisionSelectionProvider() {
+ if (fDelegate instanceof IRevisionRulerColumnExtension)
+ return ((IRevisionRulerColumnExtension) fDelegate).getRevisionSelectionProvider();
+ return null;
+ }
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STJFaceTextMessages.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STJFaceTextMessages.java
new file mode 100644
index 0000000000..410b5cf68f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STJFaceTextMessages.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+02: * Copyright (c) 2000, 2005 IBM Corporation and others.
+03: * All rights reserved. This program and the accompanying materials
+04: * are made available under the terms of the Eclipse Public License v1.0
+05: * which accompanies this distribution, and is available at
+06: * http://www.eclipse.org/legal/epl-v10.html
+07: *
+08: * Contributors:
+09: * IBM Corporation - initial API and implementation
+10: *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Accessor for the <code>JFaceTextMessages.properties</code> file in
+ * package <code>org.eclipse.jface.text</code>.
+ * @since 2.0
+ */
+class STJFaceTextMessages {
+
+ /** The resource bundle name. */
+ private static final String RESOURCE_BUNDLE= "org.eclipse.jface.text.JFaceTextMessages";//$NON-NLS-1$
+
+ /** The resource bundle. */
+ private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+ /**
+ * Prohibits the creation of accessor objects.
+ */
+ private STJFaceTextMessages() {
+ }
+
+ /**
+ * Returns the string found in the resource bundle under the given key or a place holder string.
+ *
+ * @param key the look up key
+ * @return the value found under the given key
+ */
+ public static String getString(String key) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Gets a string from the resource bundle and formats it with the argument
+ *
+ * @param key the string used to get the bundle value, must not be null
+ * @param args arguments used when formatting the string
+ * @return the formatted string
+ * @since 3.0
+ */
+ public static String getFormattedString(String key, Object[] args) {
+ String format= null;
+ try {
+ format= fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ return MessageFormat.format(format, args);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STOverviewRuler.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STOverviewRuler.java
new file mode 100644
index 0000000000..cf7f084902
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STOverviewRuler.java
@@ -0,0 +1,1309 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.ViewForm;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+import org.eclipse.jface.text.JFaceTextUtil;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextListener;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITextViewerExtension5;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextEvent;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationAccess;
+import org.eclipse.jface.text.source.IAnnotationAccessExtension;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IAnnotationModelListener;
+import org.eclipse.jface.text.source.IOverviewRuler;
+import org.eclipse.jface.text.source.ISharedTextColors;
+import org.eclipse.jface.text.source.projection.AnnotationBag;
+
+public class STOverviewRuler implements IOverviewRuler {
+
+ /**
+ * Internal listener class.
+ */
+ class InternalListener implements ITextListener, IAnnotationModelListener {
+
+ /*
+ * @see ITextListener#textChanged
+ */
+ public void textChanged(TextEvent e) {
+ if (fTextViewer != null && e.getDocumentEvent() == null && e.getViewerRedrawState()) {
+ // handle only changes of visible document
+ redraw();
+ }
+ }
+
+ /*
+ * @see IAnnotationModelListener#modelChanged(IAnnotationModel)
+ */
+ public void modelChanged(IAnnotationModel model) {
+ update();
+ }
+ }
+
+ /**
+ * Enumerates the annotations of a specified type and characteristics
+ * of the associated annotation model.
+ */
+ class FilterIterator implements Iterator<Annotation> {
+
+ final static int TEMPORARY= 1 << 1;
+ final static int PERSISTENT= 1 << 2;
+ final static int IGNORE_BAGS= 1 << 3;
+
+ private Iterator<?> fIterator;
+ private Object fType;
+ private Annotation fNext;
+ private int fStyle;
+
+ /**
+ * Creates a new filter iterator with the given specification.
+ *
+ * @param annotationType the annotation type
+ * @param style the style
+ */
+ public FilterIterator(Object annotationType, int style) {
+ fType= annotationType;
+ fStyle= style;
+ if (fModel != null) {
+ fIterator= fModel.getAnnotationIterator();
+ skip();
+ }
+ }
+
+ /**
+ * Creates a new filter iterator with the given specification.
+ *
+ * @param annotationType the annotation type
+ * @param style the style
+ * @param iterator the iterator
+ */
+ public FilterIterator(Object annotationType, int style, Iterator<?> iterator) {
+ fType= annotationType;
+ fStyle= style;
+ fIterator= iterator;
+ skip();
+ }
+
+ private void skip() {
+
+ boolean temp= (fStyle & TEMPORARY) != 0;
+ boolean pers= (fStyle & PERSISTENT) != 0;
+ boolean ignr= (fStyle & IGNORE_BAGS) != 0;
+
+ while (fIterator.hasNext()) {
+ Annotation next= (Annotation) fIterator.next();
+
+ if (next.isMarkedDeleted())
+ continue;
+
+ if (ignr && (next instanceof AnnotationBag))
+ continue;
+
+ fNext= next;
+ Object annotationType= next.getType();
+ if (fType == null || isSubtype(annotationType)) {
+ if (temp && pers) return;
+ if (pers && next.isPersistent()) return;
+ if (temp && !next.isPersistent()) return;
+ }
+ }
+ fNext= null;
+ }
+
+ private boolean isSubtype(Object annotationType) {
+ if (fAnnotationAccess instanceof IAnnotationAccessExtension) {
+ IAnnotationAccessExtension extension= (IAnnotationAccessExtension) fAnnotationAccess;
+ return extension.isSubtype(annotationType, fType);
+ }
+ return fType.equals(annotationType);
+ }
+
+ /*
+ * @see Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ return fNext != null;
+ }
+ /*
+ * @see Iterator#next()
+ */
+ public Annotation next() {
+ try {
+ return fNext;
+ } finally {
+ if (fIterator != null)
+ skip();
+ }
+ }
+ /*
+ * @see Iterator#remove()
+ */
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * The painter of the overview ruler's header.
+ */
+ class HeaderPainter implements PaintListener {
+
+ private Color fIndicatorColor;
+ private Color fSeparatorColor;
+
+ /**
+ * Creates a new header painter.
+ */
+ public HeaderPainter() {
+ fSeparatorColor= fSharedTextColors.getColor(ViewForm.borderInsideRGB);
+ }
+
+ /**
+ * Sets the header color.
+ *
+ * @param color the header color
+ */
+ public void setColor(Color color) {
+ fIndicatorColor= color;
+ }
+
+ private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topLeft, Color bottomRight) {
+ gc.setForeground(topLeft == null ? fSeparatorColor : topLeft);
+ gc.drawLine(x, y, x + w -1, y);
+ gc.drawLine(x, y, x, y + h -1);
+
+ gc.setForeground(bottomRight == null ? fSeparatorColor : bottomRight);
+ gc.drawLine(x + w, y, x + w, y + h);
+ gc.drawLine(x, y + h, x + w, y + h);
+ }
+
+ public void paintControl(PaintEvent e) {
+
+ Point s= fHeader.getSize();
+
+ if (fIndicatorColor != null) {
+ e.gc.setBackground(fIndicatorColor);
+ Rectangle r= new Rectangle(INSET, (s.y - (2*ANNOTATION_HEIGHT)) / 2, s.x - (2*INSET), 2*ANNOTATION_HEIGHT);
+ e.gc.fillRectangle(r);
+ Display d= fHeader.getDisplay();
+ if (d != null)
+// drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), d.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
+ drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, null, null);
+ }
+
+ e.gc.setForeground(fSeparatorColor);
+ e.gc.setLineWidth(1);
+ e.gc.drawLine(0, s.y -1, s.x -1, s.y -1);
+ }
+ }
+
+ private static final int INSET= 2;
+ private static final int ANNOTATION_HEIGHT= 1;
+ private static boolean ANNOTATION_HEIGHT_SCALABLE= true;
+
+
+ /** The model of the overview ruler */
+ private IAnnotationModel fModel;
+ /** The view to which this ruler is connected */
+ private ITextViewer fTextViewer;
+ /** The ruler's canvas */
+ private Canvas fCanvas;
+ /** The ruler's header */
+ private Canvas fHeader;
+ /** The buffer for double buffering */
+ private Image fBuffer;
+ /** The internal listener */
+ private InternalListener fInternalListener= new InternalListener();
+ /** The width of this vertical ruler */
+ private int fWidth;
+ /** The hit detection cursor */
+ private Cursor fHitDetectionCursor;
+ /** The last cursor */
+ private Cursor fLastCursor;
+ /** The line of the last mouse button activity */
+ private int fLastMouseButtonActivityLine= -1;
+ /** The actual annotation height */
+ private int fAnnotationHeight= -1;
+ /** The annotation access */
+ private IAnnotationAccess fAnnotationAccess;
+ /** The header painter */
+ private HeaderPainter fHeaderPainter;
+ /**
+ * The list of annotation types to be shown in this ruler.
+ * @since 3.0
+ */
+ private Set<Object> fConfiguredAnnotationTypes= new HashSet<Object>();
+ /**
+ * The list of annotation types to be shown in the header of this ruler.
+ * @since 3.0
+ */
+ private Set<Object> fConfiguredHeaderAnnotationTypes= new HashSet<Object>();
+ /** The mapping between annotation types and colors */
+ private Map<Object, Color> fAnnotationTypes2Colors= new HashMap<Object, Color>();
+
+ /** The mapping between annotation and colors */
+ private Map<Annotation, Color> fAnnotationColors = new HashMap<Annotation, Color>();
+
+ /** The color manager */
+ private ISharedTextColors fSharedTextColors;
+ /**
+ * All available annotation types sorted by layer.
+ *
+ * @since 3.0
+ */
+ private List<Object> fAnnotationsSortedByLayer= new ArrayList<Object>();
+ /**
+ * All available layers sorted by layer.
+ * This list may contain duplicates.
+ * @since 3.0
+ */
+ private List<Integer> fLayersSortedByLayer= new ArrayList<Integer>();
+ /**
+ * Map of allowed annotation types.
+ * An allowed annotation type maps to <code>true</code>, a disallowed
+ * to <code>false</code>.
+ * @since 3.0
+ */
+ private Map fAllowedAnnotationTypes= new HashMap();
+ /**
+ * Map of allowed header annotation types.
+ * An allowed annotation type maps to <code>true</code>, a disallowed
+ * to <code>false</code>.
+ * @since 3.0
+ */
+ private Map fAllowedHeaderAnnotationTypes= new HashMap();
+ /**
+ * The cached annotations.
+ * @since 3.0
+ */
+ private List<Annotation> fCachedAnnotations= new ArrayList<Annotation>();
+
+
+ /**
+ * Constructs a overview ruler of the given width using the given annotation access and the given
+ * color manager.
+ *
+ * @param annotationAccess the annotation access
+ * @param width the width of the vertical ruler
+ * @param sharedColors the color manager
+ */
+ public STOverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors) {
+ fAnnotationAccess= annotationAccess;
+ fWidth= width;
+ fSharedTextColors= sharedColors;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getControl()
+ */
+ public Control getControl() {
+ return fCanvas;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getWidth()
+ */
+ public int getWidth() {
+ return fWidth;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRuler#setModel(org.eclipse.jface.text.source.IAnnotationModel)
+ */
+ public void setModel(IAnnotationModel model) {
+ if (model != fModel || model != null) {
+
+ if (fModel != null)
+ fModel.removeAnnotationModelListener(fInternalListener);
+
+ fModel= model;
+
+ if (fModel != null)
+ fModel.addAnnotationModelListener(fInternalListener);
+
+ update();
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRuler#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.ITextViewer)
+ */
+ public Control createControl(Composite parent, ITextViewer textViewer) {
+
+ fTextViewer= textViewer;
+
+ fHitDetectionCursor= new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
+
+ fHeader= new Canvas(parent, SWT.NONE);
+
+ fCanvas= new Canvas(parent, SWT.NO_BACKGROUND);
+
+ fCanvas.addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent event) {
+ if (fTextViewer != null)
+ doubleBufferPaint(event.gc);
+ }
+ });
+
+ fCanvas.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ handleDispose();
+ fTextViewer= null;
+ }
+ });
+
+ fCanvas.addMouseListener(new MouseAdapter() {
+ public void mouseDown(MouseEvent event) {
+ handleMouseDown(event);
+ }
+ });
+
+ fCanvas.addMouseMoveListener(new MouseMoveListener() {
+ public void mouseMove(MouseEvent event) {
+ handleMouseMove(event);
+ }
+ });
+
+ if (fTextViewer != null)
+ fTextViewer.addTextListener(fInternalListener);
+
+ return fCanvas;
+ }
+
+ /**
+ * Disposes the ruler's resources.
+ */
+ private void handleDispose() {
+
+ if (fTextViewer != null) {
+ fTextViewer.removeTextListener(fInternalListener);
+ fTextViewer= null;
+ }
+
+ if (fModel != null)
+ fModel.removeAnnotationModelListener(fInternalListener);
+
+ if (fBuffer != null) {
+ fBuffer.dispose();
+ fBuffer= null;
+ }
+
+ if (fHitDetectionCursor != null) {
+ fHitDetectionCursor.dispose();
+ fHitDetectionCursor= null;
+ }
+
+ fConfiguredAnnotationTypes.clear();
+ fAllowedAnnotationTypes.clear();
+ fConfiguredHeaderAnnotationTypes.clear();
+ fAllowedHeaderAnnotationTypes.clear();
+ fAnnotationTypes2Colors.clear();
+ fAnnotationsSortedByLayer.clear();
+ fLayersSortedByLayer.clear();
+ }
+
+ /**
+ * Double buffer drawing.
+ *
+ * @param dest the GC to draw into
+ */
+ private void doubleBufferPaint(GC dest) {
+
+ Point size= fCanvas.getSize();
+
+ if (size.x <= 0 || size.y <= 0)
+ return;
+
+ if (fBuffer != null) {
+ Rectangle r= fBuffer.getBounds();
+ if (r.width != size.x || r.height != size.y) {
+ fBuffer.dispose();
+ fBuffer= null;
+ }
+ }
+ if (fBuffer == null)
+ fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
+
+ GC gc= new GC(fBuffer);
+ try {
+ gc.setBackground(fCanvas.getBackground());
+ gc.fillRectangle(0, 0, size.x, size.y);
+
+ if (fTextViewer instanceof ITextViewerExtension5)
+ doPaint1(gc);
+ else
+ doPaint(gc);
+
+ } finally {
+ gc.dispose();
+ }
+
+ dest.drawImage(fBuffer, 0, 0);
+ }
+
+ /**
+ * Draws this overview ruler.
+ *
+ * @param gc the GC to draw into
+ */
+ private void doPaint(GC gc) {
+ Rectangle r= new Rectangle(0, 0, 0, 0);
+ int yy, hh= ANNOTATION_HEIGHT;
+
+ IDocument document= fTextViewer.getDocument();
+ IRegion visible= fTextViewer.getVisibleRegion();
+
+ StyledText textWidget= fTextViewer.getTextWidget();
+ int maxLines= textWidget.getLineCount();
+
+ Point size= fCanvas.getSize();
+ int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines);
+
+ if (size.y > writable)
+ size.y= Math.max(writable - fHeader.getSize().y, 0);
+
+ for (Iterator<Object> iterator= fAnnotationsSortedByLayer.iterator(); iterator.hasNext();) {
+ Object annotationType= iterator.next();
+
+ if (skip(annotationType))
+ continue;
+
+ int[] style= new int[] { FilterIterator.PERSISTENT, FilterIterator.TEMPORARY };
+ for (int t=0; t < style.length; t++) {
+ Color fill = null;
+ Color stroke = null;
+ FilterIterator e = new FilterIterator(annotationType, style[t]);
+ if (annotationType.toString().compareTo(getAnnotationTypeColoredLines()) != 0){
+ fill= getFillColor(annotationType, style[t] == FilterIterator.TEMPORARY);
+ stroke= getStrokeColor(annotationType, style[t] == FilterIterator.TEMPORARY);
+ }
+
+ for (int i= 0; e.hasNext(); i++) {
+
+ Annotation a= e.next();
+ Position p= fModel.getPosition(a);
+
+ if (p == null || !p.overlapsWith(visible.getOffset(), visible.getLength()))
+ continue;
+
+
+ if (a.getType().compareTo(getAnnotationTypeColoredLines()) == 0){
+ fill= getFPFillColor(a, true);
+ stroke= getFPStrokeColor(a, false);
+ }
+
+ int annotationOffset= Math.max(p.getOffset(), visible.getOffset());
+ int annotationEnd= Math.min(p.getOffset() + p.getLength(), visible.getOffset() + visible.getLength());
+ int annotationLength= annotationEnd - annotationOffset;
+
+ try {
+ if (ANNOTATION_HEIGHT_SCALABLE) {
+ int numbersOfLines= document.getNumberOfLines(annotationOffset, annotationLength);
+ // don't count empty trailing lines
+ IRegion lastLine= document.getLineInformationOfOffset(annotationOffset + annotationLength);
+ if (lastLine.getOffset() == annotationOffset + annotationLength) {
+ numbersOfLines -= 2;
+ hh= (numbersOfLines * size.y) / maxLines + ANNOTATION_HEIGHT;
+ if (hh < ANNOTATION_HEIGHT)
+ hh= ANNOTATION_HEIGHT;
+ } else
+ hh= ANNOTATION_HEIGHT;
+ }
+ fAnnotationHeight= hh;
+
+ int startLine= textWidget.getLineAtOffset(annotationOffset - visible.getOffset());
+ yy= Math.min((startLine * size.y) / maxLines, size.y - hh);
+
+ if (fill != null) {
+ gc.setBackground(fill);
+ gc.fillRectangle(INSET, yy, size.x-(2*INSET), hh);
+ }
+
+ if (stroke != null) {
+ gc.setForeground(stroke);
+ r.x= INSET;
+ r.y= yy;
+ r.width= size.x - (2 * INSET);
+ r.height= hh;
+ gc.setLineWidth(1);
+ gc.drawRectangle(r);
+ }
+ } catch (BadLocationException x) {
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Draws this overview ruler. Uses <code>ITextViewerExtension5</code> for
+ * its implementation. Will replace <code>doPaint(GC)</code>.
+ *
+ * @param gc the GC to draw into
+ */
+ private void doPaint1(GC gc) {
+ Rectangle r= new Rectangle(0, 0, 0, 0);
+ int yy, hh= ANNOTATION_HEIGHT;
+
+ ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer;
+ IDocument document= fTextViewer.getDocument();
+ StyledText textWidget= fTextViewer.getTextWidget();
+
+ int maxLines= textWidget.getLineCount();
+ Point size= fCanvas.getSize();
+ int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines);
+ if (size.y > writable)
+ size.y= Math.max(writable - fHeader.getSize().y, 0);
+
+ fCachedAnnotations.clear();
+ if (fModel != null) {
+ Iterator<?> iter= fModel.getAnnotationIterator();
+ while (iter.hasNext()) {
+ Annotation annotation= (Annotation) iter.next();
+
+ if (annotation.isMarkedDeleted())
+ continue;
+
+ if (skip(annotation.getType()))
+ continue;
+
+ fCachedAnnotations.add(annotation);
+ }
+ }
+
+ for (Iterator<Object> iterator= fAnnotationsSortedByLayer.iterator(); iterator.hasNext();) {
+ Object annotationType= iterator.next();
+
+ if (skip(annotationType))
+ continue;
+
+ int[] style= new int[] { FilterIterator.PERSISTENT, FilterIterator.TEMPORARY };
+ for (int t=0; t < style.length; t++) {
+
+ FilterIterator e= new FilterIterator(annotationType, style[t], fCachedAnnotations.iterator());
+ Color fill = null;
+ Color stroke = null;
+ if (annotationType.toString().compareTo(getAnnotationTypeColoredLines()) != 0){
+ fill= getFillColor(annotationType, style[t] == FilterIterator.TEMPORARY);
+ stroke= getStrokeColor(annotationType, style[t] == FilterIterator.TEMPORARY);
+ }
+
+ for (int i= 0; e.hasNext(); i++) {
+
+ Annotation a= e.next();
+
+
+ Position p= fModel.getPosition(a);
+
+ if (p == null)
+ continue;
+
+ IRegion widgetRegion= extension.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength()));
+ if (widgetRegion == null)
+ continue;
+
+ if (a.getType().compareTo(getAnnotationTypeColoredLines()) == 0){
+ fill= getFPFillColor(a, true);
+ stroke= getFPStrokeColor(a, false);
+ }
+
+ try {
+ if (ANNOTATION_HEIGHT_SCALABLE) {
+ int numbersOfLines= document.getNumberOfLines(p.getOffset(), p.getLength());
+ // don't count empty trailing lines
+ IRegion lastLine= document.getLineInformationOfOffset(p.getOffset() + p.getLength());
+ if (lastLine.getOffset() == p.getOffset() + p.getLength()) {
+ numbersOfLines -= 2;
+ hh= (numbersOfLines * size.y) / maxLines + ANNOTATION_HEIGHT;
+ if (hh < ANNOTATION_HEIGHT)
+ hh= ANNOTATION_HEIGHT;
+ } else
+ hh= ANNOTATION_HEIGHT;
+ }
+ fAnnotationHeight= hh;
+
+ int startLine= textWidget.getLineAtOffset(widgetRegion.getOffset());
+ yy= Math.min((startLine * size.y) / maxLines, size.y - hh);
+
+ if (fill != null) {
+ gc.setBackground(fill);
+ gc.fillRectangle(INSET, yy, size.x-(2*INSET), hh);
+ }
+
+ if (stroke != null) {
+ gc.setForeground(stroke);
+ r.x= INSET;
+ r.y= yy;
+ r.width= size.x - (2 * INSET);
+ r.height= hh;
+ gc.setLineWidth(1);
+ gc.drawRectangle(r);
+ }
+ } catch (BadLocationException x) {
+ }
+ }
+ }
+ }
+ fCachedAnnotations.clear();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRuler#update()
+ */
+ public void update() {
+ if (fCanvas != null && !fCanvas.isDisposed()) {
+ Display d= fCanvas.getDisplay();
+ if (d != null) {
+ d.asyncExec(new Runnable() {
+ public void run() {
+ redraw();
+ updateHeader();
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Redraws the overview ruler.
+ */
+ private void redraw() {
+
+ if (fTextViewer == null || fModel == null)
+ return;
+
+ if (fCanvas != null && !fCanvas.isDisposed()) {
+ GC gc= new GC(fCanvas);
+ doubleBufferPaint(gc);
+ gc.dispose();
+ }
+ }
+
+ /**
+ * Translates a given y-coordinate of this ruler into the corresponding
+ * document lines. The number of lines depends on the concrete scaling
+ * given as the ration between the height of this ruler and the length
+ * of the document.
+ *
+ * @param y_coordinate the y-coordinate
+ * @return the corresponding document lines
+ */
+ private int[] toLineNumbers(int y_coordinate) {
+
+ StyledText textWidget= fTextViewer.getTextWidget();
+ int maxLines= textWidget.getContent().getLineCount();
+
+ int rulerLength= fCanvas.getSize().y;
+ int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines);
+
+ if (rulerLength > writable)
+ rulerLength= Math.max(writable - fHeader.getSize().y, 0);
+
+ if (y_coordinate >= writable || y_coordinate >= rulerLength)
+ return new int[] {-1, -1};
+
+ int[] lines= new int[2];
+
+ int pixel0= Math.max(y_coordinate - 1, 0);
+ int pixel1= Math.min(rulerLength, y_coordinate + 1);
+ rulerLength= Math.max(rulerLength, 1);
+
+ lines[0]= (pixel0 * maxLines) / rulerLength;
+ lines[1]= (pixel1 * maxLines) / rulerLength;
+
+ if (fTextViewer instanceof ITextViewerExtension5) {
+ ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer;
+ lines[0]= extension.widgetLine2ModelLine(lines[0]);
+ lines[1]= extension.widgetLine2ModelLine(lines[1]);
+ } else {
+ try {
+ IRegion visible= fTextViewer.getVisibleRegion();
+ int lineNumber= fTextViewer.getDocument().getLineOfOffset(visible.getOffset());
+ lines[0] += lineNumber;
+ lines[1] += lineNumber;
+ } catch (BadLocationException x) {
+ }
+ }
+
+ return lines;
+ }
+
+ /**
+ * Returns the position of the first annotation found in the given line range.
+ *
+ * @param lineNumbers the line range
+ * @param ignoreSelectedAnnotation whether to ignore the current selection
+ * @return the position of the first found annotation
+ */
+ private Position getAnnotationPosition(int[] lineNumbers, boolean ignoreSelectedAnnotation) {
+ if (lineNumbers[0] == -1)
+ return null;
+
+ Position found= null;
+
+ try {
+ IDocument d= fTextViewer.getDocument();
+ IRegion line= d.getLineInformation(lineNumbers[0]);
+
+ Point currentSelection= fTextViewer.getSelectedRange();
+
+ int start= line.getOffset();
+
+ line= d.getLineInformation(lineNumbers[lineNumbers.length - 1]);
+ int end= line.getOffset() + line.getLength();
+
+ for (int i= fAnnotationsSortedByLayer.size() -1; i >= 0; i--) {
+
+ Object annotationType= fAnnotationsSortedByLayer.get(i);
+
+ FilterIterator e= new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY);
+ while (e.hasNext() && found == null) {
+ Annotation a= e.next();
+ if (a.isMarkedDeleted())
+ continue;
+
+ if (skip(a.getType()))
+ continue;
+
+ Position p= fModel.getPosition(a);
+ if (p == null)
+ continue;
+
+ int posOffset= p.getOffset();
+ int posEnd= posOffset + p.getLength();
+ IRegion region= d.getLineInformationOfOffset(posEnd);
+ // trailing empty lines don't count
+ if (posEnd > posOffset && region.getOffset() == posEnd) {
+ posEnd--;
+ region= d.getLineInformationOfOffset(posEnd);
+ }
+
+ if (posOffset <= end && posEnd >= start) {
+ if (ignoreSelectedAnnotation || currentSelection.x != posOffset || currentSelection.y != p.getLength())
+ found= p;
+ }
+ }
+ }
+ } catch (BadLocationException x) {
+ }
+
+ return found;
+ }
+
+ /**
+ * Returns the line which corresponds best to one of
+ * the underlying annotations at the given y-coordinate.
+ *
+ * @param lineNumbers the line numbers
+ * @return the best matching line or <code>-1</code> if no such line can be found
+ */
+ private int findBestMatchingLineNumber(int[] lineNumbers) {
+ if (lineNumbers == null || lineNumbers.length < 1)
+ return -1;
+
+ try {
+ Position pos= getAnnotationPosition(lineNumbers, true);
+ if (pos == null)
+ return -1;
+ return fTextViewer.getDocument().getLineOfOffset(pos.getOffset());
+ } catch (BadLocationException ex) {
+ return -1;
+ }
+ }
+
+ /**
+ * Handles mouse clicks.
+ *
+ * @param event the mouse button down event
+ */
+ private void handleMouseDown(MouseEvent event) {
+ if (fTextViewer != null) {
+ int[] lines= toLineNumbers(event.y);
+ Position p= getAnnotationPosition(lines, false);
+ if (p != null) {
+ fTextViewer.revealRange(p.getOffset(), p.getLength());
+ fTextViewer.setSelectedRange(p.getOffset(), p.getLength());
+ }
+ fTextViewer.getTextWidget().setFocus();
+ }
+ fLastMouseButtonActivityLine= toDocumentLineNumber(event.y);
+ }
+
+ /**
+ * Handles mouse moves.
+ *
+ * @param event the mouse move event
+ */
+ private void handleMouseMove(MouseEvent event) {
+ if (fTextViewer != null) {
+ int[] lines= toLineNumbers(event.y);
+ Position p= getAnnotationPosition(lines, true);
+ Cursor cursor= (p != null ? fHitDetectionCursor : null);
+ if (cursor != fLastCursor) {
+ fCanvas.setCursor(cursor);
+ fLastCursor= cursor;
+ }
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#addAnnotationType(java.lang.Object)
+ */
+ public void addAnnotationType(Object annotationType) {
+ fConfiguredAnnotationTypes.add(annotationType);
+ fAllowedAnnotationTypes.clear();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#removeAnnotationType(java.lang.Object)
+ */
+ public void removeAnnotationType(Object annotationType) {
+ fConfiguredAnnotationTypes.remove(annotationType);
+ fAllowedAnnotationTypes.clear();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#setAnnotationTypeLayer(java.lang.Object, int)
+ */
+ public void setAnnotationTypeLayer(Object annotationType, int layer) {
+ int j= fAnnotationsSortedByLayer.indexOf(annotationType);
+ if (j != -1) {
+ fAnnotationsSortedByLayer.remove(j);
+ fLayersSortedByLayer.remove(j);
+ }
+
+ if (layer >= 0) {
+ int i= 0;
+ int size= fLayersSortedByLayer.size();
+ while (i < size && layer >= fLayersSortedByLayer.get(i))
+ i++;
+ fLayersSortedByLayer.add(i, layer);
+ fAnnotationsSortedByLayer.add(i, annotationType);
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#setAnnotationTypeColor(java.lang.Object, org.eclipse.swt.graphics.Color)
+ */
+
+ public void setAnnotationColor(Annotation annotation,Color color){
+ if (color != null)
+ fAnnotationColors.put(annotation, color);
+ else
+ fAnnotationColors.remove(annotation);
+ }
+
+
+ public void setAnnotationTypeColor(Object annotationType, Color color) {
+ if (color != null)
+ fAnnotationTypes2Colors.put(annotationType, color);
+ else
+ fAnnotationTypes2Colors.remove(annotationType);
+ }
+
+ /**
+ * Returns whether the given annotation type should be skipped by the drawing routine.
+ *
+ * @param annotationType the annotation type
+ * @return <code>true</code> if annotation of the given type should be skipped
+ */
+ private boolean skip(Object annotationType) {
+ return !contains(annotationType, fAllowedAnnotationTypes, fConfiguredAnnotationTypes);
+ }
+
+ /**
+ * Returns whether the given annotation type should be skipped by the drawing routine of the header.
+ *
+ * @param annotationType the annotation type
+ * @return <code>true</code> if annotation of the given type should be skipped
+ * @since 3.0
+ */
+ private boolean skipInHeader(Object annotationType) {
+ return !contains(annotationType, fAllowedHeaderAnnotationTypes, fConfiguredHeaderAnnotationTypes);
+ }
+
+ /**
+ * Returns whether the given annotation type is mapped to <code>true</code>
+ * in the given <code>allowed</code> map or covered by the <code>configured</code>
+ * set.
+ *
+ * @param annotationType the annotation type
+ * @param allowed the map with allowed annotation types mapped to booleans
+ * @param configured the set with configured annotation types
+ * @return <code>true</code> if annotation is contained, <code>false</code>
+ * otherwise
+ * @since 3.0
+ */
+ private boolean contains(Object annotationType, Map allowed, Set configured) {
+ Boolean cached= (Boolean) allowed.get(annotationType);
+ if (cached != null)
+ return cached.booleanValue();
+
+ boolean covered= isCovered(annotationType, configured);
+ allowed.put(annotationType, covered ? Boolean.TRUE : Boolean.FALSE);
+ return covered;
+ }
+
+ /**
+ * Computes whether the annotations of the given type are covered by the given <code>configured</code>
+ * set. This is the case if either the type of the annotation or any of its
+ * super types is contained in the <code>configured</code> set.
+ *
+ * @param annotationType the annotation type
+ * @param configured the set with configured annotation types
+ * @return <code>true</code> if annotation is covered, <code>false</code>
+ * otherwise
+ * @since 3.0
+ */
+ private boolean isCovered(Object annotationType, Set configured) {
+ if (fAnnotationAccess instanceof IAnnotationAccessExtension) {
+ IAnnotationAccessExtension extension= (IAnnotationAccessExtension) fAnnotationAccess;
+ Iterator<?> e= configured.iterator();
+ while (e.hasNext()) {
+ if (extension.isSubtype(annotationType,e.next()))
+ return true;
+ }
+ return false;
+ }
+ return configured.contains(annotationType);
+ }
+
+ /**
+ * Returns a specification of a color that lies between the given
+ * foreground and background color using the given scale factor.
+ *
+ * @param fg the foreground color
+ * @param bg the background color
+ * @param scale the scale factor
+ * @return the interpolated color
+ */
+ private static RGB interpolate(RGB fg, RGB bg, double scale) {
+ return new RGB(
+ (int) ((1.0-scale) * fg.red + scale * bg.red),
+ (int) ((1.0-scale) * fg.green + scale * bg.green),
+ (int) ((1.0-scale) * fg.blue + scale * bg.blue)
+ );
+ }
+
+ /**
+ * Returns the grey value in which the given color would be drawn in grey-scale.
+ *
+ * @param rgb the color
+ * @return the grey-scale value
+ */
+ private static double greyLevel(RGB rgb) {
+ if (rgb.red == rgb.green && rgb.green == rgb.blue)
+ return rgb.red;
+ return (0.299 * rgb.red + 0.587 * rgb.green + 0.114 * rgb.blue + 0.5);
+ }
+
+ /**
+ * Returns whether the given color is dark or light depending on the colors grey-scale level.
+ *
+ * @param rgb the color
+ * @return <code>true</code> if the color is dark, <code>false</code> if it is light
+ */
+ private static boolean isDark(RGB rgb) {
+ return greyLevel(rgb) > 128;
+ }
+
+ /**
+ * Returns a color based on the color configured for the given annotation type and the given scale factor.
+ *
+ * @param annotationType the annotation type
+ * @param scale the scale factor
+ * @return the computed color
+ */
+ private Color getColor(Object annotationType, double scale) {
+ Color base= findColor(annotationType);
+ return getInterpolatedColor(base,scale);
+ }
+
+
+ private Color getFPColor(Object annotation, double scale){
+ Color base= (Color) fAnnotationColors.get(annotation);
+ return getInterpolatedColor(base,scale);
+ }
+
+ private Color getInterpolatedColor(Color base,double scale){
+ if (base == null)
+ return null;
+
+ RGB baseRGB= base.getRGB();
+ RGB background= fCanvas.getBackground().getRGB();
+
+ boolean darkBase= isDark(baseRGB);
+ boolean darkBackground= isDark(background);
+ if (darkBase && darkBackground)
+ background= new RGB(255, 255, 255);
+ else if (!darkBase && !darkBackground)
+ background= new RGB(0, 0, 0);
+
+ return fSharedTextColors.getColor(interpolate(baseRGB, background, scale));
+
+ }
+
+
+ /**
+ * Returns the color for the given annotation type
+ *
+ * @param annotationType the annotation type
+ * @return the color
+ * @since 3.0
+ */
+ private Color findColor(Object annotationType) {
+ Color color= (Color) fAnnotationTypes2Colors.get(annotationType);
+ if (color != null)
+ return color;
+
+ if (fAnnotationAccess instanceof IAnnotationAccessExtension) {
+ IAnnotationAccessExtension extension= (IAnnotationAccessExtension) fAnnotationAccess;
+ Object[] superTypes= extension.getSupertypes(annotationType);
+ if (superTypes != null) {
+ for (int i= 0; i < superTypes.length; i++) {
+ color= (Color) fAnnotationTypes2Colors.get(superTypes[i]);
+ if (color != null)
+ return color;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the stroke color for the given annotation type and characteristics.
+ *
+ * @param annotationType the annotation type
+ * @param temporary <code>true</code> if for temporary annotations
+ * @return the stroke color
+ */
+ private Color getStrokeColor(Object annotationType, boolean temporary) {
+ return getColor(annotationType, temporary ? 0.5 : 0.2);
+ }
+
+
+ private Color getFPStrokeColor(Object annotation, boolean temporary) {
+ return getFPColor(annotation, temporary ? 0.5 : 0.2);
+ }
+
+ /**
+ * Returns the fill color for the given annotation type and characteristics.
+ *
+ * @param annotationType the annotation type
+ * @param temporary <code>true</code> if for temporary annotations
+ * @return the fill color
+ */
+ private Color getFillColor(Object annotationType, boolean temporary) {
+ return getColor(annotationType, temporary ? 0.9 : 0.6);
+ }
+
+ private Color getFPFillColor(Object annotation, boolean temporary){
+ return getFPColor(annotation, temporary ? 0.9 : 0.6);
+ }
+
+ /*
+ * @see IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
+ */
+ public int getLineOfLastMouseButtonActivity() {
+ return fLastMouseButtonActivityLine;
+ }
+
+ /*
+ * @see IVerticalRulerInfo#toDocumentLineNumber(int)
+ */
+ public int toDocumentLineNumber(int y_coordinate) {
+
+ if (fTextViewer == null || y_coordinate == -1)
+ return -1;
+
+ int[] lineNumbers= toLineNumbers(y_coordinate);
+ int bestLine= findBestMatchingLineNumber(lineNumbers);
+ if (bestLine == -1 && lineNumbers.length > 0)
+ return lineNumbers[0];
+ return bestLine;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IVerticalRuler#getModel()
+ */
+ public IAnnotationModel getModel() {
+ return fModel;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#getAnnotationHeight()
+ */
+ public int getAnnotationHeight() {
+ return fAnnotationHeight;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#hasAnnotation(int)
+ */
+ public boolean hasAnnotation(int y) {
+ return findBestMatchingLineNumber(toLineNumbers(y)) != -1;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#getHeaderControl()
+ */
+ public Control getHeaderControl() {
+ return fHeader;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#addHeaderAnnotationType(java.lang.Object)
+ */
+ public void addHeaderAnnotationType(Object annotationType) {
+ fConfiguredHeaderAnnotationTypes.add(annotationType);
+ fAllowedHeaderAnnotationTypes.clear();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IOverviewRuler#removeHeaderAnnotationType(java.lang.Object)
+ */
+ public void removeHeaderAnnotationType(Object annotationType) {
+ fConfiguredHeaderAnnotationTypes.remove(annotationType);
+ fAllowedHeaderAnnotationTypes.clear();
+ }
+
+ /**
+ * Updates the header of this ruler.
+ */
+ private void updateHeader() {
+
+ if (fHeader == null || fHeader.isDisposed())
+ return;
+
+ Object colorType= null;
+ outer: for (int i= fAnnotationsSortedByLayer.size() -1; i >= 0; i--) {
+
+ Object annotationType= fAnnotationsSortedByLayer.get(i);
+
+ if (skipInHeader(annotationType) || skip(annotationType))
+ continue;
+
+ for (FilterIterator e= new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY | FilterIterator.IGNORE_BAGS); e.hasNext();) {
+ if (e.next() != null) {
+ colorType= annotationType;
+ break outer;
+ }
+ }
+ }
+
+ Color color= null;
+ if (colorType != null)
+ color= findColor(colorType);
+
+ if (color == null) {
+ if (fHeaderPainter != null)
+ fHeaderPainter.setColor(null);
+ } else {
+ if (fHeaderPainter == null) {
+ fHeaderPainter= new HeaderPainter();
+ fHeader.addPaintListener(fHeaderPainter);
+ }
+ fHeaderPainter.setColor(color);
+ }
+
+ fHeader.redraw();
+ updateHeaderToolTipText();
+ }
+
+ /**
+ * Updates the tool tip text of the header of this ruler.
+ *
+ * @since 3.0
+ */
+ private void updateHeaderToolTipText() {
+
+ if (fHeader == null || fHeader.isDisposed())
+ return;
+
+ fHeader.setToolTipText(null);
+
+ if (!(fAnnotationAccess instanceof IAnnotationAccessExtension))
+ return;
+
+ String overview= ""; //$NON-NLS-1$
+
+ for (int i= fAnnotationsSortedByLayer.size() -1; i >= 0; i--) {
+
+ Object annotationType= fAnnotationsSortedByLayer.get(i);
+
+ if (skipInHeader(annotationType) || skip(annotationType))
+ continue;
+
+ int count= 0;
+ String annotationTypeLabel= null;
+
+ for (FilterIterator e= new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY | FilterIterator.IGNORE_BAGS); e.hasNext();) {
+ Annotation annotation= e.next();
+ if (annotation != null) {
+ if (annotationTypeLabel == null)
+ annotationTypeLabel= ((IAnnotationAccessExtension)fAnnotationAccess).getTypeLabel(annotation);
+ count++;
+ }
+ }
+
+ if (annotationTypeLabel != null) {
+ if (overview.length() > 0)
+ overview += "\n"; //$NON-NLS-1$
+ overview += STJFaceTextMessages.getFormattedString("OverviewRulerHeader.toolTipTextEntry", new Object[] {annotationTypeLabel, new Integer(count)}); //$NON-NLS-1$
+ }
+ }
+ if (overview.length() > 0)
+ fHeader.setToolTipText(overview);
+ }
+
+ private String getAnnotationTypeColoredLines(){
+ return (STAnnotatedSourceEditorActivator.getUniqueIdentifier() + STAnnotatedSourceEditorActivator.getAnnotationType());
+ }
+}
+
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STRulerColumn.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STRulerColumn.java
new file mode 100644
index 0000000000..8af7be3557
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STRulerColumn.java
@@ -0,0 +1,876 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import java.util.Arrays;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextListener;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITextViewerExtension;
+import org.eclipse.jface.text.IViewportListener;
+import org.eclipse.jface.text.JFaceTextUtil;
+import org.eclipse.jface.text.TextEvent;
+import org.eclipse.jface.text.source.CompositeRuler;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.ILineRange;
+import org.eclipse.jface.text.source.IVerticalRulerColumn;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.hyperlink.ISTAnnotationHyperlink;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.MouseTrackListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.TextLayout;
+import org.eclipse.swt.graphics.TextStyle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+
+public class STRulerColumn implements IVerticalRulerColumn{
+ /**
+ * Internal listener class.
+ */
+ class InternalListener implements IViewportListener, ITextListener {
+
+ /**
+ * @since 3.1
+ */
+ private boolean fCachedRedrawState= true;
+
+ /*
+ * @see IViewportListener#viewportChanged(int)
+ */
+ public void viewportChanged(int verticalPosition) {
+ if (fCachedRedrawState && verticalPosition != fScrollPos)
+ redraw();
+ }
+
+ /*
+ * @see ITextListener#textChanged(TextEvent)
+ */
+ public void textChanged(TextEvent event) {
+
+ fCachedRedrawState= event.getViewerRedrawState();
+ if (!fCachedRedrawState)
+ return;
+
+ if (updateNumberOfDigits()) {
+ computeIndentations();
+ layout(event.getViewerRedrawState());
+ return;
+ }
+
+ boolean viewerCompletelyShown= isViewerCompletelyShown();
+ if (viewerCompletelyShown || fSensitiveToTextChanges || event.getDocumentEvent() == null)
+ postRedraw();
+ fSensitiveToTextChanges= viewerCompletelyShown;
+ }
+ }
+
+ /**
+ * Handles all the mouse interaction in this line number ruler column.
+ */
+ class MouseHandler implements MouseListener, MouseMoveListener {
+
+ /** The cached view port size */
+ private int fCachedViewportSize;
+ /** The area of the line at which line selection started */
+ private IRegion fStartLine;
+ /** The number of the line at which line selection started */
+ private int fStartLineNumber;
+ /** The auto scroll direction */
+ private int fAutoScrollDirection;
+ /* @since 3.2 */
+ private boolean fIsListeningForMove= false;
+
+ /*
+ * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
+ */
+ public void mouseUp(MouseEvent event) {
+ // see bug 45700
+ if (event.button == 1) {
+ stopSelecting();
+ stopAutoScroll();
+ }
+ }
+
+ /*
+ * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
+ */
+ public void mouseDown(MouseEvent event) {
+ fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
+
+ int newLine= fParentRuler.toDocumentLineNumber(event.y) + 1;
+ if (annotationColumn instanceof ISTAnnotationHyperlink){
+ ISTAnnotationHyperlink ahp = (ISTAnnotationHyperlink)annotationColumn;
+ if (ahp.isAnnotationHyperlink(newLine) && annotationColumn.getAnnotation(newLine).trim() != ""){
+ ahp.handleHyperlink(newLine);
+ }
+
+ }
+ else{
+ // see bug 45700
+ if (event.button == 1) {
+ startSelecting();
+ }
+ }
+ }
+
+ /*
+ * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
+ */
+ public void mouseDoubleClick(MouseEvent event) {
+ fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
+ stopSelecting();
+ stopAutoScroll();
+ }
+
+ /*
+ * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
+ */
+ public void mouseMove(MouseEvent event) {
+ int newLine= fParentRuler.toDocumentLineNumber(event.y) + 1;
+ if (annotationColumn instanceof ISTAnnotationHyperlink){
+ if (((ISTAnnotationHyperlink)annotationColumn).isAnnotationHyperlink(newLine) && annotationColumn.getAnnotation(newLine).trim() != ""){
+ Cursor cursor = new Cursor(event.display,SWT.CURSOR_HAND);
+ fCanvas.setCursor(cursor);
+ }
+ else{
+ Cursor cursor = new Cursor(event.display,SWT.CURSOR_ARROW);
+ fCanvas.setCursor(cursor);
+ }
+ }
+ if (fIsListeningForMove && !autoScroll(event)) {
+ expandSelection(newLine);
+ }
+ fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
+ }
+
+ /**
+ * Called when line drag selection started. Adds mouse move and track
+ * listeners to this column's control.
+ */
+ private void startSelecting() {
+ try {
+
+ // select line
+ IDocument document= fCachedTextViewer.getDocument();
+ fStartLineNumber= fParentRuler.getLineOfLastMouseButtonActivity();
+ fStartLine= document.getLineInformation(fStartLineNumber);
+ fCachedTextViewer.setSelectedRange(fStartLine.getOffset(), fStartLine.getLength());
+
+ // prepare for drag selection
+ fIsListeningForMove= true;
+
+ } catch (BadLocationException x) {
+ }
+ }
+
+ /**
+ * Called when line drag selection stopped. Removes all previously
+ * installed listeners from this column's control.
+ */
+ private void stopSelecting() {
+ // drag selection stopped
+ fIsListeningForMove= false;
+ }
+
+ /**
+ * Expands the line selection from the remembered start line to the
+ * given line.
+ *
+ * @param lineNumber the line to which to expand the selection
+ */
+ private void expandSelection(int lineNumber) {
+ try {
+
+ IDocument document= fCachedTextViewer.getDocument();
+ IRegion lineInfo= document.getLineInformation(lineNumber);
+
+ int start= Math.min(fStartLine.getOffset(), lineInfo.getOffset());
+ int end= Math.max(fStartLine.getOffset() + fStartLine.getLength(), lineInfo.getOffset() + lineInfo.getLength());
+
+ if (lineNumber < fStartLineNumber)
+ fCachedTextViewer.setSelectedRange(end, start - end);
+ else
+ fCachedTextViewer.setSelectedRange(start, end - start);
+
+ } catch (BadLocationException x) {
+ }
+ }
+
+ /**
+ * Called when auto scrolling stopped. Clears the auto scroll direction.
+ */
+ private void stopAutoScroll() {
+ fAutoScrollDirection= SWT.NULL;
+ }
+
+ /**
+ * Called on drag selection.
+ *
+ * @param event the mouse event caught by the mouse move listener
+ * @return <code>true</code> if scrolling happened, <code>false</code> otherwise
+ */
+ private boolean autoScroll(MouseEvent event) {
+ Rectangle area= fCanvas.getClientArea();
+
+ if (event.y > area.height) {
+ autoScroll(SWT.DOWN);
+ return true;
+ }
+
+ if (event.y < 0) {
+ autoScroll(SWT.UP);
+ return true;
+ }
+
+ stopAutoScroll();
+ return false;
+ }
+
+ /**
+ * Scrolls the viewer into the given direction.
+ *
+ * @param direction the scroll direction
+ */
+ private void autoScroll(int direction) {
+
+ if (fAutoScrollDirection == direction)
+ return;
+
+ final int TIMER_INTERVAL= 5;
+ final Display display = fCanvas.getDisplay();
+ Runnable timer= null;
+ switch (direction) {
+ case SWT.UP:
+ timer= new Runnable() {
+ public void run() {
+ if (fAutoScrollDirection == SWT.UP) {
+ int top= getInclusiveTopIndex();
+ if (top > 0) {
+ fCachedTextViewer.setTopIndex(top -1);
+ expandSelection(top -1);
+ display.timerExec(TIMER_INTERVAL, this);
+ }
+ }
+ }
+ };
+ break;
+ case SWT.DOWN:
+ timer = new Runnable() {
+ public void run() {
+ if (fAutoScrollDirection == SWT.DOWN) {
+ int top= getInclusiveTopIndex();
+ fCachedTextViewer.setTopIndex(top +1);
+ expandSelection(top +1 + fCachedViewportSize);
+ display.timerExec(TIMER_INTERVAL, this);
+ }
+ }
+ };
+ break;
+ }
+
+ if (timer != null) {
+ fAutoScrollDirection= direction;
+ display.timerExec(TIMER_INTERVAL, timer);
+ }
+ }
+
+ /**
+ * Returns the viewer's first visible line, even if only partially visible.
+ *
+ * @return the viewer's first visible line
+ */
+ private int getInclusiveTopIndex() {
+ if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed()) {
+ return JFaceTextUtil.getPartialTopIndex(fCachedTextViewer);
+ }
+ return -1;
+ }
+ }
+
+ /** This column's parent ruler */
+ private CompositeRuler fParentRuler;
+ /** Cached text viewer */
+ private ITextViewer fCachedTextViewer;
+ /** Cached text widget */
+ private StyledText fCachedTextWidget;
+ /** The columns canvas */
+ private Canvas fCanvas;
+ /** Cache for the actual scroll position in pixels */
+ private int fScrollPos;
+ /** The drawable for double buffering */
+ private Image fBuffer;
+ /** The internal listener */
+ private InternalListener fInternalListener= new InternalListener();
+ /** The font of this column */
+ private Font fFont;
+ /** The indentation cache */
+ private int[] fIndentation;
+ /** Indicates whether this column reacts on text change events */
+ private boolean fSensitiveToTextChanges= false;
+ /** The foreground color */
+ private Color fForeground;
+ /** The background color */
+ private Color fBackground;
+ /** Cached number of displayed digits */
+ private int fCachedNumberOfDigits= -1;
+ /** Flag indicating whether a relayout is required */
+ private boolean fRelayoutRequired= false;
+ /**
+ * Redraw runnable lock
+ * @since 3.0
+ */
+ private Object fRunnableLock= new Object();
+ /**
+ * Redraw runnable state
+ * @since 3.0
+ */
+ private boolean fIsRunnablePosted= false;
+ /**
+ * Redraw runnable
+ * @since 3.0
+ */
+ private Runnable fRunnable= new Runnable() {
+ public void run() {
+ synchronized (fRunnableLock) {
+ fIsRunnablePosted= false;
+ }
+ redraw();
+ }
+ };
+ /* @since 3.2 */
+ private MouseHandler fMouseHandler;
+
+ private ISTAnnotationColumn annotationColumn;
+
+ /**
+ * Constructs a new vertical ruler column.
+ */
+ public STRulerColumn(ISTAnnotationColumn ac) {
+ annotationColumn = ac;
+ }
+
+ public ISTAnnotationColumn getSTAnnotationColumn(){
+ return annotationColumn;
+ }
+
+ public STRulerColumn() {
+ }
+
+ /**
+ * Sets the foreground color of this column.
+ *
+ * @param foreground the foreground color
+ */
+ public void setForeground(Color foreground) {
+ fForeground= foreground;
+ }
+
+ /**
+ * Returns the foreground color being used to print the line numbers.
+ *
+ * @return the configured foreground color
+ * @since 3.0
+ */
+ protected Color getForeground() {
+ return fForeground;
+ }
+
+ /**
+ * Sets the background color of this column.
+ *
+ * @param background the background color
+ */
+ public void setBackground(Color background) {
+ fBackground= background;
+ if (fCanvas != null && !fCanvas.isDisposed())
+ fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
+ }
+
+ /**
+ * Returns the System background color for list widgets.
+ *
+ * @param display the display
+ * @return the System background color for list widgets
+ */
+ protected Color getBackground(Display display) {
+ if (fBackground == null)
+ return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ return fBackground;
+ }
+
+ /*
+ * @see IVerticalRulerColumn#getControl()
+ */
+ public Control getControl() {
+ return fCanvas;
+ }
+
+ /*
+ * @see IVerticalRuleColumnr#getWidth
+ */
+ public int getWidth() {
+ return fIndentation[0];
+ }
+
+ /**
+ * Computes the number of digits to be displayed. Returns
+ * <code>true</code> if the number of digits changed compared
+ * to the previous call of this method. If the method is called
+ * for the first time, the return value is also <code>true</code>.
+ *
+ * @return whether the number of digits has been changed
+ * @since 3.0
+ */
+ protected boolean updateNumberOfDigits() {
+ if (fCachedTextViewer == null)
+ return false;
+
+ int digits= computeNumberOfDigits();
+
+ if (fCachedNumberOfDigits != digits) {
+ fCachedNumberOfDigits= digits;
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Does the real computation of the number of digits. Subclasses may override this method if
+ * they need extra space on the line number ruler.
+ *
+ * @return the number of digits to be displayed on the line number ruler.
+ */
+ protected int computeNumberOfDigits() {
+ IDocument document= fCachedTextViewer.getDocument();
+ int lines= document == null ? 0 : document.getNumberOfLines();
+ int digits = 0;
+ if (annotationColumn.getTitle() != null && annotationColumn.getTitle().length() >0){
+ digits= annotationColumn.getTitle().length() + 3;
+ }
+ else
+ digits = 3;
+
+ while (lines > Math.pow(10, digits) -1) {
+ ++digits;
+ }
+ return (digits);
+ }
+
+ /**
+ * Layouts the enclosing viewer to adapt the layout to changes of the
+ * size of the individual components.
+ *
+ * @param redraw <code>true</code> if this column can be redrawn
+ */
+ protected void layout(boolean redraw) {
+ if (!redraw) {
+ fRelayoutRequired= true;
+ return;
+ }
+
+ fRelayoutRequired= false;
+ if (fCachedTextViewer instanceof ITextViewerExtension) {
+ ITextViewerExtension extension= (ITextViewerExtension) fCachedTextViewer;
+ Control control= extension.getControl();
+ if (control instanceof Composite && !control.isDisposed()) {
+ Composite composite= (Composite) control;
+ composite.layout(true);
+ }
+ }
+ }
+
+ /**
+ * Computes the indentations for the given font and stores them in
+ * <code>fIndentation</code>.
+ */
+ protected void computeIndentations() {
+ if (fCanvas == null || fCanvas.isDisposed())
+ return;
+
+ GC gc= new GC(fCanvas);
+ try {
+
+ gc.setFont(fCanvas.getFont());
+
+ fIndentation= new int[fCachedNumberOfDigits + 3];
+
+ char[] nines= new char[fCachedNumberOfDigits + 2];
+ Arrays.fill(nines, '9');
+ String nineString= new String(nines);
+ Point p= gc.stringExtent(nineString);
+ fIndentation[0]= p.x;
+
+ for (int i= 1; i <= fCachedNumberOfDigits; i++) {
+ p= gc.stringExtent(nineString.substring(0, i));
+ fIndentation[i]= fIndentation[0] - p.x;
+ }
+
+ } finally {
+ gc.dispose();
+ }
+ }
+
+ /*
+ * @see IVerticalRulerColumn#createControl(CompositeRuler, Composite)
+ */
+ public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
+
+ fParentRuler= parentRuler;
+ fCachedTextViewer= parentRuler.getTextViewer();
+ fCachedTextWidget= fCachedTextViewer.getTextWidget();
+
+ fCanvas= new Canvas(parentControl, SWT.BORDER);
+ fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
+ fCanvas.setForeground(fForeground);
+
+ fCanvas.addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent event) {
+ if (fCachedTextViewer != null)
+ doubleBufferPaint(event.gc);
+ }
+ });
+
+ fCanvas.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ handleDispose();
+ fCachedTextViewer= null;
+ fCachedTextWidget= null;
+ }
+ });
+
+ fMouseHandler= new MouseHandler();
+ fCanvas.addMouseListener(fMouseHandler);
+ fCanvas.addMouseMoveListener(fMouseHandler);
+
+ if (fCachedTextViewer != null) {
+
+ fCachedTextViewer.addViewportListener(fInternalListener);
+ fCachedTextViewer.addTextListener(fInternalListener);
+
+ if (fFont == null) {
+ if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed())
+ fFont= fCachedTextWidget.getFont();
+ }
+ }
+
+ if (fFont != null)
+ fCanvas.setFont(fFont);
+
+ updateNumberOfDigits();
+ computeIndentations();
+ return fCanvas;
+ }
+
+ /**
+ * Disposes the column's resources.
+ */
+ protected void handleDispose() {
+
+ if (fCachedTextViewer != null) {
+ fCachedTextViewer.removeViewportListener(fInternalListener);
+ fCachedTextViewer.removeTextListener(fInternalListener);
+ }
+
+ if (fBuffer != null) {
+ fBuffer.dispose();
+ fBuffer= null;
+ }
+ }
+
+ /**
+ * Double buffer drawing.
+ *
+ * @param dest the GC to draw into
+ */
+ private void doubleBufferPaint(GC dest) {
+
+ Point size= fCanvas.getSize();
+
+ if (size.x <= 0 || size.y <= 0)
+ return;
+
+ if (fBuffer != null) {
+ Rectangle r= fBuffer.getBounds();
+ if (r.width != size.x || r.height != size.y) {
+ fBuffer.dispose();
+ fBuffer= null;
+ }
+ }
+ if (fBuffer == null)
+ fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
+
+ GC gc= new GC(fBuffer);
+ gc.setFont(fCanvas.getFont());
+ if (fForeground != null)
+ gc.setForeground(fForeground);
+
+ try {
+ gc.setBackground(getBackground(fCanvas.getDisplay()));
+ gc.fillRectangle(0, 0, size.x, size.y);
+
+ ILineRange visibleLines= JFaceTextUtil.getVisibleModelLines(fCachedTextViewer);
+ if (visibleLines == null)
+ return;
+ fScrollPos= fCachedTextWidget.getTopPixel();
+ doPaint(gc, visibleLines);
+ fCachedTextWidget.addMouseTrackListener(new MouseTrackListener(){
+
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mouseExit(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mouseHover(MouseEvent e) {
+
+
+ }
+
+ });
+
+ } finally {
+ gc.dispose();
+ }
+
+ dest.drawImage(fBuffer, 0, 0);
+ }
+
+ /**
+ * Returns <code>true</code> if the viewport displays the entire viewer contents, i.e. the
+ * viewer is not vertically scrollable.
+ *
+ * @return <code>true</code> if the viewport displays the entire contents, <code>false</code> otherwise
+ * @since 3.2
+ */
+ protected final boolean isViewerCompletelyShown() {
+ return JFaceTextUtil.isShowingEntireContents(fCachedTextWidget);
+ }
+
+ /**
+ * Draws the ruler column.
+ *
+ * @param gc the GC to draw into
+ * @param visibleLines the visible model lines
+ * @since 3.2
+ */
+ void doPaint(GC gc, ILineRange visibleLines) {
+ Display display= fCachedTextWidget.getDisplay();
+
+ // draw diff info
+ int y= -JFaceTextUtil.getHiddenTopLinePixels(fCachedTextWidget);
+
+ int lastLine= end(visibleLines);
+ for (int line= visibleLines.getStartLine(); line < lastLine; line++) {
+ int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line);
+ if (widgetLine == -1)
+ continue;
+
+ int lineHeight= fCachedTextWidget.getLineHeight(fCachedTextWidget.getOffsetAtLine(widgetLine));
+ paintLine(line, y, lineHeight, gc, display);
+ y += lineHeight;
+ }
+ }
+
+ /* @since 3.2 */
+ private static int end(ILineRange range) {
+ return range.getStartLine() + range.getNumberOfLines();
+ }
+
+ /**
+ * Computes the string to be printed for <code>line</code>. The default implementation returns
+ * <code>Integer.toString(line + 1)</code>.
+ *
+ * @param line the line number for which the line number string is generated
+ * @return the string to be printed on the line number bar for <code>line</code>
+ * @since 3.0
+ */
+ protected String createDisplayString(int line) {
+ return Integer.toString(line);
+ }
+
+ /**
+ * Returns the difference between the baseline of the widget and the
+ * baseline as specified by the font for <code>gc</code>. When drawing
+ * line numbers, the returned bias should be added to obtain text lined up
+ * on the correct base line of the text widget.
+ *
+ * @param gc the <code>GC</code> to get the font metrics from
+ * @param widgetLine the widget line
+ * @return the baseline bias to use when drawing text that is lined up with
+ * <code>fCachedTextWidget</code>
+ * @since 3.2
+ */
+ private int getBaselineBias(GC gc, int widgetLine) {
+ /*
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62951
+ * widget line height may be more than the font height used for the
+ * line numbers, since font styles (bold, italics...) can have larger
+ * font metrics than the simple font used for the numbers.
+ */
+ int offset= fCachedTextWidget.getOffsetAtLine(widgetLine);
+ int widgetBaseline= fCachedTextWidget.getBaseline(offset);
+
+ FontMetrics fm = gc.getFontMetrics();
+ int fontBaseline = fm.getAscent() + fm.getLeading();
+ int baselineBias= widgetBaseline - fontBaseline;
+ return Math.max(0, baselineBias);
+ }
+
+ /**
+ * Paints the line. After this method is called the line numbers are painted on top
+ * of the result of this method.
+ *
+ * @param line the line of the document which the ruler is painted for
+ * @param y the y-coordinate of the box being painted for <code>line</code>, relative to <code>gc</code>
+ * @param lineheight the height of one line (and therefore of the box being painted)
+ * @param gc the drawing context the client may choose to draw on.
+ * @param display the display the drawing occurs on
+ * @since 3.0
+ */
+ protected void paintLine(int line, int y, int lineheight, GC gc, Display display) {
+ int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fParentRuler.getTextViewer(), line);
+ String s = "";
+ int indentation= fCachedNumberOfDigits;
+
+ if (annotationColumn instanceof ISTAnnotationHyperlink){
+ ISTAnnotationHyperlink ah = (ISTAnnotationHyperlink)annotationColumn;
+ if (ah.isAnnotationHyperlink(widgetLine)){
+ paintHyperLink(line, y, indentation, lineheight, gc, display);
+
+ }
+ }
+ else{
+ s = annotationColumn.getAnnotation(widgetLine);
+
+ if (widgetLine + 1 == 1){
+ for(int i=0;i<annotationColumn.getTitle().length();i++)
+ s = s + " ";
+ }
+
+ int baselineBias= getBaselineBias(gc, widgetLine);
+ gc.drawString(s, indentation, y + baselineBias, true);
+ }
+ }
+
+ /**
+ * Triggers a redraw in the display thread.
+ *
+ * @since 3.0
+ */
+ protected final void postRedraw() {
+ if (fCanvas != null && !fCanvas.isDisposed()) {
+ Display d= fCanvas.getDisplay();
+ if (d != null) {
+ synchronized (fRunnableLock) {
+ if (fIsRunnablePosted)
+ return;
+ fIsRunnablePosted= true;
+ }
+ d.asyncExec(fRunnable);
+ }
+ }
+ }
+
+ /*
+ * @see IVerticalRulerColumn#redraw()
+ */
+ public void redraw() {
+
+ if (fRelayoutRequired) {
+ layout(true);
+ return;
+ }
+
+ if (fCachedTextViewer != null && fCanvas != null && !fCanvas.isDisposed()) {
+ GC gc= new GC(fCanvas);
+ doubleBufferPaint(gc);
+ gc.dispose();
+ }
+ }
+
+ /*
+ * @see IVerticalRulerColumn#setModel(IAnnotationModel)
+ */
+ public void setModel(IAnnotationModel model) {
+ }
+
+ /*
+ * @see IVerticalRulerColumn#setFont(Font)
+ */
+ public void setFont(Font font) {
+ fFont= font;
+ if (fCanvas != null && !fCanvas.isDisposed()) {
+ fCanvas.setFont(fFont);
+ updateNumberOfDigits();
+ computeIndentations();
+ }
+ }
+
+ /**
+ * Returns the parent (composite) ruler of this ruler column.
+ *
+ * @return the parent ruler
+ * @since 3.0
+ */
+ protected CompositeRuler getParentRuler() {
+ return fParentRuler;
+ }
+
+ protected void paintHyperLink(int line, int y, int x,int lineheight, GC gc, Display display) {
+ String str = annotationColumn.getAnnotation(line);
+ final TextStyle styledString = new TextStyle(gc.getFont(),null,null);
+ styledString.foreground = display.getSystemColor(SWT.COLOR_BLUE);
+ styledString.underline = true;
+ TextLayout tl = new TextLayout(display);
+ tl.setText(str);
+
+ tl.setStyle(styledString, 0, str.length());
+ y = y + lineheight/2 - gc.stringExtent(str).y/2;
+ tl.draw(gc, x, y);
+ if (line + 1 == 1){
+ int baselineBias= getBaselineBias(gc, line);
+ String s = "";
+ for(int i=0;i<annotationColumn.getTitle().length();i++)
+ s = s + " ";
+ gc.drawString(s, x + tl.getWidth() + 8, y + baselineBias, true);
+ }
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STRulerMessages.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STRulerMessages.java
new file mode 100644
index 0000000000..8c94eb7db3
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STRulerMessages.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Helper class to get NLSed messages.
+ */
+final class STRulerMessages extends NLS {
+
+ private static final String BUNDLE_NAME= STRulerMessages.class.getName();
+
+ private STRulerMessages() {
+ // Do not instantiate
+ }
+
+ public static String AbstractDecoratedTextEditor_revision_quickdiff_switch_title;
+ public static String AbstractDecoratedTextEditor_revision_quickdiff_switch_message;
+ public static String AbstractDecoratedTextEditor_revision_quickdiff_switch_rememberquestion;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, STRulerMessages.class);
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STTextEditorMessages.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STTextEditorMessages.java
new file mode 100644
index 0000000000..0cf40972aa
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/STTextEditorMessages.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.osgi.util.NLS;
+
+public class STTextEditorMessages extends NLS {
+ private static final String BUNDLE_FOR_CONSTRUCTED_KEYS= "org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STConstructedTextEditorMessages"; //$NON-NLS-1$
+ private static ResourceBundle fgBundleForConstructedKeys= ResourceBundle.getBundle(BUNDLE_FOR_CONSTRUCTED_KEYS);
+
+ /**
+ * Returns the message bundle which contains constructed keys.
+ *
+ * @since 3.1
+ * @return the message bundle
+ */
+ public static ResourceBundle getBundleForConstructedKeys() {
+ return fgBundleForConstructedKeys;
+ }
+
+ private static final String BUNDLE_NAME= STTextEditorMessages.class.getName();
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, STTextEditorMessages.class);
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/AbstractOpenSourceFileAction.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/AbstractOpenSourceFileAction.java
new file mode 100644
index 0000000000..d6d923cb14
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/AbstractOpenSourceFileAction.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.actions;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.AbstractSTAnnotatedSourceEditorInput;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STAnnotatedSourceEditorActivator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+
+public abstract class AbstractOpenSourceFileAction extends Action{
+ public static final String EDITOR_ID = "org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.editor";
+ private long ts;
+
+ public AbstractOpenSourceFileAction(String filepath,long ts){
+ super.setText("Open =>" + filepath);
+ this.ts = ts;
+ }
+
+ @Override
+ public void run() {
+
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+
+ IFileStore fileStore = getFileStore();
+
+ if (fileStore != null && !fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) {
+ long timeStamp = fileStore.fetchInfo().getLastModified();
+
+ if (timeStamp>ts) {
+ MessageBox msg = new MessageBox(window.getShell(),SWT.ICON_WARNING | SWT.APPLICATION_MODAL | SWT.YES| SWT.NO);
+ msg.setText(fileStore.toString());
+ msg.setMessage("The file "
+ + fileStore
+ + " is newer than the analysis result, \n"
+ + " if you continue opening it the visualization could result inconsistent. \n Do you want to continue?");
+ }
+
+ try {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ IFileStore fs = EFS.getStore(fileStore.toURI());
+ IEditorInput input = getInput(fs);
+ page.openEditor(input, EDITOR_ID, false);
+ }
+ } catch (Exception e) {
+ Status s = new Status(
+ IStatus.ERROR,
+ STAnnotatedSourceEditorActivator.getUniqueIdentifier(),
+ IStatus.ERROR,
+ "Error when opening annotated source view",
+ e);
+ STAnnotatedSourceEditorActivator.getDefault().getLog().log(s);
+ }
+ }
+ else{
+ if (!fileStore.fetchInfo().exists()) {
+ showMessage("The selected file does not exist: " + fileStore,window.getShell());
+ }
+ }
+
+ }
+
+ private void showMessage(String message,Shell shell) {
+ MessageBox msgBox = new MessageBox(shell,SWT.ICON_ERROR);
+ msgBox.setText("Error");
+ msgBox.setMessage(message);
+ msgBox.open();
+ }
+
+ public abstract AbstractSTAnnotatedSourceEditorInput getInput(IFileStore fs);
+
+ public abstract IFileStore getFileStore();
+}
+
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/OpenFileFullPathAction.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/OpenFileFullPathAction.java
new file mode 100644
index 0000000000..85cb88f124
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/OpenFileFullPathAction.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.actions;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.AbstractSTAnnotatedSourceEditorInput;
+
+
+public abstract class OpenFileFullPathAction extends AbstractOpenSourceFileAction {
+ private String filepath;
+ public OpenFileFullPathAction(String filepath, long ts) {
+ super(filepath, ts);
+ this.filepath = filepath;
+ }
+
+ public abstract AbstractSTAnnotatedSourceEditorInput getInput(IFileStore fs);
+
+ public IFileStore getFileStore(){
+ return EFS.getLocalFileSystem().getStore(new Path(filepath));
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/OpenWksRelFilePathAction.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/OpenWksRelFilePathAction.java
new file mode 100644
index 0000000000..a6dce5ce81
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/actions/OpenWksRelFilePathAction.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.actions;
+
+import java.io.File;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+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.linuxtools.dataviewers.annotatedsourceeditor.AbstractSTAnnotatedSourceEditorInput;
+import org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STAnnotatedSourceEditorActivator;
+
+
+
+public abstract class OpenWksRelFilePathAction extends AbstractOpenSourceFileAction {
+ private String filepath;
+
+ public OpenWksRelFilePathAction(String filepath, long ts) {
+ super(filepath, ts);
+
+ this.filepath = filepath;
+ }
+
+ @Override
+ public abstract AbstractSTAnnotatedSourceEditorInput getInput(IFileStore fs);
+
+ public IFileStore getFileStore(){
+ File file = new File(filepath);
+ IFile f = null;
+ if (!file.isAbsolute())
+ {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ if (workspace != null) {
+ IWorkspaceRoot wrkRoot = workspace.getRoot();
+ f = wrkRoot.getFile(new Path(filepath));
+ IPath p = f.getLocation();
+ if (p != null) file = p.toFile();
+ }
+ try {
+ IFileStore fs = EFS.getStore(file.toURI());
+ return fs;
+ } catch (CoreException e) {
+ STAnnotatedSourceEditorActivator.getDefault().getLog().log(e.getStatus());
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/hyperlink/ISTAnnotationHyperlink.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/hyperlink/ISTAnnotationHyperlink.java
new file mode 100644
index 0000000000..95dad66f03
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/hyperlink/ISTAnnotationHyperlink.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.hyperlink;
+
+public interface ISTAnnotationHyperlink {
+ boolean isAnnotationHyperlink(int line);
+ void handleHyperlink(int line);
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/preferencespages/STAnnotatedSourceEditorPreferencePage.java b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/preferencespages/STAnnotatedSourceEditorPreferencePage.java
new file mode 100644
index 0000000000..23fd2d9f43
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.annotatedsourceeditor/src/org/eclipse/linuxtools/dataviewers/annotatedsourceeditor/preferencespages/STAnnotatedSourceEditorPreferencePage.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.preferencespages;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class STAnnotatedSourceEditorPreferencePage extends PreferencePage
+ implements IWorkbenchPreferencePage {
+
+ /**
+ * A named preference that controls if the line number ruler is shown in the UI
+ * (value <code>"lineNumberRuler"</code>).
+ * <p>
+ * The preference value is of type <code>Boolean</code>.
+ * </p>
+ */
+ public final static String EDITOR_ST_RULER= "STRuler"; //$NON-NLS-1$
+
+ public STAnnotatedSourceEditorPreferencePage() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public STAnnotatedSourceEditorPreferencePage(String title) {
+ super(title);
+ // TODO Auto-generated constructor stub
+ }
+
+ public STAnnotatedSourceEditorPreferencePage(String title,
+ ImageDescriptor image) {
+ super(title, image);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void init(IWorkbench workbench) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/.classpath b/gcov/org.eclipse.linuxtools.dataviewers.charts/.classpath
new file mode 100755
index 0000000000..8a8f1668cd
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/.project b/gcov/org.eclipse.linuxtools.dataviewers.charts/.project
new file mode 100755
index 0000000000..70e988c53a
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.dataviewers.charts</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/META-INF/MANIFEST.MF b/gcov/org.eclipse.linuxtools.dataviewers.charts/META-INF/MANIFEST.MF
new file mode 100755
index 0000000000..ea57dcd378
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.dataviewers.charts;singleton:=true
+Bundle-Version: 4.1.0.qualifier
+Bundle-Activator: org.eclipse.linuxtools.dataviewers.charts.Activator
+Bundle-Vendor: %bundleProvider
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.linuxtools.dataviewers;bundle-version="4.0.0",
+ org.eclipse.birt.core;bundle-version="2.5.1",
+ org.eclipse.birt.chart.ui;bundle-version="2.5.1",
+ org.eclipse.birt.data;bundle-version="2.5.1",
+ org.eclipse.birt.data.aggregation;bundle-version="2.5.1",
+ org.eclipse.core.resources;bundle-version="3.4.2"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.linuxtools.dataviewers.charts,
+ org.eclipse.linuxtools.dataviewers.charts.actions,
+ org.eclipse.linuxtools.dataviewers.charts.dataengine,
+ org.eclipse.linuxtools.dataviewers.charts.dialogs,
+ org.eclipse.linuxtools.dataviewers.charts.provider,
+ org.eclipse.linuxtools.dataviewers.charts.view,
+ org.eclipse.linuxtools.dataviewers.charts.viewer
+Import-Package: com.ibm.icu.util;version="4.0.1"
+Bundle-Localization: plugin
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/about.html b/gcov/org.eclipse.linuxtools.dataviewers.charts/about.html
new file mode 100644
index 0000000000..23506a4bae
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/about.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>About</title>
+</head><body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html> \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/build.properties b/gcov/org.eclipse.linuxtools.dataviewers.charts/build.properties
new file mode 100755
index 0000000000..8ef30b817a
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ META-INF/,\
+ icons/,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/Thumbs.db b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/Thumbs.db
new file mode 100755
index 0000000000..1f91a7ae08
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/Thumbs.db
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/chart_icon.png b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/chart_icon.png
new file mode 100755
index 0000000000..67d1a81fdc
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/chart_icon.png
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/dexport.gif b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/dexport.gif
new file mode 100644
index 0000000000..3f89cd90e6
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/dexport.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/dimport.gif b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/dimport.gif
new file mode 100644
index 0000000000..cd4474182f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/dimport.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/eexport.gif b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/eexport.gif
new file mode 100644
index 0000000000..5a0837d1e4
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/eexport.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/eimport.gif b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/eimport.gif
new file mode 100644
index 0000000000..d38085ad9c
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/eimport.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/save_chart.gif b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/save_chart.gif
new file mode 100755
index 0000000000..466bfb1128
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/icons/save_chart.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/plugin.properties b/gcov/org.eclipse.linuxtools.dataviewers.charts/plugin.properties
new file mode 100644
index 0000000000..c1c5fab678
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/plugin.properties
@@ -0,0 +1,14 @@
+#******************************************************************************
+# Copyright (c) 2009 STMicroelectronics.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# STMicroelectronics - initial API and implementation
+#*******************************************************************************
+bundleProvider = Eclipse Linux Tools
+bundleName = Data Viewers Birt Charts Plug-in (Incubation)
+chartview.name = Chart View
+chartcategory.name = Charts \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/plugin.xml b/gcov/org.eclipse.linuxtools.dataviewers.charts/plugin.xml
new file mode 100755
index 0000000000..fd38dfb46c
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/plugin.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ allowMultiple="true"
+ category="org.eclipse.linuxtools.dataviewers.charts"
+ class="org.eclipse.linuxtools.dataviewers.charts.view.ChartView"
+ icon="icons/chart_icon.png"
+ id="org.eclipse.linuxtools.dataviewers.charts.view"
+ name="%chartview.name"
+ restorable="true">
+ </view>
+ <category
+ id="org.eclipse.linuxtools.dataviewers.charts"
+ name="%chartcategory.name">
+ </category>
+ </extension>
+
+</plugin>
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/Activator.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/Activator.java
new file mode 100755
index 0000000000..0162326acb
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/Activator.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.dataviewers.charts";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (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 Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ /**
+ * Returns an image from the path
+ *
+ * @param path the path
+ * @return the image
+ */
+ public static Image getImage(String path) {
+ Image image = plugin.getImageRegistry().get(path);
+ if (image == null) {
+ image = getImageDescriptor(path).createImage();
+ plugin.getImageRegistry().put(path, image);
+ }
+ return image;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/ChartConstants.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/ChartConstants.java
new file mode 100755
index 0000000000..431ecf0298
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/ChartConstants.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts;
+
+
+/**
+ * A class that handles the constants used by the charts.
+ *
+ * <br/>
+ * <br/>
+ * It contains:
+ * <ul>
+ * <li>labels used by the chart dialog.</li>
+ * <li>keys and default values used by the dialog settings.</li>
+ * <li>predefined colors used by the charts.</li>
+ * </ul>
+ *
+ */
+public class ChartConstants {
+
+ /** The section name of the viewer's dialog settings where the chart dialog save its state */
+ public static final String TAG_SECTION_BIRTCHARTS_STATE = "birtcharts_section";
+ /** The key used by the column buttons to save their state. For example the button i will use the key <code>TAG_COLUMN_BUTTON_+i</code> */
+ public static final String TAG_COLUMN_BUTTON_ = "COLUMN_BUTTON_";
+ /** The key used by the bar graph button to save its state */
+ public static final String TAG_BAR_GRAPH_BUTTON = "BAR_GRAPH_BUTTON";
+ /** The key used by the vertical bars button to save its state */
+ public static final String TAG_VERTICAL_BARS_BUTTON = "VERTICAL_BARS_BUTTON";
+
+ /** The default value of the column buttons */
+ public static final boolean DEFAULT_COLUMN_BUTTON = true;
+ /** The default value of the bar graph button */
+ public static final boolean DEFAULT_BAR_GRAPH_BUTTON = true;
+ /** The default value of the vertical bars button */
+ public static final boolean DEFAULT_VERTICAL_BARS_BUTTON = false;
+
+ /** The section name of the "save chart as image" action dialog settings */
+ public static final String TAG_SECTION_BIRTCHARTS_SAVEACTION_STATE = "birtcharts_saveasimg_section";
+ /** The key used by the file dialog to save its file name */
+ public static final String TAG_IMG_FILE_NAME = "IMG_FILE_NAME";
+ /** The key used by the file dialog to save its filter path */
+ public static final String TAG_IMG_FILTER_PATH = "IMG_FILTER_PATH";
+
+ /** The default value of the file dialog file name */
+ public static final String DEFAULT_IMG_FILE_NAME = ".";
+ /** The default value of the file dialog filter path */
+ public static final String DEFAULT_IMG_FILTER_PATH = ".";
+
+ /** Image extension for jpg format */
+ public static final String EXT_JPG = ".jpg";
+ /** Image extension for jpeg format */
+ public static final String EXT_JPEG = ".jpeg";
+ /** Image extension for png format */
+ public static final String EXT_PNG = ".png";
+ /** Image extension for gif format */
+ public static final String EXT_GIF = ".gif";
+ /** Image extension for svg format */
+ public static final String EXT_SVG = ".svg";
+ /** The file extensions provided by the "save chart as image" file dialog */
+ public static final String[] saveAsImageExt =
+ {
+ "*"+EXT_JPG,
+ "*"+EXT_JPEG,
+ "*"+EXT_PNG,
+ "*"+EXT_GIF,
+ "*.*"
+ };
+ /** The names associated to the files extensions provided by the "save chart as image" file dialog */
+ public static String[] saveAsImageExtNames =
+ {
+ "JPEG (*.jpg)",
+ "JPEG (*.jpeg)",
+ "PNG (*.png)",
+ "GIF (*.gif)",
+ "All Files (*.*)"
+ };
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/UIHelper.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/UIHelper.java
new file mode 100644
index 0000000000..1cfc2e345d
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/UIHelper.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.dataviewers.charts;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * This class has been created to hold methods that provide specific
+ * functionality or services.
+ */
+public final class UIHelper
+{
+
+ /**
+ * This method returns an URL for a resource given its plugin relative path.
+ * It is intended to be used to abstract out the usage of the UI as a plugin
+ * or standalone component when it comes to accessing resources.
+ *
+ * @param sPluginRelativePath
+ * The path to the resource relative to the plugin location.
+ * @return URL representing the location of the resource.
+ */
+ public static URL getURL( String sPluginRelativePath )
+ {
+ URL url = null;
+ if ( Platform.getExtensionRegistry( ) != null )
+ {
+ try
+ {
+ url = new URL( Activator.getDefault( )
+ .getBundle( )
+ .getEntry( "/" ), sPluginRelativePath ); //$NON-NLS-1$
+ }
+ catch ( MalformedURLException e )
+ {
+ e.printStackTrace( );
+ }
+ }
+ else
+ {
+ try
+ {
+ url = new URL( "file:///" + new File( sPluginRelativePath ).getAbsolutePath( ) ); //$NON-NLS-1$
+ }
+ catch ( MalformedURLException e )
+ {
+ e.printStackTrace( );
+ }
+ }
+
+ return url;
+ }
+
+ private static Image createImage( String sPluginRelativePath )
+ {
+ Image img = null;
+ try
+ {
+ try
+ {
+ img = new Image( Display.getCurrent( ),
+ getURL( sPluginRelativePath ).openStream( ) );
+ }
+ catch ( MalformedURLException e1 )
+ {
+ img = new Image( Display.getCurrent( ),
+ new FileInputStream( getURL( sPluginRelativePath ).toString( ) ) );
+ }
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace( );
+ }
+
+ // If still can't load, return a dummy image.
+ if ( img == null )
+ {
+ img = new Image( Display.getCurrent( ), 1, 1 );
+ }
+ return img;
+ }
+
+ /**
+ * This is a convenience method to get an imgIcon from a URL.
+ *
+ * @param sPluginRelativePath
+ * The URL for the imgIcon.
+ * @return The imgIcon represented by the given URL.
+ * @see #setImageCached( boolean )
+ */
+ public static Image getImage( String sPluginRelativePath )
+ {
+ ImageRegistry registry = JFaceResources.getImageRegistry( );
+ Image image = registry.get( sPluginRelativePath );
+ if ( image == null )
+ {
+ image = createImage( sPluginRelativePath );
+ registry.put( sPluginRelativePath, image );
+ }
+ return image;
+ }
+
+ /**
+ * This is a convenience method to get an imgIcon from a URL.
+ *
+ * @param sPluginRelativePath
+ * The URL for the imgIcon.
+ * @return The imgIcon represented by the given URL.
+ * @see #setImageCached( boolean )
+ */
+ public static ImageDescriptor getImageDescriptor( String sPluginRelativePath )
+ {
+ ImageRegistry registry = JFaceResources.getImageRegistry( );
+ ImageDescriptor image = registry.getDescriptor( sPluginRelativePath );
+ if ( image == null )
+ {
+ registry.put( sPluginRelativePath,
+ createImage( sPluginRelativePath ) );
+ image = registry.getDescriptor( sPluginRelativePath );
+ }
+ return image;
+ }
+} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/ChartAction.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/ChartAction.java
new file mode 100755
index 0000000000..43cf4317a5
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/ChartAction.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.actions;
+
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer;
+import org.eclipse.linuxtools.dataviewers.charts.Activator;
+import org.eclipse.linuxtools.dataviewers.charts.dialogs.ChartDialog;
+import org.eclipse.linuxtools.dataviewers.charts.view.ChartView;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * An action that open a chart dialog from an <code>AbstractSTViewer</code>.
+ *
+ * @see AbstractSTViewer
+ */
+public class ChartAction extends Action {
+
+ /** The dialog */
+ private ChartDialog dialog;
+
+ /**
+ * The constructor.
+ *
+ * @param shell the shell used by the dialog
+ * @param viewer the viewer inputed to the disalog
+ */
+ public ChartAction(Shell shell, AbstractSTViewer viewer) {
+ super("Create chart...", Activator.getImageDescriptor("icons/chart_icon.png"));
+ dialog = createDialog(shell, viewer);
+ setEnabled(!viewer.getViewer().getSelection().isEmpty());
+ viewer.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ setEnabled(!event.getSelection().isEmpty());
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ dialog.open();
+ Chart chart = dialog.getValue();
+ if (chart != null) {
+ ChartView.createChartView(chart);
+
+ }
+ }
+
+ protected ChartDialog createDialog(Shell shell,AbstractSTViewer viewer){
+ return new ChartDialog(shell,viewer);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/ChartActionRenderer.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/ChartActionRenderer.java
new file mode 100644
index 0000000000..cd47aab57d
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/ChartActionRenderer.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.actions;
+
+import org.eclipse.birt.chart.render.ActionRendererAdapter;
+import org.eclipse.birt.chart.computation.DataPointHints;
+import org.eclipse.birt.chart.event.StructureSource;
+import org.eclipse.birt.chart.event.StructureType;
+import org.eclipse.birt.chart.model.attribute.ActionType;
+import org.eclipse.birt.chart.model.attribute.TooltipValue;
+import org.eclipse.birt.chart.model.attribute.impl.JavaNumberFormatSpecifierImpl;
+import org.eclipse.birt.chart.model.data.Action;
+
+import com.ibm.icu.util.ULocale;
+
+
+/**
+ * Simple implementation for IActionRenderer
+ */
+public class ChartActionRenderer extends ActionRendererAdapter {
+
+
+ public void processAction( Action action, StructureSource source )
+ {
+ if ( ActionType.SHOW_TOOLTIP_LITERAL.equals( action.getType( ) ) )
+ {
+ TooltipValue tv = (TooltipValue) action.getValue( );
+ if ( StructureType.SERIES_DATA_POINT.equals( source.getType( ) ) )
+ {
+ final DataPointHints dph = (DataPointHints) source.getSource( );
+ String MyToolTip = "Value is " +
+ JavaNumberFormatSpecifierImpl.create("0.00").format(
+ ((Double)dph.getOrthogonalValue()).doubleValue(),ULocale.getDefault());
+ tv.setText( MyToolTip );
+ }
+ }
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/OpenChartAction.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/OpenChartAction.java
new file mode 100644
index 0000000000..539ef4c880
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/OpenChartAction.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.actions;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.birt.chart.model.Serializer;
+import org.eclipse.birt.chart.model.impl.SerializerImpl;
+import org.eclipse.birt.core.ui.frameworks.taskwizard.WizardBase;
+import org.eclipse.jface.action.Action;
+import org.eclipse.linuxtools.dataviewers.charts.UIHelper;
+import org.eclipse.linuxtools.dataviewers.charts.view.ChartView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+
+public class OpenChartAction extends Action {
+ private Chart chart = null;
+ private FileDialog dialog;
+ private ChartView chartView;
+
+ public OpenChartAction(Shell shell,ChartView cView){
+ setImageDescriptor( UIHelper.getImageDescriptor( "icons/eimport.gif" ) );
+ setDisabledImageDescriptor( UIHelper.getImageDescriptor( "icons/dimport.gif" ) );
+ setToolTipText( "Open XML Source" );
+ setEnabled(true);
+ this.chartView = cView;
+ this.dialog = new FileDialog(shell, SWT.OPEN);
+ dialog.setText("Select a chart file ");
+ dialog.setFilterExtensions(new String[]{"*.chart"});
+ }
+
+ public void run() {
+ String path = dialog.open();
+
+ if (path == null) {
+ // cancel pressed
+ return;
+ }
+
+ Serializer serializer = null;
+ final File chartFile = new File( path );
+
+ // Reads the chart model
+ try
+ {
+ serializer = SerializerImpl.instance( );
+ if ( chartFile.exists( ) )
+ {
+ chart = serializer.read( new FileInputStream( chartFile ) );
+ chartView.getChartViewer().setBuffer(null);
+ chartView.setChart(chart);
+ }
+ }
+ catch ( Exception e )
+ {
+ WizardBase.displayException( e );
+ }
+ }
+
+ public Chart getChart(){
+ return chart;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/SaveChartAction.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/SaveChartAction.java
new file mode 100755
index 0000000000..74de88b7f3
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/SaveChartAction.java
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.actions;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.birt.chart.device.IDeviceRenderer;
+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.impl.BoundsImpl;
+import org.eclipse.birt.chart.util.PluginSettings;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.linuxtools.dataviewers.charts.Activator;
+import org.eclipse.linuxtools.dataviewers.charts.ChartConstants;
+import org.eclipse.linuxtools.dataviewers.charts.view.ChartView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import com.ibm.icu.util.ULocale;
+
+/**
+ * An action to save a chart as an image (jpeg, gif, png)
+ * @author Marzia Maugeri <marzia.maugeri@st.com>
+ */
+public class SaveChartAction extends Action {
+
+ private FileDialog dialog;
+ private Shell shell;
+ private Chart cm;
+ private IDeviceRenderer idr;
+ private Bounds bo;
+ private ChartView chartView;
+
+ /**
+ * Constructor
+ *
+ * @param shell the shell used by the dialogs
+ */
+ public SaveChartAction(Shell shell,ChartView cview) {
+ super("Save chart as...", Activator.getImageDescriptor("icons/save_chart.gif"));
+ this.chartView = cview;
+ this.setEnabled(false);
+ this.shell = shell;
+ this.dialog = new FileDialog(shell, SWT.SAVE);
+ dialog.setFileName(ChartConstants.DEFAULT_IMG_FILE_NAME);
+ dialog.setFilterPath(ChartConstants.DEFAULT_IMG_FILTER_PATH);
+ dialog.setFilterExtensions(ChartConstants.saveAsImageExt);
+ dialog.setFilterNames(ChartConstants.saveAsImageExtNames);
+ dialog.setText("Select an image file (extension will be set to \".jpeg\" if not recognized).");
+
+ // restore state if there is one saved
+ restoreState();
+ }
+
+ /**
+ * Sets the image plugins on the chart and enables the action if chart is not null.
+ *
+ * @param chart
+ */
+ public void setChart(Chart chart) {
+ try {
+ if (chart != null) {
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
+ cm = chart;
+ } catch (Throwable _)
+ {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ "Error when creating \"save as image\" action...",
+ _);
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+
+ public void setBounds(Bounds bo){
+ this.bo = bo;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run() {
+ String path = dialog.open();
+ if (path == null) {
+ // cancel pressed
+ return;
+ }
+
+ String ext = "";
+
+
+ int dotIdx = path.lastIndexOf(".");
+ if (dotIdx > 0) ext = path.substring(dotIdx);
+
+ try {
+ if (ext.equals(ChartConstants.EXT_GIF)) {
+ idr = PluginSettings.instance().getDevice("dv.GIF");
+ }
+ else if (ext.equals(ChartConstants.EXT_JPEG)) {
+ idr = PluginSettings.instance().getDevice("dv.JPEG");
+ }
+ else if (ext.equals(ChartConstants.EXT_JPG)) {
+ idr = PluginSettings.instance().getDevice("dv.JPG");
+ }
+ else if (ext.equals(ChartConstants.EXT_PNG)) {
+ idr = PluginSettings.instance().getDevice("dv.PNG");
+ }
+ else {
+ path += ChartConstants.EXT_JPEG;
+ idr = PluginSettings.instance().getDevice("dv.JPG");
+ }
+
+ } catch (ChartException e) {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ e.getMessage(),
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+
+ final File file = new File(path);
+ if (file.exists()) {
+ boolean overwrite =
+ MessageDialog.openQuestion(shell, "Confirm overwrite", "File already exists. Overwrite?");
+ if (overwrite) {
+ file.delete();
+ } else {
+ return;
+ }
+ }
+
+ Job saveAsImage = new Job("Save chart as "+file.getName()) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ monitor.beginTask("Saving chart as "+file.getName()+"...", IProgressMonitor.UNKNOWN);
+ file.createNewFile();
+ generateImageFile(file);
+ return Status.OK_STATUS;
+ } catch (IOException e) {
+ return new Status(
+ IStatus.ERROR,
+ Activator.PLUGIN_ID,
+ "Error saving chart to \""
+ + file.getAbsolutePath()
+ + "\":"
+ + e.getMessage(),
+ e);
+ }
+ }
+ };
+ saveAsImage.setUser(true);
+ saveAsImage.schedule();
+
+ // save the state of the dialog
+ saveState();
+ }
+
+ /**
+ * Restores the state of this action (file dialog)
+ */
+ public void restoreState() {
+ try {
+ IDialogSettings settings =
+ Activator.getDefault().getDialogSettings().getSection(ChartConstants.TAG_SECTION_BIRTCHARTS_SAVEACTION_STATE);
+ if (settings == null) {
+ settings = Activator.getDefault().getDialogSettings().addNewSection(ChartConstants.TAG_SECTION_BIRTCHARTS_SAVEACTION_STATE);
+ return;
+ }
+
+ dialog.setFileName(settings.get(ChartConstants.TAG_IMG_FILE_NAME));
+ dialog.setFilterPath(settings.get(ChartConstants.TAG_IMG_FILTER_PATH));
+ }
+ catch (Exception e) {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ e.getMessage(),
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+
+ /**
+ * Saves the state of this action (file dialog)
+ */
+ public void saveState() {
+ try {
+ IDialogSettings settings =
+ Activator.getDefault().getDialogSettings().getSection(ChartConstants.TAG_SECTION_BIRTCHARTS_SAVEACTION_STATE);
+ if (settings == null) {
+ settings = Activator.getDefault().getDialogSettings().addNewSection(ChartConstants.TAG_SECTION_BIRTCHARTS_SAVEACTION_STATE);
+ }
+
+ settings.put(ChartConstants.TAG_IMG_FILE_NAME, dialog.getFileName());
+ settings.put(ChartConstants.TAG_IMG_FILTER_PATH, dialog.getFilterPath());
+ }
+ catch (Exception e) {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ e.getMessage(),
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+
+ protected void generateImageFile(File file){
+ RunTimeContext rtc = new RunTimeContext( );
+ rtc.setULocale( ULocale.getDefault( ) );
+
+ final Generator gr = Generator.instance( );
+ GeneratedChartState gcs = null;
+
+ Bounds boFile = null;
+ bo = chartView.getChartViewer().getBounds();
+ //Set the chart size
+ if (bo != null){
+ boFile = BoundsImpl.create(bo.getLeft(), bo.getTop(), bo.getWidth(), bo.getHeight());
+ }
+ else{
+ boFile = BoundsImpl.create(0, 0, 800, 600);
+ }
+
+
+ try {
+ gcs = gr.build( idr.getDisplayServer( ), cm, boFile, null, rtc, null );
+ } catch (ChartException e) {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ e.getMessage(),
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+
+ //Specify the file to write to.
+ idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, file.getAbsolutePath() );
+
+ //generate the chart
+ try {
+ gr.render( idr, gcs );
+ } catch (ChartException e) {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ e.getMessage(),
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/SaveXMLAction.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/SaveXMLAction.java
new file mode 100644
index 0000000000..a3c7ca0a29
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/actions/SaveXMLAction.java
@@ -0,0 +1,132 @@
+/***********************************************************************
+ * 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
+ ***********************************************************************/
+
+package org.eclipse.linuxtools.dataviewers.charts.actions;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.birt.chart.model.Serializer;
+import org.eclipse.birt.chart.model.impl.SerializerImpl;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.linuxtools.dataviewers.charts.Activator;
+import org.eclipse.linuxtools.dataviewers.charts.UIHelper;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.MessageBox;
+
+public class SaveXMLAction extends Action
+{
+
+ private Composite cmp;
+ private Chart cm;
+
+ public SaveXMLAction( Composite parent )
+ {
+ super( );
+ cmp = parent;
+ setImageDescriptor( UIHelper.getImageDescriptor( "icons/eexport.gif" ) );
+ setDisabledImageDescriptor( UIHelper.getImageDescriptor( "icons/dexport.gif" ) );
+ setToolTipText( "Save XML Source" );
+ setDescription( "Save XML Source to the designated directory" );
+ }
+
+ /**
+ * When the action is invoked, pop up a File Dialog to designate the
+ * directory.
+ */
+ public void run( )
+ {
+ if ( cm != null )
+ {
+ final FileDialog saveDialog = new FileDialog( cmp.getShell( ),
+ SWT.SAVE );
+ saveDialog.setFilterExtensions( new String[]{
+ "*.chart"} ); //$NON-NLS-1$
+ try
+ {
+ saveDialog.open( );
+ String name = saveDialog.getFileName( );
+ if ( name != null && name != "" ) //$NON-NLS-1$
+ {
+ Serializer serializer = null;
+ final File file = new File( saveDialog.getFilterPath( ),
+ name );
+ if ( file.exists( ) )
+ {
+ MessageBox box = new MessageBox( cmp.getShell( ),
+ SWT.ICON_WARNING | SWT.YES | SWT.NO );
+ box.setText( "Save XML Source"); //$NON-NLS-1$
+ box.setMessage( "The XML source already exists in the directory. \nDo you want to replace it?" );
+ if ( box.open( ) != SWT.YES )
+ {
+ return;
+ }
+ }
+
+ serializer = SerializerImpl.instance( );
+ try
+ {
+ serializer.write( cm, new FileOutputStream( file ) );
+ IFile c = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(file.getAbsolutePath()));
+ if (c != null){
+ try {
+ c.refreshLocal(1, new NullProgressMonitor());
+ } catch (CoreException e) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+ Activator.getDefault().getLog().log(status);
+ }
+ }
+
+ }
+ catch ( IOException ioe )
+ {
+ ioe.printStackTrace( );
+ }
+ }
+ }
+ catch ( Throwable e )
+ {
+ e.printStackTrace( );
+ }
+ }
+ }
+
+ public void setChart(Chart chart) {
+ try {
+ if (chart != null) {
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
+ cm = chart;
+ } catch (Throwable _)
+ {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ "Error when creating \"save as image\" action...",
+ _);
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/BindDataEngine.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/BindDataEngine.java
new file mode 100644
index 0000000000..a6d2d3a59f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/BindDataEngine.java
@@ -0,0 +1,364 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.dataengine;
+
+import org.eclipse.birt.chart.exception.ChartException;
+import org.eclipse.birt.chart.factory.Generator;
+import org.eclipse.birt.chart.factory.IDataRowExpressionEvaluator;
+import org.eclipse.birt.chart.factory.RunTimeContext;
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.birt.chart.model.ChartWithAxes;
+import org.eclipse.birt.chart.model.attribute.AxisType;
+import org.eclipse.birt.chart.model.attribute.IntersectionType;
+import org.eclipse.birt.chart.model.attribute.LegendItemType;
+import org.eclipse.birt.chart.model.attribute.Position;
+import org.eclipse.birt.chart.model.attribute.TickStyle;
+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.SeriesDefinition;
+import org.eclipse.birt.chart.model.data.impl.QueryImpl;
+import org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl;
+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.BarSeries;
+import org.eclipse.birt.chart.model.type.impl.BarSeriesImpl;
+import org.eclipse.birt.core.archive.IDocArchiveReader;
+import org.eclipse.birt.core.archive.IDocArchiveWriter;
+import org.eclipse.birt.core.data.Constants;
+import org.eclipse.birt.core.data.ExpressionUtil;
+import org.eclipse.birt.core.exception.BirtException;
+import org.eclipse.birt.data.aggregation.api.IBuildInAggregation;
+import org.eclipse.birt.data.engine.api.DataEngine;
+import org.eclipse.birt.data.engine.api.DataEngineContext;
+import org.eclipse.birt.data.engine.api.IGroupDefinition;
+import org.eclipse.birt.data.engine.api.IPreparedQuery;
+import org.eclipse.birt.data.engine.api.IQueryResults;
+import org.eclipse.birt.data.engine.api.querydefn.Binding;
+import org.eclipse.birt.data.engine.api.querydefn.GroupDefinition;
+import org.eclipse.birt.data.engine.api.querydefn.OdaDataSetDesign;
+import org.eclipse.birt.data.engine.api.querydefn.OdaDataSourceDesign;
+import org.eclipse.birt.data.engine.api.querydefn.QueryDefinition;
+import org.eclipse.birt.data.engine.api.querydefn.ScriptExpression;
+import org.eclipse.birt.data.engine.core.DataException;
+import org.eclipse.linuxtools.dataviewers.charts.Activator;
+
+import com.ibm.icu.util.ULocale;
+
+/**
+ * The example demonstrates how chart works with ODA/DtE(BIRT data engine) to
+ * get grouped/aggregated data set, the ODA/DtE is responsible to execute data
+ * query and grouping/aggregation, it returns a grouped data set to chart and
+ * chart retrieve data without grouping/aggregation by chart-self.
+ * <p>
+ * In the example, it only uses flat file as data source, actually it supports
+ * any JDBC data source, referring to {@link org.eclipse.birt.data.engine} to
+ * get detail information.
+ *
+ * @since 2.3
+ */
+public class BindDataEngine
+{
+ private String[] columnsName = null;
+ private FlatFileDataSource ffds = null;
+
+ /**
+ * Create runtime chart model and bind data.
+ *
+ * @return
+ * @throws ChartException
+ */
+ public final Chart createWorkingWithBIRTDataEngine(FlatFileDataSource ffds)
+ throws ChartException
+ {
+ this.ffds = ffds;
+ columnsName = ffds.getCOLUMNNAME();
+ String[] expressions = new String[columnsName.length];
+ expressions[0] = ExpressionUtil.createRowExpression( columnsName[0] );
+ expressions[1] = ExpressionUtil.createRowExpression( columnsName[1] );
+
+ ChartWithAxes cwaBar = createChartModel( expressions );
+
+ cwaBar = bindData( cwaBar, expressions );
+
+ return cwaBar;
+ }
+
+ /**
+ * Create chart model.
+ *
+ * @param expressions
+ * expressions are used to set category series and value series.
+ * @return
+ */
+ private static ChartWithAxes createChartModel( String[] expressions )
+ {
+ ChartWithAxes cwaBar = ChartWithAxesImpl.create( );
+ cwaBar.setType( "Bar Chart" );
+ cwaBar.setSubType( "Side-by-side" );
+ // Plot
+ cwaBar.getBlock( ).setBackground( ColorDefinitionImpl.WHITE( ) );
+ cwaBar.getBlock( ).getOutline( ).setVisible( true );
+ Plot p = cwaBar.getPlot( );
+ p.getClientArea( ).setBackground( ColorDefinitionImpl.create( 255,
+ 255,
+ 225 ) );
+
+ // Title
+ cwaBar.getTitle( )
+ .getLabel( )
+ .getCaption( )
+ .setValue( "Working with BIRT Data Engine" );
+
+ // Legend
+ Legend lg = cwaBar.getLegend( );
+ lg.setItemType( LegendItemType.CATEGORIES_LITERAL );
+
+ // X-Axis
+ Axis xAxisPrimary = cwaBar.getPrimaryBaseAxes( )[0];
+
+ xAxisPrimary.setType( AxisType.TEXT_LITERAL );
+ xAxisPrimary.getMajorGrid( ).setTickStyle( TickStyle.BELOW_LITERAL );
+ xAxisPrimary.getOrigin( ).setType( IntersectionType.MIN_LITERAL );
+
+ // Y-Axis
+ Axis yAxisPrimary = cwaBar.getPrimaryOrthogonalAxis( xAxisPrimary );
+ yAxisPrimary.getMajorGrid( ).setTickStyle( TickStyle.LEFT_LITERAL );
+ yAxisPrimary.setType( AxisType.LINEAR_LITERAL );
+ yAxisPrimary.getLabel( ).getCaption( ).getFont( ).setRotation( 90 );
+ yAxisPrimary.getTitle( ).setVisible( true );
+ yAxisPrimary.getTitle( ).getCaption( ).setValue( "Customer Amount" ); //$NON-NLS-1$
+ yAxisPrimary.getTitle( )
+ .getCaption( )
+ .setColor( ColorDefinitionImpl.GREEN( ) );
+
+ // X-Series
+ Series seCategory = SeriesImpl.create( );
+ // seCategory.setDataSet( categoryValues );
+
+ // Set category expression.
+ seCategory.getDataDefinition( )
+ .add( QueryImpl.create( expressions[0] ) );
+
+ SeriesDefinition sdX = SeriesDefinitionImpl.create( );
+ sdX.getSeriesPalette( ).shift( 0 );
+
+ xAxisPrimary.getSeriesDefinitions( ).add( sdX );
+ sdX.getSeries( ).add( seCategory );
+
+ // Y-Series
+ BarSeries bs1 = (BarSeries) BarSeriesImpl.create( );
+ bs1.getDataDefinition( ).add( QueryImpl.create( expressions[1] ) );
+ bs1.getLabel( ).setVisible( true );
+ bs1.setLabelPosition( Position.INSIDE_LITERAL );
+
+ SeriesDefinition sdY = SeriesDefinitionImpl.create( );
+ yAxisPrimary.getSeriesDefinitions( ).add( sdY );
+ sdY.getSeries( ).add( bs1 );
+ return cwaBar;
+ }
+
+ /**
+ * Binds data into chart model.
+ *
+ * @param cwaBar
+ * @return
+ * @throws ChartException
+ */
+ private ChartWithAxes bindData( ChartWithAxes cwaBar,
+ String[] expressions ) throws ChartException
+ {
+
+ RunTimeContext context = new RunTimeContext( );
+ context.setULocale( ULocale.getDefault( ) );
+
+ IDataRowExpressionEvaluator evaluator;
+ try
+ {
+ // Create row expression evaluator for chart doing data binding.
+ evaluator = prepareRowExpressionEvaluator( cwaBar, expressions );
+
+ // Binding data.
+ Generator.instance( ).bindData( evaluator, cwaBar, context );
+ }
+ catch ( BirtException e )
+ {
+ throw new ChartException( Activator.PLUGIN_ID,
+ ChartException.DATA_BINDING,
+ e );
+ }
+ return cwaBar;
+ }
+
+ /**
+ * Uses BIRT data engine to do query and wraps data with
+ * <code>IDataRowExpressionEvaluator</code> for chart doing data binding.
+ *
+ * @return
+ * @throws BirtException
+ */
+ private IDataRowExpressionEvaluator prepareRowExpressionEvaluator(
+ ChartWithAxes chart, String[] expressions ) throws BirtException
+ {
+
+ // Initialize data source and data set.
+ OdaDataSourceDesign odaDataSource = newDataSource( );
+ OdaDataSetDesign odaDataSet = newDataSet( odaDataSource );
+
+ // Create query definition.
+ QueryDefinition query = createQueryDefinition( odaDataSet, expressions );
+
+ // Create data engine and execute query.
+ DataEngine dataEngine = newDataEngine( );
+ dataEngine.defineDataSource( odaDataSource );
+ dataEngine.defineDataSet( odaDataSet );
+ IPreparedQuery preparedQuery = dataEngine.prepare( query );
+
+ IQueryResults queryResults = preparedQuery.execute( null );
+
+ // Create row expression evaluator.
+ return new GroupedRowExpressionsEvaluator( queryResults.getResultIterator( ),
+ true );
+ }
+
+ /**
+ * Create query definition.
+ *
+ * @param odaDataSet
+ * @param expressions
+ * @return
+ * @throws ChartException
+ */
+ private QueryDefinition createQueryDefinition(
+ OdaDataSetDesign odaDataSet, String[] expressions )
+ throws ChartException
+ {
+
+ QueryDefinition queryDefn = new QueryDefinition( );
+ queryDefn.setDataSetName( odaDataSet.getName( ) );
+
+ try
+ {
+ initDefaultBindings( queryDefn );
+
+ // Add group definitions and aggregation binding.
+ String groupName = "Group_Country"; //$NON-NLS-1$
+ GroupDefinition gd = new GroupDefinition( groupName );
+ gd.setKeyExpression( expressions[0] );
+ gd.setInterval( IGroupDefinition.NO_INTERVAL );
+ gd.setIntervalRange( 0 );
+
+ // Add expression bindings.
+ for ( int i = 0; i < expressions.length; i++ )
+ {
+ String expr = (String) expressions[i];
+ Binding colBinding = new Binding( expr );
+ colBinding.setExpression( new ScriptExpression( expr ) );
+ if ( i == 1 )
+ {
+ colBinding.setExpression( null );
+ colBinding.setAggrFunction( IBuildInAggregation.TOTAL_COUNT_FUNC );
+ colBinding.addAggregateOn( groupName );
+ colBinding.addArgument( new ScriptExpression( expressions[i] ) );
+ }
+
+ queryDefn.addBinding( colBinding );
+ }
+
+ queryDefn.addGroup( gd );
+ }
+ catch ( DataException e )
+ {
+ throw new ChartException( Activator.PLUGIN_ID,
+ ChartException.DATA_BINDING,
+ e );
+ }
+
+ return queryDefn;
+ }
+
+ /**
+ * Initialize default column bindings for original columns.
+ *
+ * @param queryDefn
+ * @throws DataException
+ */
+ private void initDefaultBindings( QueryDefinition queryDefn )
+ throws DataException
+ {
+
+ for(int i=0;i<columnsName.length;i++){
+ Binding colBinding = new Binding( columnsName[i] );
+ colBinding.setExpression( new ScriptExpression( ExpressionUtil.createDataSetRowExpression( columnsName[i]) ) );
+ queryDefn.addBinding( colBinding );
+ }
+ }
+
+ /**
+ * Create a new data engine.
+ *
+ * @return
+ * @throws BirtException
+ */
+ private static DataEngine newDataEngine( ) throws BirtException
+ {
+ DataEngineContext context = DataEngineContext.newInstance( DataEngineContext.DIRECT_PRESENTATION,null,(IDocArchiveReader) null,(IDocArchiveWriter) null);
+
+ // context.setTmpdir( this.getTempDir( ) );
+ DataEngine myDataEngine = DataEngine.newDataEngine( context );
+ return myDataEngine;
+ }
+
+ /**
+ * Create a new data set.
+ *
+ * @param dataSourceDesign
+ * @return
+ */
+ private OdaDataSetDesign newDataSet(
+ OdaDataSourceDesign dataSourceDesign )
+ {
+ OdaDataSetDesign dataSet = new OdaDataSetDesign( "Data Set1" ); //$NON-NLS-1$
+
+ dataSet.setDataSource( dataSourceDesign.getName( ) );
+ dataSet.setExtensionID( FlatFileDataSource.DATA_SET_TYPE );
+ dataSet.setQueryText( ffds.getQuery() );
+ return dataSet;
+ }
+
+ /**
+ * Create a new data source.
+ *
+ * @return
+ * @throws BirtException
+ */
+ private OdaDataSourceDesign newDataSource( ) throws BirtException
+ {
+ OdaDataSourceDesign dataSource = new OdaDataSourceDesign( "Data Source1" ); //$NON-NLS-1$
+ dataSource.setExtensionID( FlatFileDataSource.DATA_SOURCE_TYPE );
+ dataSource.addPrivateProperty( "HOME", ffds.HOME ); //$NON-NLS-1$
+ dataSource.addPrivateProperty( "CHARSET", FlatFileDataSource.CHARSET ); //$NON-NLS-1$
+ dataSource.addPrivateProperty( "DELIMTYPE", //$NON-NLS-1$
+ FlatFileDataSource.DELIMTYPE );
+ dataSource.addPrivateProperty( "INCLTYPELINE", //$NON-NLS-1$
+ FlatFileDataSource.INCLTYPELINE );
+ dataSource.addPrivateProperty( Constants.ODA_PROP_CONFIGURATION_ID,
+ dataSource.getExtensionID( )
+ + Constants.ODA_PROP_CONFIG_KEY_SEPARATOR
+ + dataSource.getName( ) );
+
+ return dataSource;
+ }
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/FlatFileDataSource.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/FlatFileDataSource.java
new file mode 100644
index 0000000000..c48cb3d6d9
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/FlatFileDataSource.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.dataengine;
+
+/**
+ * Resource of flat file data.
+ */
+public class FlatFileDataSource {
+ static final String DATA_SOURCE_TYPE = "org.eclipse.datatools.connectivity.oda.flatfile";
+ static final String DATA_SET_TYPE = "org.eclipse.datatools.connectivity.oda.flatfile.dataSet";
+ static final String CHARSET = "UTF-8";
+ static final String DELIMTYPE = "TAB";
+ static final String INCLTYPELINE = "NO";
+ protected String HOME = null;
+
+ protected String dataFile = "";
+ protected String query = "";
+ protected String[] columnsName = null;
+
+ public FlatFileDataSource(){
+ }
+
+ public FlatFileDataSource(String HOME,String dataFile,String query,String[] columns){
+ this.HOME = HOME;
+ this.dataFile = dataFile;
+ this.query = query;
+ this.columnsName = columns;
+ }
+
+ protected void setHOME_VARIABLE(String home){
+ HOME = home;
+ }
+
+ protected String getHOME(){
+ return HOME;
+ }
+
+ protected void setDataFile(String fileName){
+ dataFile = fileName;
+ }
+
+ protected String getDataFile(){
+ return dataFile;
+ }
+
+ protected void setQuery(String query){
+ this.query = query;
+ }
+
+ protected String getQuery(){
+ return query;
+ }
+
+ protected String[] getCOLUMNNAME(){
+ return columnsName;
+ }
+
+ protected void setCOLUMNName(String[] cn){
+ columnsName = cn;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/FlatFileDataSourceFactory.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/FlatFileDataSourceFactory.java
new file mode 100644
index 0000000000..5f5d4a8b0a
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/FlatFileDataSourceFactory.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.dataengine;
+
+public class FlatFileDataSourceFactory {
+ public FlatFileDataSourceFactory(){
+ }
+
+ public String createHomeVariable(){
+ return null;
+ }
+
+ public String createFileName(){
+ return null;
+
+ }
+
+ public String createQuery(){
+ return null;
+
+ }
+
+ public String[] createColumns(){
+ return null;
+ }
+
+ public FlatFileDataSource createFlatFileDataSource(){
+ return new FlatFileDataSource(createHomeVariable(),createFileName(),createQuery(),createColumns());
+ }
+
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/GroupedRowExpressionsEvaluator.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/GroupedRowExpressionsEvaluator.java
new file mode 100644
index 0000000000..b56d135bbc
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dataengine/GroupedRowExpressionsEvaluator.java
@@ -0,0 +1,280 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.dataviewers.charts.dataengine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.birt.chart.exception.ChartException;
+import org.eclipse.birt.chart.factory.AbstractGroupedDataRowExpressionEvaluator;
+import org.eclipse.birt.chart.log.ILogger;
+import org.eclipse.birt.chart.log.Logger;
+import org.eclipse.birt.core.exception.BirtException;
+import org.eclipse.birt.data.engine.api.IGroupDefinition;
+import org.eclipse.birt.data.engine.api.IResultIterator;
+
+/**
+ * The class implements an evaluator to retrieve grouped row data.
+ * @since 2.3
+ */
+public class GroupedRowExpressionsEvaluator extends
+ AbstractGroupedDataRowExpressionEvaluator
+{
+
+ private static ILogger sLogger = Logger.getLogger( "org.eclipse.birt.chart.examples/trace" ); //$NON-NLS-1$
+
+ private IResultIterator fResultIterator;
+
+ private boolean fIsGrouped = false;
+
+ private int fGroupCount;
+
+ private List[] faGroupBreaks;
+
+ private int fCountOfAvaiableRows = 0;
+
+ private boolean fHasAggregation = false;
+
+ /**
+ * Constructor.
+ *
+ * @param resultSet
+ * @param hasAggregation
+ * @param cm
+ * @throws ChartException
+ */
+ public GroupedRowExpressionsEvaluator( IResultIterator resultIterator,
+ boolean hasAggregation ) throws ChartException
+ {
+ fHasAggregation = hasAggregation;
+
+ fResultIterator = resultIterator;
+ List<IGroupDefinition> groupDefinitions = fResultIterator.getQueryResults( )
+ .getPreparedQuery( )
+ .getReportQueryDefn( )
+ .getGroups( );
+ if ( groupDefinitions != null && groupDefinitions.size( ) > 0 )
+ {
+ fIsGrouped = true;
+ fGroupCount = groupDefinitions.size( );
+
+ faGroupBreaks = new List[groupDefinitions.size( )];
+ for ( int i = 0; i < faGroupBreaks.length; i++ )
+ {
+ faGroupBreaks[i] = new ArrayList( );
+ }
+ }
+ }
+
+ /**
+ * Get list of group breaks, the group level is base on 0th index, 0 index
+ * means outermost group.
+ *
+ * @param groupLevel
+ * @return
+ */
+ private List getGroupBreaksList( int groupLevel )
+ {
+ if ( faGroupBreaks == null
+ || groupLevel < 0
+ || groupLevel > ( faGroupBreaks.length - 1 ) )
+ {
+ return new ArrayList( );
+ }
+
+ return faGroupBreaks[groupLevel];
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.birt.chart.factory.IGroupedDataResultSet#getGroupBreaks(int)
+ */
+ public int[] getGroupBreaks( int groupLevel )
+ {
+ Object[] breaksArray = getGroupBreaksList( groupLevel ).toArray( );
+ int[] breaks = new int[breaksArray.length];
+ for ( int i = 0; i < breaksArray.length; i++ )
+ {
+ breaks[i] = ( (Integer) breaksArray[i] ).intValue( );
+ }
+ return breaks;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.birt.chart.factory.IDataRowExpressionEvaluator#close()
+ */
+ public void close( )
+ {
+ try
+ {
+ fResultIterator.close( );
+ }
+ catch ( BirtException e )
+ {
+ sLogger.log( e );
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.birt.chart.factory.IDataRowExpressionEvaluator#evaluate(java.lang.String)
+ */
+ public Object evaluate( String expression )
+ {
+ try
+ {
+ // Here, the expression should be binding name.
+ return fResultIterator.getValue( expression );
+ }
+ catch ( BirtException e )
+ {
+ sLogger.log( e );
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.birt.chart.factory.IDataRowExpressionEvaluator#evaluateGlobal(java.lang.String)
+ */
+ public Object evaluateGlobal( String expression )
+ {
+ return evaluate( expression );
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.birt.chart.factory.IDataRowExpressionEvaluator#first()
+ */
+ public boolean first( )
+ {
+ try
+ {
+ fCountOfAvaiableRows = 0;
+
+ if ( !fIsGrouped )
+ {
+ if ( fResultIterator.next( ) )
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if ( findFirst( ) )
+ {
+ return true;
+ }
+ }
+ }
+ catch ( BirtException e )
+ {
+ sLogger.log( e );
+ }
+ return false;
+ }
+
+ /**
+ * Find the first row position.
+ *
+ * @return
+ * @throws BirtException
+ */
+ private boolean findFirst( ) throws BirtException
+ {
+ if ( !fResultIterator.next( ) )
+ {
+ return false;
+ }
+
+ int groupLevel = fResultIterator.getStartingGroupLevel( );
+ if ( groupLevel == 0 ) // It means the start of current row data.
+ {
+ return true;
+ }
+ else
+ {
+ return findFirst( );
+ }
+ }
+
+ /**
+ * Find next available row position. If it has grouped-enabled, should
+ * ignore non-grouped/non-aggregation row.
+ *
+ * @return
+ * @throws BirtException
+ */
+ private boolean findNext( ) throws BirtException
+ {
+ while ( fResultIterator.next( ) )
+ {
+ int startIndex = fResultIterator.getStartingGroupLevel( );
+ if ( startIndex > 0 && startIndex <= fGroupCount )
+ {
+ fCountOfAvaiableRows++;
+ // Add break point to current grouping.
+ getGroupBreaksList( startIndex - 1 ).add( new Integer( fCountOfAvaiableRows ) );
+ // Also the sub-groupings of current grouping should be
+ // added the break point.
+ for ( int i = startIndex; i < fGroupCount; i++ )
+ {
+ getGroupBreaksList( i ).add( new Integer( fCountOfAvaiableRows ) );
+ }
+
+ return true;
+ }
+
+ if ( !fHasAggregation )
+ {
+ fCountOfAvaiableRows++;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.birt.chart.factory.IDataRowExpressionEvaluator#next()
+ */
+ public boolean next( )
+ {
+ try
+ {
+ if ( !fIsGrouped )
+ {
+ if ( fResultIterator.next( ) )
+ {
+ fCountOfAvaiableRows++;
+ return true;
+ }
+ }
+ else
+ {
+ return findNext( );
+ }
+ }
+ catch ( BirtException e )
+ {
+ sLogger.log( e );
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dialogs/ChartDialog.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dialogs/ChartDialog.java
new file mode 100755
index 0000000000..76be33ee42
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/dialogs/ChartDialog.java
@@ -0,0 +1,427 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.dialogs;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField;
+import org.eclipse.linuxtools.dataviewers.charts.Activator;
+import org.eclipse.linuxtools.dataviewers.charts.ChartConstants;
+import org.eclipse.linuxtools.dataviewers.charts.provider.ChartFactory;
+import org.eclipse.linuxtools.dataviewers.charts.provider.IChartField;
+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.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * The dialog used to customize the chart before cerating it.
+ */
+public class ChartDialog extends Dialog {
+
+ private final AbstractSTViewer stViewer;
+ private Chart chart;
+
+ private Text errorMessageText;
+ private Button verticalBarsButton;
+ private Button pieChartButton;
+ private Button barGraphButton;
+ private Button okButton;
+ private List<Button> columnButtons;
+
+ /**
+ * The constructor
+ *
+ * @param shell
+ * @param stViewer
+ */
+ public ChartDialog(Shell shell, AbstractSTViewer stViewer)
+ {
+ super(shell);
+ this.stViewer = stViewer;
+ }
+
+ /**
+ * Restores the state of this dialog
+ */
+ public void restoreState() {
+ try {
+ IDialogSettings settings =
+ stViewer.getViewerSettings().getSection(ChartConstants.TAG_SECTION_BIRTCHARTS_STATE);
+ if (settings == null) {
+ settings = stViewer.getViewerSettings().addNewSection(ChartConstants.TAG_SECTION_BIRTCHARTS_STATE);
+ return;
+ }
+
+ for (int i=0; i<columnButtons.size(); i++) {
+ boolean selected = Boolean.parseBoolean(settings.get(ChartConstants.TAG_COLUMN_BUTTON_+i));
+ columnButtons.get(i).setSelection(selected);
+ }
+
+ boolean barGraph = Boolean.parseBoolean(settings.get(ChartConstants.TAG_BAR_GRAPH_BUTTON));
+ barGraphButton.setSelection(barGraph);
+ pieChartButton.setSelection(!barGraph);
+
+ boolean vBars = Boolean.parseBoolean(settings.get(ChartConstants.TAG_VERTICAL_BARS_BUTTON));
+ verticalBarsButton.setSelection(vBars);
+ verticalBarsButton.setEnabled(barGraph);
+ }
+ catch (Exception e) {}
+ }
+
+ /**
+ * Saves the state of this dialog
+ */
+ public void saveState() {
+ try {
+ IDialogSettings settings =
+ stViewer.getViewerSettings().getSection(ChartConstants.TAG_SECTION_BIRTCHARTS_STATE);
+ if (settings == null) {
+ settings = stViewer.getViewerSettings().addNewSection(ChartConstants.TAG_SECTION_BIRTCHARTS_STATE);
+ }
+
+ for (int i=0; i<columnButtons.size(); i++) {
+ boolean selected = columnButtons.get(i).getSelection();
+ settings.put(ChartConstants.TAG_COLUMN_BUTTON_+i, selected);
+ }
+
+ boolean barGraph = barGraphButton.getSelection();
+ settings.put(ChartConstants.TAG_BAR_GRAPH_BUTTON, barGraph);
+
+ boolean vBars = verticalBarsButton.getSelection();
+ settings.put(ChartConstants.TAG_VERTICAL_BARS_BUTTON, vBars);
+ }
+ catch (Exception e) {}
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("Create chart from selection...");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ chart = produceChart();
+ saveState();
+ } else {
+ chart = null;
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Cancel buttons by default
+ okButton = createButton(parent, IDialogConstants.OK_ID,
+ IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID,
+ IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ Control c = super.createContents(parent);
+ this.validateInput();
+ return c;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite)super.createDialogArea(parent);
+
+ Composite titleComp = new Composite(composite, SWT.NONE);
+ titleComp.setLayout(new RowLayout(SWT.HORIZONTAL));
+
+ Label icon = new Label(titleComp, SWT.NONE);
+ icon.setImage(Activator.getImage("icons/chart_icon.png"));
+
+ Label label = new Label(titleComp, SWT.WRAP);
+ label.setText("Chart builder");
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ titleComp.setLayoutData(data);
+
+ Group chartTypeGroup = new Group(composite, SWT.NONE);
+ data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL);
+ chartTypeGroup.setLayoutData(data);
+ chartTypeGroup.setLayout(new GridLayout(2, false));
+ chartTypeGroup.setText("Select your chart type");
+
+ ValidateSelectionListener listener = new ValidateSelectionListener();
+
+ barGraphButton = new Button(chartTypeGroup, SWT.RADIO);
+ barGraphButton.setText("Bar graph");
+ barGraphButton.addSelectionListener(listener);
+ barGraphButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ verticalBarsButton.setEnabled(barGraphButton.getSelection());
+ }
+ });
+ data = new GridData();
+ barGraphButton.setLayoutData(data);
+
+ verticalBarsButton = new Button(chartTypeGroup, SWT.CHECK);
+ verticalBarsButton.setText("Vertical bars");
+ data = new GridData();
+ verticalBarsButton.setLayoutData(data);
+
+ pieChartButton = new Button(chartTypeGroup, SWT.RADIO);
+ pieChartButton.setText("Pie chart");
+ pieChartButton.addSelectionListener(listener);
+ data = new GridData();
+ data.horizontalSpan = 2;
+ pieChartButton.setLayoutData(data);
+
+ Group chartColumnGroup = new Group(composite, SWT.NONE);
+ chartColumnGroup.setLayout(new GridLayout(1,true));
+ data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL);
+ chartColumnGroup.setLayoutData(data);
+ chartColumnGroup.setText("Select the columns(s) to show");
+
+ addColumnButtons(chartColumnGroup, listener);
+
+ errorMessageText = new Text(composite, SWT.READ_ONLY);
+ errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ errorMessageText.setBackground(errorMessageText.getDisplay()
+ .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+
+ applyDialogFont(composite);
+
+ setWidgetsValues();
+
+ return composite;
+ }
+
+ /**
+ * Sets the widgets values
+ */
+ private void setWidgetsValues() {
+ // set default values
+ barGraphButton.setSelection(ChartConstants.DEFAULT_BAR_GRAPH_BUTTON);
+ verticalBarsButton.setEnabled(barGraphButton.getSelection());
+ verticalBarsButton.setSelection(ChartConstants.DEFAULT_VERTICAL_BARS_BUTTON);
+ for (Button button : columnButtons) {
+ button.setSelection(ChartConstants.DEFAULT_COLUMN_BUTTON);
+ }
+
+ // restore state if there is one saved
+ restoreState();
+ }
+
+ /**
+ * Adds one check button for each column implementing the IChartField interface.
+ *
+ * @see IChartField
+ * @param comp
+ * @param listener
+ */
+ private void addColumnButtons(Composite comp, SelectionListener listener)
+ {
+ columnButtons = new LinkedList<Button>();
+ for (ISTDataViewersField field : stViewer.getAllFields())
+ {
+ if (field instanceof IChartField) {
+ IChartField cField = (IChartField)field;
+ Button b = new Button(comp,SWT.CHECK);
+ b.setText(cField.getColumnHeaderText());
+ b.setData(cField);
+ b.addSelectionListener(listener);
+ GridData dt = new GridData();
+ b.setLayoutData(dt);
+ columnButtons.add(b);
+ }
+ }
+
+ Label sep = new Label(comp, SWT.SEPARATOR|SWT.HORIZONTAL);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL);
+ sep.setLayoutData(data);
+ Composite buttonComposite = new Composite(comp,SWT.NONE);
+ data = new GridData();
+ buttonComposite.setLayoutData(data);
+ FillLayout l = new FillLayout();
+ l.spacing = 5;
+ buttonComposite.setLayout(l);
+
+ final Button b1 = new Button(buttonComposite, SWT.PUSH);
+ b1.setText("Select all");
+ final Button b2 = new Button(buttonComposite, SWT.PUSH);
+ b2.setText("Deselect all");
+ SelectionListener sl = new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ boolean b = (e.getSource() == b1);
+ for (Button button : columnButtons) {
+ button.setSelection(b);
+ }
+ validateInput();
+ }
+ };
+ b1.addSelectionListener(sl);
+ b2.addSelectionListener(sl);
+ }
+
+ /**
+ * Returns the Chart built by this dialog
+ *
+ * @return the chart
+ */
+ public Chart getValue() {
+ return chart;
+ }
+
+ /**
+ * Validates the input.
+ * <p>
+ * The default implementation of this framework method delegates the request
+ * to the supplied input validator object; if it finds the input invalid,
+ * the error message is displayed in the dialog's message line. This hook
+ * method is called whenever the text changes in the input field.
+ * </p>
+ */
+ protected void validateInput() {
+ String errorMessage = null;
+
+ int selectedNum = 0;
+ for (Button button : columnButtons) {
+ if (button.getSelection()) selectedNum++;
+ }
+
+ if (selectedNum == 0)
+ {
+ errorMessage = "No column selected";
+ }
+ /*else if (pieChartButton.getSelection() && selectedNum != 1)
+ {
+ errorMessage = "PieChart: Please select only one column";
+ }*/
+
+ // Bug 16256: important not to treat "" (blank error) the same as null
+ // (no error)
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Sets or clears the error message.
+ * If not <code>null</code>, the OK button is disabled.
+ *
+ * @param errorMessage
+ * the error message, or <code>null</code> to clear
+ * @since 3.0
+ */
+ public void setErrorMessage(String errorMessage) {
+ errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
+ okButton.setEnabled(errorMessage == null);
+ errorMessageText.getParent().update();
+ }
+
+ /**
+ * Build the chart from configuration
+ *
+ * @return a new chart
+ */
+ private Chart produceChart()
+ {
+ IStructuredSelection selection = (IStructuredSelection)stViewer.getViewer().getSelection();
+ if (selection == StructuredSelection.EMPTY) return null;
+ Object[] objects = selection.toArray();
+
+ ISTDataViewersField labelField = getLabelField(stViewer);
+
+
+ List<IChartField> selectedFields = new ArrayList<IChartField>();
+ for (Button button : columnButtons) {
+ if (button.getSelection()) {
+ selectedFields.add((IChartField)button.getData());
+ }
+ }
+ boolean barChartType = barGraphButton.getSelection();
+ boolean horizontalBars = !verticalBarsButton.getSelection();
+
+ if (barChartType) {
+ return ChartFactory.produceBarChart(objects, labelField, selectedFields, getBarChartTitle(),horizontalBars);
+ }
+ else {
+ return ChartFactory.producePieChart(objects, labelField, selectedFields);
+ }
+ }
+
+ private class ValidateSelectionListener extends SelectionAdapter
+ {
+ public void widgetSelected(SelectionEvent e) {
+ validateInput();
+ }
+ };
+
+ /**
+ * @param viewer
+ * @return the field used to provide the labels to the series
+ */
+ protected ISTDataViewersField getLabelField(AbstractSTViewer viewer) {
+ return viewer.getAllFields()[0];
+ }
+
+ protected String getBarChartTitle(){
+ return "Bar Chart";
+ }
+} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/ChartFactory.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/ChartFactory.java
new file mode 100755
index 0000000000..89b03100b0
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/ChartFactory.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.birt.chart.model.ChartWithAxes;
+import org.eclipse.birt.chart.model.ChartWithoutAxes;
+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.IntersectionType;
+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.ColorDefinitionImpl;
+import org.eclipse.birt.chart.model.attribute.impl.GradientImpl;
+import org.eclipse.birt.chart.model.attribute.impl.TooltipValueImpl;
+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.NumberDataSet;
+import org.eclipse.birt.chart.model.data.SeriesDefinition;
+import org.eclipse.birt.chart.model.data.TextDataSet;
+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.TextDataSetImpl;
+import org.eclipse.birt.chart.model.data.impl.TriggerImpl;
+import org.eclipse.birt.chart.model.impl.ChartWithAxesImpl;
+import org.eclipse.birt.chart.model.impl.ChartWithoutAxesImpl;
+import org.eclipse.birt.chart.model.layout.Legend;
+import org.eclipse.birt.chart.model.layout.Plot;
+import org.eclipse.birt.chart.model.type.BarSeries;
+import org.eclipse.birt.chart.model.type.PieSeries;
+import org.eclipse.birt.chart.model.type.impl.BarSeriesImpl;
+import org.eclipse.birt.chart.model.type.impl.PieSeriesImpl;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField;
+
+/**
+ * A utility class that handles the charts creation (pie chart & bar chart)
+ *
+ * @author Marzia Maugeri <marzia.maugeri@st.com>
+ *
+ */
+public class ChartFactory {
+
+ /**
+ * Produces a 3D pie chart from the input objects.
+ *
+ * @param objects the input data
+ * @param nameField the field used to get the labels of the objects (colored parts in the pie).
+ * @param valField the field providing the values for the pie parts.
+ * @return a new 3D pie chart
+ */
+ public static final Chart producePieChart(Object[] objects, ISTDataViewersField nameField, List<IChartField> valFields)
+ {
+ ChartWithoutAxes cwoaPie = ChartWithoutAxesImpl.create( );
+ cwoaPie.setSeriesThickness( 20 );
+ cwoaPie.setGridColumnCount( valFields.size());
+ cwoaPie.getBlock( ).setBackground( ColorDefinitionImpl.WHITE( ) );
+
+ //2D dimensional with DEPTH (birt DOESN'T SUPPORT 3D for Pie Chart)
+ cwoaPie.setDimension(ChartDimension.TWO_DIMENSIONAL_WITH_DEPTH_LITERAL);
+
+ // Plot
+ Plot p = cwoaPie.getPlot( );
+ p.getClientArea( ).setBackground( null );
+ p.getClientArea( ).getOutline( ).setVisible( true );
+ p.getOutline( ).setVisible( true );
+
+ // Legend
+ Legend lg = cwoaPie.getLegend( );
+ lg.getText( ).getFont( ).setSize( 16 );
+ lg.setBackground( null );
+ lg.getOutline( ).setVisible( true );
+
+ // Title
+ cwoaPie.getTitle( ).getLabel( ).getCaption( ).setValue( nameField.getColumnHeaderText());
+ cwoaPie.getTitle( ).getOutline( ).setVisible( true );
+
+ //Base Data Set
+ List<String> textLabels = new ArrayList<String>();
+ for (Object obj : objects) {
+ String label = nameField.getValue(obj);
+ textLabels.add(label);
+ }
+ TextDataSet categoryValues = TextDataSetImpl.create(textLabels );
+
+ // Base Series
+ Series seCategory = SeriesImpl.create( );
+ seCategory.setDataSet( categoryValues );
+
+ SeriesDefinition sdBase = SeriesDefinitionImpl.create( );
+ cwoaPie.getSeriesDefinitions( ).add( sdBase );
+ sdBase.getSeriesPalette( ).shift( -1 );
+ sdBase.getSeries( ).add( seCategory );
+
+ SeriesDefinition sdValue = SeriesDefinitionImpl.create( );
+ sdBase.getSeriesDefinitions( ).add( sdValue );
+
+
+ for (IChartField field : valFields) {
+ List<Double> doubleValues = new ArrayList<Double>();
+ for (Object obj : objects) {
+ doubleValues.add(field.getNumber(obj).doubleValue());
+ }
+
+ NumberDataSet Values = NumberDataSetImpl.create(doubleValues);
+
+ // Pie Series
+ PieSeries sePie = (PieSeries) PieSeriesImpl.create( );
+ sePie.setSeriesIdentifier( field.getColumnHeaderText());
+ sePie.setExplosion(3);
+ sePie.setDataSet( Values );
+
+ //Mouse over the Serie to Show Tooltips
+ setTriggering(sePie);
+
+ sdValue.getSeries( ).add( sePie);
+ }
+
+
+ return cwoaPie;
+ }
+
+ /**
+ * Produces a 2D bar chart from the input objects.
+ *
+ * @param objects the input data
+ * @param nameField the field used to get the labels of the objects (the labels of the series groups).
+ * @param valFields the fields providing the values for the different bars in a series group.
+ * @param horizontal if true the bars are displayed horizontally, else vertically.
+ * @return a new 2D bar chart
+ */
+
+ public static final Chart produceBarChart( Object[] objects, final ISTDataViewersField nameField, List<IChartField> valFields, String title,boolean horizontal)
+ {
+ ChartWithAxes cwaBar = ChartWithAxesImpl.create( );
+
+ // Plot
+ cwaBar.getBlock( ).setBackground( ColorDefinitionImpl.WHITE( ) );
+ Plot p = cwaBar.getPlot( );
+ p.getClientArea( )
+ .setBackground( GradientImpl.create( ColorDefinitionImpl.create( 225,
+ 225,
+ 255 ),
+ ColorDefinitionImpl.create( 255, 255, 225 ),
+ -35,
+ false ) );
+ p.getOutline( ).setVisible( true );
+
+ // Title
+ cwaBar.getTitle( ).getLabel( ).getCaption( ).setValue(title);
+ cwaBar.getTitle( ).getOutline( ).setVisible( true );
+
+ //Orientation
+ if (horizontal) cwaBar.setTransposed(true);
+
+ // Legend
+ Legend lg = cwaBar.getLegend( );
+ lg.getText( ).getFont( ).setSize( 16 );
+
+ // X-Axis
+ Axis xAxisPrimary = cwaBar.getPrimaryBaseAxes( )[0];
+ xAxisPrimary.getTitle( ).setVisible( true );
+ xAxisPrimary.setTitlePosition( Position.BELOW_LITERAL );
+ xAxisPrimary.setType( AxisType.TEXT_LITERAL );
+ xAxisPrimary.getMajorGrid( ).setTickStyle( TickStyle.BELOW_LITERAL );
+ xAxisPrimary.getOrigin( ).setType( IntersectionType.VALUE_LITERAL );
+ xAxisPrimary.setLabelPosition( Position.BELOW_LITERAL );
+ xAxisPrimary.getTitle().getCaption( ).setValue(nameField.getColumnHeaderText());
+
+ // Y-Axis
+ Axis yAxisPrimary = cwaBar.getPrimaryOrthogonalAxis( xAxisPrimary );
+ yAxisPrimary.getMajorGrid( ).setTickStyle( TickStyle.LEFT_LITERAL );
+
+
+ double max = -1D;
+ List<String> textLabels = new ArrayList<String>();
+ for (Object obj : objects) {
+ String label = nameField.getValue(obj);
+ textLabels.add(label);
+ }
+ TextDataSet categoryValues = TextDataSetImpl.create(textLabels );
+ SeriesDefinition sdY = SeriesDefinitionImpl.create( );
+ sdY.getSeriesPalette( ).shift( -1 );
+
+ yAxisPrimary.getSeriesDefinitions( ).add( sdY );
+
+ // Data Set
+ for (IChartField field : valFields) {
+ List<Double> doubleValues = new ArrayList<Double>();
+ for (Object obj : objects) {
+
+ Number num = field.getNumber(obj);
+ double longVal = num.doubleValue();
+ max = longVal > max ? longVal : max;
+ doubleValues.add(longVal);
+ }
+
+ NumberDataSet orthoValues = NumberDataSetImpl.create(doubleValues);
+ // Y-Series
+ BarSeries bs = (BarSeries) BarSeriesImpl.create( );
+ bs.setSeriesIdentifier( field.getColumnHeaderText() );
+ bs.setDataSet( orthoValues );
+ bs.setRiserOutline( null );
+
+ //Mouse over the Serie to Show Tooltips
+ setTriggering(bs);
+
+ sdY.getSeries( ).add( bs );
+ }
+
+ // X-Series
+ Series seCategory = SeriesImpl.create( );
+ seCategory.setDataSet( categoryValues );
+ SeriesDefinition sdX = SeriesDefinitionImpl.create( );
+ xAxisPrimary.getSeriesDefinitions( ).add( sdX );
+ sdX.getSeries( ).add( seCategory );
+
+ return cwaBar;
+ }
+
+ /**
+ * @param viewer
+ * @return the field used to provide the labels to the series
+ */
+ public ISTDataViewersField getLabelField(AbstractSTViewer viewer) {
+ return viewer.getAllFields()[0];
+ }
+
+ public static void setTriggering(Series series){
+ //Mouse over the Serie to Show Tooltips
+ Trigger tr = TriggerImpl.create(TriggerCondition.ONMOUSEOVER_LITERAL,
+ ActionImpl.create(ActionType.SHOW_TOOLTIP_LITERAL, TooltipValueImpl.create(200, null)));
+ series.getTriggers().add(tr);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/ChartUpdateNotifier.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/ChartUpdateNotifier.java
new file mode 100644
index 0000000000..c3504df881
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/ChartUpdateNotifier.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.provider;
+
+import org.eclipse.birt.chart.device.EmptyUpdateNotifier;
+import org.eclipse.birt.chart.device.ICallBackNotifier;
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.birt.chart.model.attribute.CallBackValue;
+import org.eclipse.swt.widgets.Canvas;
+
+/**
+ * @author Marzia Maugeri <marzia.maugeri@st.com>
+ */
+
+public class ChartUpdateNotifier extends EmptyUpdateNotifier implements ICallBackNotifier{
+ private Canvas preview = null;
+
+ public ChartUpdateNotifier(Canvas preview,Chart designModel, Chart runtimeModel) {
+ super(designModel, runtimeModel);
+ this.preview = preview;
+ }
+
+ public Object peerInstance( )
+ {
+ return preview;
+ }
+
+ @Override
+ public void callback(Object event, Object source, CallBackValue value) {
+
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/IChartField.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/IChartField.java
new file mode 100755
index 0000000000..967c58bcfc
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/provider/IChartField.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.provider;
+
+import org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField;
+
+/**
+ * The interface used by the charts to get a <code>Number</code> data from a field.
+ *
+ * @author Marzia Maugeri <marzia.maugeri@st.com>
+ *
+ */
+public interface IChartField extends ISTDataViewersField {
+
+ /**
+ * Returns the number to display in the chart for this object.
+ *
+ * @param obj
+ * @return the corresponding number value
+ */
+ public Number getNumber(Object obj);
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/view/ChartView.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/view/ChartView.java
new file mode 100755
index 0000000000..a13ce8f8a8
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/view/ChartView.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.view;
+
+
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.linuxtools.dataviewers.charts.Activator;
+import org.eclipse.linuxtools.dataviewers.charts.actions.SaveChartAction;
+import org.eclipse.linuxtools.dataviewers.charts.actions.SaveXMLAction;
+import org.eclipse.linuxtools.dataviewers.charts.viewer.ChartViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * The chart view.
+ *
+ * <br/>This view is multiple and all the created chart will be displayed in an instance of this view.
+ * Each one will have a primary id equals to ChartView.VIEW_ID and an integer (increased by 1 at each new view) for the secondary id.
+ *
+ * @author Marzia Maugeri <marzia.maugeri@st.com>
+ *
+ */
+public class ChartView extends ViewPart {
+
+ /** The primary id of this view */
+ public static final String VIEW_ID = "org.eclipse.linuxtools.dataviewers.charts.view";
+
+ /** The current secondary id for these views */
+ private static Integer SEC_ID = 0;
+
+ private Canvas paintCanvas;
+
+ private ChartViewer chartViewer;
+
+ private SaveChartAction saveChartAction;
+
+ private SaveXMLAction saveXMLAction;
+
+
+
+ /**
+ * Create and open a new chart view
+ * <br/>
+ * <br/><u><b>Note</b></u>: this method uses the UI thread to open the view and then it sets the input chart.
+ * The UI thread execution is synchronized on internal Integer SEC_ID which is the secondary id of the chart view.
+ * Each new chart view has a secondary id equal to SEC_ID++.
+ *
+ * @param chart
+ */
+ public static void createChartView(final Chart chart) {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ try {
+ synchronized(SEC_ID) {
+ ChartView view = (ChartView)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(VIEW_ID, ""+(SEC_ID++), IWorkbenchPage.VIEW_ACTIVATE);
+ view.setChart(chart);
+
+ }
+ } catch (PartInitException e) {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ e.getMessage(),
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+ });
+
+
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createPartControl(Composite parent) {
+ try {
+ paintCanvas = new Canvas( parent, SWT.BORDER );
+ paintCanvas.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+ paintCanvas.setBackground( Display.getDefault( )
+ .getSystemColor( SWT.COLOR_WHITE ) );
+ chartViewer = new ChartViewer( );
+ paintCanvas.addPaintListener( chartViewer );
+ paintCanvas.addControlListener( chartViewer );
+ chartViewer.setViewer( paintCanvas );
+
+
+ createActions(parent);
+ IActionBars actionBars = getViewSite().getActionBars();
+ initToolBar(actionBars.getToolBarManager());
+
+ } catch (Throwable _)
+ {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ "Error when creating AWT Frame...",
+ _);
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+
+ protected void createActions(Composite parent) {
+ saveChartAction = new SaveChartAction(getViewSite().getShell(),this);
+ saveXMLAction = new SaveXMLAction(parent);
+ //openChartAction = new OpenChartAction(getViewSite().getShell(),this);
+ }
+
+ protected void initToolBar(IToolBarManager manager) {
+ manager.add(saveChartAction);
+ manager.add(saveXMLAction);
+ //manager.add(openChartAction);
+ manager.update(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ if (paintCanvas != null) {
+ paintCanvas.setFocus();
+ } else {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ "Error setting the focus to the chart view: main composite is not set!");
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+
+ /**
+ * Close this view
+ * <br/>
+ * <br/><u><b>Note</b></u>: it uses the UI thread to get the workbench window. Then it closes the view.
+ */
+ public void closeView() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView(ChartView.this);
+ }
+ });
+ }
+
+ /**
+ * Set the chart in this view
+ *
+ * @param chart
+ */
+ public void setChart(Chart chart) {
+ if (chart != null) {
+ chartViewer.renderModel(chart);
+ saveChartAction.setChart(chart);
+ saveChartAction.setBounds(chartViewer.getBounds());
+ saveXMLAction.setChart(chart);
+
+ } else {
+ saveChartAction.setEnabled(false);
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ "Error adding the chart to the chart view: SWT is not set!");
+ Activator.getDefault().getLog().log(s);
+ }
+ }
+
+ public ChartViewer getChartViewer(){
+ return chartViewer;
+ }
+
+ public void setChartViewer(ChartViewer cv){
+ chartViewer = cv;
+ }
+
+ public void dispose( )
+ {
+ super.dispose( );
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/viewer/ChartViewer.java b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/viewer/ChartViewer.java
new file mode 100755
index 0000000000..447644c9cc
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.dataviewers.charts/src/org/eclipse/linuxtools/dataviewers/charts/viewer/ChartViewer.java
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.dataviewers.charts.viewer;
+
+import org.eclipse.birt.chart.device.IDeviceRenderer;
+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.model.Chart;
+import org.eclipse.birt.chart.model.attribute.Bounds;
+import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
+import org.eclipse.birt.chart.util.PluginSettings;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.dataviewers.charts.Activator;
+import org.eclipse.linuxtools.dataviewers.charts.actions.ChartActionRenderer;
+import org.eclipse.linuxtools.dataviewers.charts.provider.ChartUpdateNotifier;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+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.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ *
+ * @author Marzia Maugeri <marzia.maugeri@st.com>
+ *
+ */
+public class ChartViewer implements PaintListener, ControlListener
+{
+
+ private transient Canvas preview = null;
+
+ private Chart cm = null;
+
+ private transient boolean bIsPainting = false;
+
+ private transient Image buffer;
+
+ private static int X_OFFSET = 3;
+
+ private static int Y_OFFSET = 3;
+
+ private GeneratedChartState gcs = null;
+
+ private IDeviceRenderer deviceRenderer = null;
+
+ private Bounds bo;
+
+ public ChartViewer( )
+ {
+ try {
+ deviceRenderer = PluginSettings.instance( ).getDevice( "dv.SWT" );
+ } catch (ChartException e) {
+ Status s = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ Status.ERROR,
+ e.getMessage(),
+ e);
+ Activator.getDefault().getLog().log(s);
+ }
+
+ }
+ /**
+ * @param cm
+ * Chart Model
+ */
+ public void renderModel( Chart cm )
+ {
+ this.cm = cm;
+
+ if ( preview != null && !preview.isDisposed( ) )
+ {
+ updateBuffer( );
+ preview.redraw( );
+ }
+ }
+
+ public Bounds getBounds()
+ {
+ return bo;
+ }
+
+ public Chart getChart(){
+ return cm;
+ }
+
+ /**
+ * Generate and render the chart model,the chart image is stored in a
+ * buffer. The buffer will be updated only when the chart model is changed.
+ */
+ private void updateBuffer( )
+ {
+ if ( bIsPainting )
+ {
+ return;
+ }
+ Throwable paintError = null;
+
+ Rectangle re = preview.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 gc = new GC( buffer );
+
+ // fill default background as white.
+ gc.setForeground( Display.getDefault( )
+ .getSystemColor( SWT.COLOR_WHITE ) );
+ gc.fillRectangle( buffer.getBounds( ) );
+
+ bo = BoundsImpl.create( X_OFFSET,
+ Y_OFFSET,
+ adjustedRe.width - 2 * X_OFFSET,
+ adjustedRe.height - 2 * Y_OFFSET );
+
+
+ try
+ {
+ deviceRenderer.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT,gc );
+
+ bo.scale( 72d / deviceRenderer.getDisplayServer( )
+ .getDpiResolution( ) ); // CONVERT TO POINTS
+
+ // GENERATE AND RENDER THE CHART
+ final Generator gr = Generator.instance( );
+
+ gcs = gr.build(deviceRenderer.getDisplayServer( ), cm, bo, null, null, null);
+ gcs.getRunTimeContext().setActionRenderer( new ChartActionRenderer());
+ deviceRenderer.setProperty(IDeviceRenderer.UPDATE_NOTIFIER,
+ new ChartUpdateNotifier(preview,cm, gcs.getChartModel()));
+ gr.render(deviceRenderer, gcs);
+ }
+ catch ( Exception ex )
+ {
+ paintError = ex;
+ }
+
+ if ( paintError != null )
+ {
+ buffer = oldBuffer;
+ }
+ if ( oldBuffer != null && oldBuffer != buffer )
+ {
+ oldBuffer.dispose( );
+ }
+ bIsPainting = false;
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
+ */
+ public void paintControl( PaintEvent pe )
+ {
+ GC gc = pe.gc;
+ if ( buffer != null )
+ {
+ gc.drawImage( buffer, 0, 0 );
+ }
+ }
+
+ /**
+ * Set the preview canvas.
+ *
+ * @param paintCanvas
+ */
+ public void setViewer( Canvas paintCanvas )
+ {
+ this.preview = paintCanvas;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ControlListener#controlMoved(org.eclipse.swt.events.ControlEvent)
+ */
+ public void controlMoved( ControlEvent e )
+ {
+ if ( preview != null && !preview.isDisposed( ) )
+ {
+ updateBuffer( );
+ preview.redraw( );
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ControlListener#controlResized(org.eclipse.swt.events.ControlEvent)
+ */
+ public void controlResized( ControlEvent e )
+ {
+ if ( preview != null && !preview.isDisposed( ) )
+ {
+ updateBuffer( );
+ preview.redraw( );
+ }
+ }
+
+ public void setBuffer(Image buffer){
+ this.buffer = buffer;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov-feature/.project b/gcov/org.eclipse.linuxtools.gcov-feature/.project
new file mode 100755
index 0000000000..922960597b
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov-feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.gcov-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/gcov/org.eclipse.linuxtools.gcov-feature/build.properties b/gcov/org.eclipse.linuxtools.gcov-feature/build.properties
new file mode 100755
index 0000000000..804860c5ac
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov-feature/build.properties
@@ -0,0 +1,8 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ epl-v10.html,\
+ license.html
+src.includes = feature.xml,\
+ feature.properties,\
+ epl-v10.html,\
+ license.html
diff --git a/gcov/org.eclipse.linuxtools.gcov-feature/epl-v10.html b/gcov/org.eclipse.linuxtools.gcov-feature/epl-v10.html
new file mode 100755
index 0000000000..9321f4082e
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov-feature/epl-v10.html
@@ -0,0 +1,256 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Eclipse Public License - Version 1.0</title>
+
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style></head><body lang="EN-US">
+
+<p align="center"><b>Eclipse Public License - v 1.0</b></p>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body></html> \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov-feature/feature.properties b/gcov/org.eclipse.linuxtools.gcov-feature/feature.properties
new file mode 100755
index 0000000000..be4bda4917
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov-feature/feature.properties
@@ -0,0 +1,138 @@
+#*******************************************************************************
+# 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, Inc. - initial API and implementation
+#********************************************************************************
+featureName=GCov Integration (Incubation)
+description=Functionality to integrate GCov with the workbench.
+featureProvider=Eclipse Linux Tools
+copyright=Copyright 2009, 2010 Red Hat, Inc.
+licenseURL=license.html
+license=\
+Eclipse Foundation Software User Agreement\n\
+April 14, 2010\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
diff --git a/gcov/org.eclipse.linuxtools.gcov-feature/feature.xml b/gcov/org.eclipse.linuxtools.gcov-feature/feature.xml
new file mode 100755
index 0000000000..72a9463a80
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov-feature/feature.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.linuxtools.gcov"
+ label="%featureName"
+ version="0.4.1.qualifier"
+ provider-name="%featureProvider">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="Linux Tools Update Site" url="http://download.eclipse.org/technology/linuxtools/update"/>
+ </url>
+
+ <plugin
+ id="org.eclipse.linuxtools.gcov"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.binutils"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.dataviewers"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.dataviewers.charts"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.dataviewers.annotatedsourceeditor"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/gcov/org.eclipse.linuxtools.gcov-feature/license.html b/gcov/org.eclipse.linuxtools.gcov-feature/license.html
new file mode 100644
index 0000000000..c184ca36a9
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov-feature/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/.classpath b/gcov/org.eclipse.linuxtools.gcov.test/.classpath
new file mode 100644
index 0000000000..1ca8caa222
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry excluding="**/.svn/**" kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/.project b/gcov/org.eclipse.linuxtools.gcov.test/.project
new file mode 100644
index 0000000000..ea8b6fd7b9
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.gcov.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/.settings/org.eclipse.jdt.core.prefs b/gcov/org.eclipse.linuxtools.gcov.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..4ec955916f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Fri Jan 16 09:19:58 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/META-INF/MANIFEST.MF b/gcov/org.eclipse.linuxtools.gcov.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..7340221115
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.gcov.test
+Bundle-Version: 4.1.1.qualifier
+Bundle-Vendor: %bundleProvider
+Fragment-Host: org.eclipse.linuxtools.gcov
+Require-Bundle: org.junit
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/about.html b/gcov/org.eclipse.linuxtools.gcov.test/about.html
new file mode 100644
index 0000000000..0c6525d9a8
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/about.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>24th October, 2008</p>
+<h3>License</h3>
+<p>The Eclipse Software Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<h3>Contributions</h3>
+
+<p>If this Content is licensed to you under the terms and conditions of the EPL, any Contributions, as defined in the EPL, uploaded, submitted, or otherwise
+made available to the Eclipse Foundation, its members and/or the host of the Eclipse Foundation web site, by you that relate to such
+Content are provided under the terms and conditions of the <a href="http://www.eclipse.org/legal/termsofuse.html">Terms of Use</a>
+for the Eclipse Foundation web site and can be made available to others under the terms of the licenses as set out in the
+<a href="http://www.eclipse.org/legal/termsofuse.html">Terms of Use</a>.</p>
+
+<p>If this Content is licensed to you under license terms and conditions other than the EPL (&quot;Other License&quot;), any modifications, enhancements and/or
+other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to the Eclipse Foundation, its members and/or the
+host of the Eclipse Foundation web site, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
+to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
+providing the Modifications under the terms and conditions of the <a href="http://www.eclipse.org/legal/termsofuse.html">Terms of Use</a>
+for the Eclipse Foundation web site and such Modifications can be made available to others under the terms of the licenses as set out in the
+<a href="http://www.eclipse.org/legal/termsofuse.html">Terms of Use</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/build.properties b/gcov/org.eclipse.linuxtools.gcov.test/build.properties
new file mode 100644
index 0000000000..e70eafab1d
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ test.xml,\
+ plugin.properties,\
+ test_c/,\
+ test_cpp/,\
+ about.html
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/plugin.properties b/gcov/org.eclipse.linuxtools.gcov.test/plugin.properties
new file mode 100644
index 0000000000..cec757f7d2
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/plugin.properties
@@ -0,0 +1,12 @@
+#******************************************************************************
+# Copyright (c) 2009 STMicroelectronics.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+#*******************************************************************************
+bundleProvider = Eclipse Linux Tools
+bundleName = Gcov Test Plug-in (Incubation) \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/AllGcovTests.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/AllGcovTests.java
new file mode 100755
index 0000000000..b44f96ab5a
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/AllGcovTests.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllGcovTests {
+
+ public static Test suite() {
+ TestSuite ats = new TestSuite("Tests for org.eclipse.linuxtools.gcov.test");
+ //$JUnit-BEGIN$
+ ats.addTest(GcovGCDARetrieverTest.suite());
+ ats.addTest(GcovParserTest.suite());
+// Comment out until we fix bug #299995
+// ats.addTest(GcovViewTest.suite());
+ //$JUnit-END$
+ return ats;
+ }
+
+} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovGCDARetrieverTest.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovGCDARetrieverTest.java
new file mode 100755
index 0000000000..92f2ee1252
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovGCDARetrieverTest.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.test;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.gcov.parser.CovManager;
+
+public class GcovGCDARetrieverTest extends TestCase {
+
+ public GcovGCDARetrieverTest() {
+ }
+
+ public static Test suite() {
+ TestSuite ats = new TestSuite("Gcov:GCDA_Retriever");
+ File[] testDirs = STJunitUtils.getTestDirs(Activator.PLUGIN_ID + ".test", "test.*");
+ for (File testDir : testDirs) {
+ final String[] covFiles = GcovTestUtils.getGCDANames(testDir);
+ final File binaryFile = GcovTestUtils.getBinary(testDir);
+ ats.addTest(
+ new TestCase(testDir.getName() + ":GCDA_Retriever") {
+ public void runTest() throws Throwable {
+ testGcdaRetriever(binaryFile, covFiles);
+ }
+ }
+ );
+ }
+ return ats;
+ }
+
+
+ public static void testGcdaRetriever(
+ File binaryFile, String[] covFilesPaths)
+ throws Exception {
+ CovManager covManager = new CovManager(binaryFile.getAbsolutePath());
+ List<String> list = covManager.getGCDALocations();
+ String[] generatedCovFilesPath = new String[list.size()];
+ int index = 0;
+ for (String string : list) {
+ int i = string.lastIndexOf('/');
+ string = string.substring(i+1);
+ i = string.lastIndexOf('\\');
+ string = string.substring(i+1);
+ generatedCovFilesPath[index] = string;
+ index++;
+ }
+ Arrays.sort(generatedCovFilesPath);
+ boolean b = Arrays.equals(generatedCovFilesPath, covFilesPaths);
+ Assert.assertEquals("May be normal if binary not complied with gcov options", true, b);
+ }
+
+} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovParserTest.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovParserTest.java
new file mode 100755
index 0000000000..1c0b5c6096
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovParserTest.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.test;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.gcov.parser.CovManager;
+
+public class GcovParserTest extends TestCase {
+
+ public GcovParserTest() {
+ }
+
+
+ public static Test suite() {
+ TestSuite ats = new TestSuite("Gcov:Parser");
+ File[] testDirs = STJunitUtils.getTestDirs(Activator.PLUGIN_ID + ".test", "test.*");
+ for (File testDir : testDirs) {
+ final List<String> covPaths = GcovTestUtils.getGCDAPath(testDir);
+ final File binaryFile = GcovTestUtils.getBinary(testDir);
+ final File parserRefFile = new File(testDir, "testProcessCovFiles.ref");
+ final File parserDumpFile = new File(testDir, "testProcessCovFiles.dump");
+ ats.addTest(
+ new TestCase(testDir.getName() + ":Parser") {
+ public void runTest() throws Throwable {
+ testGcovParsing(binaryFile, covPaths, parserRefFile, parserDumpFile);
+ }
+ }
+ );
+ }
+ return ats;
+ }
+
+ public static void testGcovParsing(
+ File binaryFile, List<String> covFilesPaths,
+ File parserRefFile, File parserDumpFile)
+ throws Exception {
+ CovManager covManager = new CovManager(binaryFile.getAbsolutePath());
+ covManager.processCovFiles(covFilesPaths);
+ covManager.dumpProcessCovFilesResult(new PrintStream(parserDumpFile));
+ STJunitUtils.compareIgnoreEOL(parserDumpFile.getAbsolutePath(), parserRefFile.getAbsolutePath(), true);
+ }
+
+} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovTestUtils.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovTestUtils.java
new file mode 100755
index 0000000000..bd128bd383
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovTestUtils.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.test;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Assert;
+
+public class GcovTestUtils {
+ public static final String GCOV_FILE_SUFFIX = ".gcda";
+ public static final String GCOV_BINARY_FILE_SUFFIX = ".out";
+ public static final String GCOV_DIRECTORY_SUFFIX = "_gcov_input";
+
+ public static String[] getGCDANames(File directory) {
+ String[] covFiles = directory.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(GCOV_FILE_SUFFIX);
+ }
+ });
+ Arrays.sort(covFiles);
+ return covFiles;
+ }
+
+ public static File[] getGCDA(File directory) {
+ File[] covFiles = directory.listFiles(new FileFilter() {
+ public boolean accept(File arg0) {
+ return ( arg0.isDirectory() == false && arg0.getName().endsWith(GCOV_FILE_SUFFIX));
+ }
+ });
+ Arrays.sort(covFiles);
+ return covFiles;
+ }
+
+ public static List<String> getGCDAPath(File directory) {
+ File[] covFiles = getGCDA(directory);
+ final List<String> covPaths = new ArrayList<String>(covFiles.length);
+ for (File file : covFiles) {
+ covPaths.add(file.getAbsolutePath());
+ }
+ return covPaths;
+ }
+
+ public static File getBinary(File directory) {
+ File[] binaries = directory.listFiles(new FileFilter() {
+ public boolean accept(File arg1) {
+ return ( !arg1.isDirectory() && arg1.getName().endsWith(GCOV_BINARY_FILE_SUFFIX));
+ }
+ });
+ Assert.assertEquals(1, binaries.length);
+ return binaries[0];
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovViewTest.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovViewTest.java
new file mode 100755
index 0000000000..a49fcd1023
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/GcovViewTest.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.test;
+
+import java.io.File;
+import java.util.List;
+import java.util.Locale;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.gcov.action.SwitchContentProviderAction;
+import org.eclipse.linuxtools.gcov.parser.CovManager;
+import org.eclipse.linuxtools.gcov.view.CovFileContentProvider;
+import org.eclipse.linuxtools.gcov.view.CovFolderContentProvider;
+import org.eclipse.linuxtools.gcov.view.CovFunctionContentProvider;
+import org.eclipse.linuxtools.gcov.view.CovView;
+
+public class GcovViewTest extends TestCase {
+
+ public GcovViewTest() {
+ }
+
+ public static Test suite() {
+ TestSuite emptyTestSuite = new TestSuite();
+ return emptyTestSuite;
+// Comment out until we fix bug #299995
+// TestSuite ats = new TestSuite("GCov:View");
+// File[] testDirs = STJunitUtils.getTestDirs(Activator.PLUGIN_ID + ".test", "test.*");
+//
+// for (File testDir : testDirs) {
+// final List<String> covFilesPaths = GcovTestUtils.getGCDAPath(testDir);
+// final File binary = GcovTestUtils.getBinary(testDir);
+// final File folderRefFile = new File(testDir, "testViewFolder.ref");
+// final File folderDumpFile = new File(testDir, "testViewFolder.dump");
+// final File fileRefFile = new File(testDir, "testView.ref");
+// final File fileDumpFile = new File(testDir, "testView.dump");
+// final File functionRefFile = new File(testDir, "testViewFunction.ref");
+// final File functionDumpFile = new File(testDir, "testViewFunction.dump");
+// ats.addTest(
+// new TestCase(testDir.getName() + ":CSV-DIRECTORY") {
+// public void runTest() throws Throwable {
+// testView(
+// covFilesPaths, binary,
+// CovFolderContentProvider.sharedInstance,
+// folderRefFile, folderDumpFile
+// );
+// }
+// }
+// );
+// ats.addTest(
+// new TestCase(testDir.getName() + ":CSV-FILE") {
+// public void runTest() throws Throwable {
+// testView(
+// covFilesPaths, binary,
+// CovFileContentProvider.sharedInstance,
+// fileRefFile, fileDumpFile
+// );
+// }
+// }
+// );
+// ats.addTest(
+// new TestCase(testDir.getName() + ":CSV-FUNCTION") {
+// public void runTest() throws Throwable {
+// testView(
+// covFilesPaths, binary,
+// CovFunctionContentProvider.sharedInstance,
+// functionRefFile, functionDumpFile
+// );
+// }
+// }
+// );
+// }
+// return ats;
+ }
+
+
+ public static void testView(
+ List<String> covFilesPaths, File binaryFile,
+ ITreeContentProvider provider,
+ File refFile, File dumpFile) throws Exception {
+ Locale.setDefault( Locale.US );
+ CovManager cvrgeMnger = new CovManager(binaryFile.getAbsolutePath());
+ cvrgeMnger.processCovFiles(covFilesPaths);
+ // generate model for view
+ cvrgeMnger.fillGcovView();
+ //load an Eclipse view
+ CovView cvrgeView = CovView.displayCovResults(cvrgeMnger);
+
+ SwitchContentProviderAction action = new SwitchContentProviderAction(
+ "test", "icons/directory_obj.gif",
+ cvrgeView.getSTViewer().getViewer(),
+ provider
+ );
+ action.run();
+ STJunitUtils.testCSVExport(cvrgeView, dumpFile.getAbsolutePath(), refFile.getAbsolutePath());
+
+ }
+
+} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/STJunitUtils.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/STJunitUtils.java
new file mode 100755
index 0000000000..39cdeeea99
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/gcov/test/STJunitUtils.java
@@ -0,0 +1,267 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.test;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.LineNumberReader;
+import java.net.URL;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView;
+import org.eclipse.linuxtools.dataviewers.abstractviewers.STDataViewersCSVExporter;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * This class only contains some tools to facilitate tests
+ * (compare)
+ * @author Xavier Raynaud <xavier.raynaud@st.com>
+ */
+public class STJunitUtils {
+
+
+ /**
+ * Test CSV export of the given view
+ * @param view
+ * @param dumpFullFileName
+ * @param refFullFileName
+ */
+ public static void testCSVExport(AbstractSTDataView view, String dumpFullFileName, String refFullFileName) {
+ STDataViewersCSVExporter exporter = new STDataViewersCSVExporter(view.getSTViewer());
+ exporter.exportTo(dumpFullFileName, new NullProgressMonitor());
+ // compare with ref
+ compareCSVIgnoreEOL(dumpFullFileName, refFullFileName, true);
+ }
+
+ /**
+ * Utility method to compare files
+ * @param dumpFile
+ * @param refFile
+ */
+ public static boolean compare(String dumpFile, String refFile, boolean deleteDumpFileIfOk) {
+ String message = "Comparing ref file ("+refFile+ ")and dump file (" +
+ dumpFile+")";
+ boolean equals = false;
+ System.out.println(message);
+ try {
+ InputStream is1 = new FileInputStream(dumpFile);
+ InputStream is2 = new FileInputStream(refFile);
+ equals = compare(is1, is2);
+ if (!equals) {
+ System.out.println(message + "... FAILED");
+ junit.framework.Assert.assertEquals(message + ": not correspond ", true, false);
+ }
+ else {
+ System.out.println(message + "... successful");
+ }
+ // delete dump only for successful tests
+ if (equals && deleteDumpFileIfOk)
+ new File(dumpFile).delete();
+ }catch (FileNotFoundException _) {
+ message += "... FAILED: One of these files may not exist";
+ System.out.println(message);
+ junit.framework.Assert.assertNull(message, _);
+ }
+ catch (Exception _) {
+ message += ": exception raised ... FAILED";
+ System.out.println(message);
+ junit.framework.Assert.assertNull(message, _);
+ }
+ return equals;
+ }
+
+ /**
+ * Utility method to compare files
+ * @param dumpFile
+ * @param refFile
+ * @return
+ */
+ public static boolean compareIgnoreEOL(String dumpFile, String refFile, boolean deleteDumpFileIfOk) {
+ String message = "Comparing ref file ("+refFile+ ")and dump file (" +
+ dumpFile+")";
+ boolean equals = false;
+ try {
+ LineNumberReader is1 = new LineNumberReader(new FileReader(dumpFile));
+ LineNumberReader is2 = new LineNumberReader(new FileReader(refFile));
+ do {
+ String line1 = is1.readLine();
+ String line2 = is2.readLine();
+ if (line1 == null) {
+ if (line2 == null) {
+ equals = true;
+ }
+ break;
+ } else if (line2 == null || !line1.equals(line2)) {
+ break;
+ }
+ } while (true);
+
+ if (!equals) {
+ junit.framework.Assert.assertEquals(message + ": not correspond ", true, false);
+ }
+
+ is1.close();
+ is2.close();
+ // delete dump only for successful tests
+ if (equals && deleteDumpFileIfOk) {
+ new File(dumpFile).delete();
+ }
+ }catch (FileNotFoundException _) {
+ message += "... FAILED: One of these files may not exist";
+ junit.framework.Assert.assertNull(message, _);
+ }
+ catch (Exception _) {
+ message += ": exception raised ... FAILED";
+ junit.framework.Assert.assertNull(message, _);
+ }
+ return equals;
+ }
+
+ /**
+ * Utility method to compare exported CSV files
+ * @param dumpFile
+ * @param refFile
+ * @return
+ */
+ public static boolean compareCSVIgnoreEOL(String dumpFile, String refFile, boolean deleteDumpFileIfOk) {
+ String message = "Comparing ref file ("+refFile+ ")and dump file (" +
+ dumpFile+")";
+ boolean equals = false;
+ String str = "[in-charge]"; // this string can be dumped according to binutils version installed on local machine
+
+ try {
+ LineNumberReader is1 = new LineNumberReader(new FileReader(dumpFile));
+ LineNumberReader is2 = new LineNumberReader(new FileReader(refFile));
+ do {
+ String line1 = is1.readLine();
+ String line2 = is2.readLine();
+ int length = str.length();
+ if (line1 == null) {
+ if (line2 == null) {
+ equals = true;
+ }
+ break;
+ } else if (line1.contains(str)){
+ int idx = line1.indexOf("[in-charge]");
+ char c = line1.charAt(idx -1);
+ if (c == ' ' ){
+ idx--;
+ length++;
+ }
+ line1 = line1.substring(0, idx) + line1.substring(idx+length, line1.length());
+ if (!line1.equals(line2))
+ break;
+ } else if (line2 == null || !line1.equals(line2)) {
+ break;
+ }
+ } while (true);
+
+ if (!equals) {
+ junit.framework.Assert.assertEquals(message + ": not correspond ", true, false);
+ }
+
+ is1.close();
+ is2.close();
+ // delete dump only for successful tests
+ if (equals && deleteDumpFileIfOk) {
+ new File(dumpFile).delete();
+ }
+ }catch (FileNotFoundException _) {
+ message += "... FAILED: One of these files may not exist";
+ junit.framework.Assert.assertNull(message, _);
+ }
+ catch (Exception _) {
+ message += ": exception raised ... FAILED";
+ junit.framework.Assert.assertNull(message, _);
+ }
+ return equals;
+ }
+
+ /**
+ * Utility method to compare Input streams
+ * @param ISdump
+ * @param ISref
+ * @return
+ * @throws IOException
+ */
+ public static boolean compare(InputStream ISdump, InputStream ISref) throws IOException {
+ try {
+ boolean equals = false;
+ do {
+ int char1 = ISdump.read();
+ int char2 = ISref.read();
+ if (char1 != char2)
+ break;
+ if (char1 == -1) {
+ equals = true;
+ break;
+ }
+ } while (true);
+ return equals;
+ } finally {
+ ISdump.close();
+ ISref.close();
+ }
+ }
+
+ /**
+ * Gets the absolute path of a resource in the given plugin
+ * @param pluginId
+ * @param relativeName
+ * @return an absolute path to a file
+ */
+ public static String getAbsolutePath(String pluginId, String relativeName) {
+ Bundle b = Platform.getBundle(pluginId);
+ URL url = FileLocator.find(b, new Path(relativeName), null);
+ try {
+ url = FileLocator.toFileURL(url);
+ } catch (IOException e) {
+ Assert.assertNotNull("Problem locating " + relativeName + " in" + pluginId,e);
+ }
+ String filename = url.getFile();
+ return filename;
+ }
+
+ /**
+ * Utility method
+ * @param pluginDirectory: the plugin where to look for directories
+ * @param regexp: the regexp used for matching directories
+ * @return the list of directories that belong to the pluginDirectory and
+ * ends with the given extensionSuffix
+ */
+ public static File[] getTestDirs(String pluginDirectory, final String regexp) {
+ // load directories containing tests
+ String filename = getAbsolutePath(pluginDirectory, ".");
+ File dir = new File(filename);
+ File[] testDirs = dir.listFiles(
+ new FileFilter() {
+ public boolean accept(File arg0) {
+ return (arg0.isDirectory() && arg0.getName().matches(regexp));
+ }
+ }
+ );
+
+ // test if there is any directory samples
+ Assert.assertNotNull("No project files to test",testDirs);
+ return testDirs;
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test.xml b/gcov/org.eclipse.linuxtools.gcov.test/test.xml
new file mode 100755
index 0000000000..0d6d7f896e
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+
+<project name="testsuite" default="run" basedir=".">
+ <property name="classname" value="org.eclipse.linuxtools.gcov.test.AllGcovTests" />
+ <property name="plugin-name" value="org.eclipse.linuxtools.gcov.test" />
+
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <property name="eclipse-home" value="${basedir}/../../" />
+
+ <property name="library-file" value="${eclipse-home}/dropins/${subProjectName2}/plugins/org.eclipse.test/library.xml" />
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp />
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org*.xml" />
+ </delete>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="gcov_suite">
+ <property name="gcov-folder" value="${eclipse-home}/gcov_folder" />
+ <delete dir="${gcov-folder}" quiet="true" />
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${gcov-folder}" />
+ <property name="plugin-name" value="${plugin-name}" />
+ <property name="classname" value="${classname}" />
+ </ant>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ <mkdir dir="${results}/consolelogs" />
+ <copy failonerror="false" file="${eclipse-home}/results/${classname}.txt" tofile="${results}/consolelogs/${classname}_${platform}.metadata.log.txt" />
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,gcov_suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org*.xml" />
+ <property name="output-file" value="${plugin-name}.xml" />
+ </ant>
+ </target>
+
+ <target name="all" depends="run" description="Dummy target to run all tests">
+ </target>
+
+</project>
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/Makefile b/gcov/org.eclipse.linuxtools.gcov.test/test_c/Makefile
new file mode 100644
index 0000000000..9771c05d92
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/Makefile
@@ -0,0 +1,8 @@
+build a.out:
+ gcc -fprofile-arcs -ftest-coverage *.c
+
+all: a.out
+ ./$< 1 2 3 4 5 6
+
+clean:
+ rm -f *.o a.out *.gcno *.gcda
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/a.out b/gcov/org.eclipse.linuxtools.gcov.test/test_c/a.out
new file mode 100755
index 0000000000..baebd86bc4
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/a.out
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.c b/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.c
new file mode 100644
index 0000000000..f37737a19b
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.c
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+long mult(long val1, long val2);
+
+long fact(long val)
+{
+ int k = 100;
+ for (; k-->0;);
+ if (val == 1) return 1;
+ return mult(val,fact(val-1));
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.gcda b/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.gcda
new file mode 100644
index 0000000000..0515b5e761
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.gcda
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.gcno b/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.gcno
new file mode 100644
index 0000000000..d9242a8f6a
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/fact.gcno
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.c b/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.c
new file mode 100644
index 0000000000..6065d93cd4
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.c
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+
+long fact(long val);
+
+int main(int argc, char** argv)
+{
+ int i = 1;
+ for (; i<argc; i++)
+ {
+ unsigned long val = strtol(argv[i],NULL,10);
+ unsigned long res = fact(val);
+ int k = 1000;
+ for (; k-->0;);
+ printf("%li! = %li\n", val, res);
+ }
+ return 0;
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.gcda b/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.gcda
new file mode 100644
index 0000000000..bcbaaacca0
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.gcda
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.gcno b/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.gcno
new file mode 100644
index 0000000000..3581c9812a
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/main.gcno
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.c b/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.c
new file mode 100644
index 0000000000..62abaa9230
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.c
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+long mult(long val1, long val2)
+{
+ int k = 50;
+ long res = 0;
+ for (; k-->0;);
+ while(val2-->0)
+ {
+ res += val1;
+ }
+ return res;
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.gcda b/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.gcda
new file mode 100644
index 0000000000..12b1038d72
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.gcda
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.gcno b/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.gcno
new file mode 100644
index 0000000000..d7b49a8ab0
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/mult.gcno
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/testProcessCovFiles.ref b/gcov/org.eclipse.linuxtools.gcov.test/test_c/testProcessCovFiles.ref
new file mode 100644
index 0000000000..bdb5e5113e
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/testProcessCovFiles.ref
@@ -0,0 +1,30 @@
+Parse gcda and gcno files done, resolve graph algorithm executed, now display results
+- PRINT FUNCTIONS ARRAY :
+-- FUNCTION 0
+ name = fact
+ instrumentd lines = 5
+ executed lines = 5
+-- FUNCTION 1
+ name = main
+ instrumentd lines = 9
+ executed lines = 9
+-- FUNCTION 2
+ name = mult
+ instrumentd lines = 7
+ executed lines = 7
+- PRINT SRCS ARRAY :
+-- FILE 0
+ name = fact.c
+ total lines = 19
+ instrumentd lines = 5
+ executed lines = 5
+-- FILE 1
+ name = main.c
+ total lines = 28
+ instrumentd lines = 9
+ executed lines = 9
+-- FILE 2
+ name = mult.c
+ total lines = 21
+ instrumentd lines = 7
+ executed lines = 7
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/testView.ref b/gcov/org.eclipse.linuxtools.gcov.test/test_c/testView.ref
new file mode 100644
index 0000000000..2dc8ff6d24
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/testView.ref
@@ -0,0 +1,8 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;68;21;21;100.0
+ +-;fact.c;19;5;5;100.0
+ | +-;fact;;5;5;100.0
+ +-;main.c;28;9;9;100.0
+ | +-;main;;9;9;100.0
+ +-;mult.c;21;7;7;100.0
+ +-;mult;;7;7;100.0
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/testViewFolder.ref b/gcov/org.eclipse.linuxtools.gcov.test/test_c/testViewFolder.ref
new file mode 100644
index 0000000000..2f8156b321
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/testViewFolder.ref
@@ -0,0 +1,9 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;68;21;21;100.0
+ +-;?;68;21;21;100.0
+ +-;fact.c;19;5;5;100.0
+ | +-;fact;;5;5;100.0
+ +-;main.c;28;9;9;100.0
+ | +-;main;;9;9;100.0
+ +-;mult.c;21;7;7;100.0
+ +-;mult;;7;7;100.0
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_c/testViewFunction.ref b/gcov/org.eclipse.linuxtools.gcov.test/test_c/testViewFunction.ref
new file mode 100644
index 0000000000..c24b61658c
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_c/testViewFunction.ref
@@ -0,0 +1,5 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;68;21;21;100.0
+ +-;fact;;5;5;100.0
+ +-;main;;9;9;100.0
+ +-;mult;;7;7;100.0
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/Makefile b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/Makefile
new file mode 100644
index 0000000000..e3c2b86045
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/Makefile
@@ -0,0 +1,8 @@
+build a.out:
+ g++ -fprofile-arcs -ftest-coverage *.cpp
+
+all: a.out
+ ./$< 1 2 3 4 5 6
+
+clean:
+ rm -f *.o a.out *.gcno *.gcda
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/a.out b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/a.out
new file mode 100755
index 0000000000..794f7f9e8d
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/a.out
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.cpp b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.cpp
new file mode 100644
index 0000000000..cb1e7c803c
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.cpp
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+#include "fact.hpp"
+#include "mult.hpp"
+
+namespace F
+{
+
+fact::fact() {};
+
+fact::~fact() {};
+
+long fact::f(long val)
+{
+ for (int k = 100; k-->0;);
+ if (val == 1) return 1;
+ M::mult m;
+ return m.multiply(val,f(val-1));
+}
+}
+
+
+
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.gcda b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.gcda
new file mode 100644
index 0000000000..042f39be7e
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.gcda
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.gcno b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.gcno
new file mode 100644
index 0000000000..be33eb2319
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.gcno
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.hpp b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.hpp
new file mode 100644
index 0000000000..32a9296041
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/fact.hpp
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+
+namespace F
+{
+
+ class fact
+ {
+ public:
+ fact();
+ ~fact();
+ long f(long val);
+ };
+
+}
+
+
+
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.cpp b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.cpp
new file mode 100644
index 0000000000..d3c4e21788
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.cpp
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+#include <iostream>
+#include <stdlib.h>
+#include "fact.hpp"
+
+
+int main(int argc, char** argv)
+{
+ int i = 1;
+ for (; i<argc; i++)
+ {
+ for (int k = 1000; k-->0;);
+ unsigned long val = strtol(argv[i],NULL,10);
+ F::fact f;
+ unsigned long res = f.f(val);
+ std::cout << val
+ << "! = "
+ << res
+ << std::endl;
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.gcda b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.gcda
new file mode 100644
index 0000000000..073c23e09d
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.gcda
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.gcno b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.gcno
new file mode 100644
index 0000000000..4f642e74ec
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/main.gcno
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.cpp b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.cpp
new file mode 100644
index 0000000000..bd55274fa2
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.cpp
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+#include "mult.hpp"
+
+namespace M
+{
+mult::mult() {};
+
+mult::~mult() {};
+
+long mult::multiply(long val1, long val2)
+{
+ for (int k = 50; k-->0;);
+ long res = 0;
+ while(val2-->0)
+ {
+ res += val1;
+ }
+ return res;
+};
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.gcda b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.gcda
new file mode 100644
index 0000000000..e2821df67c
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.gcda
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.gcno b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.gcno
new file mode 100644
index 0000000000..b5f1fcd994
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.gcno
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.hpp b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.hpp
new file mode 100644
index 0000000000..3d3f147356
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/mult.hpp
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+namespace M
+{
+ class mult
+ {
+ public:
+ mult();
+
+ ~mult();
+
+ long multiply(long val1, long val2);
+ };
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testProcessCovFiles.ref b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testProcessCovFiles.ref
new file mode 100644
index 0000000000..10a2316b09
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testProcessCovFiles.ref
@@ -0,0 +1,148 @@
+Parse gcda and gcno files done, resolve graph algorithm executed, now display results
+- PRINT FUNCTIONS ARRAY :
+-- FUNCTION 0
+ name = _ZN1F4factC2Ev
+ instrumentd lines = 1
+ executed lines = 0
+-- FUNCTION 1
+ name = _ZN1F4factC1Ev
+ instrumentd lines = 0
+ executed lines = 1
+-- FUNCTION 2
+ name = _ZN1F4factD2Ev
+ instrumentd lines = 1
+ executed lines = 0
+-- FUNCTION 3
+ name = _ZN1F4factD1Ev
+ instrumentd lines = 0
+ executed lines = 1
+-- FUNCTION 4
+ name = _ZN1F4fact1fEl
+ instrumentd lines = 5
+ executed lines = 5
+-- FUNCTION 5
+ name = _ZStorSt12_Ios_IostateS_
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 6
+ name = _ZNSolsEPFRSoS_E
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 7
+ name = _ZNKSt9basic_iosIcSt11char_traitsIcEE7rdstateEv
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 8
+ name = _Z41__static_initialization_and_destruction_0ii
+ instrumentd lines = 2
+ executed lines = 2
+-- FUNCTION 9
+ name = _GLOBAL__I_main
+ instrumentd lines = 0
+ executed lines = 0
+-- FUNCTION 10
+ name = _ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 11
+ name = _ZNSt11char_traitsIcE6lengthEPKc
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 12
+ name = _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
+ instrumentd lines = 5
+ executed lines = 0
+-- FUNCTION 13
+ name = _ZNSolsEm
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 14
+ name = main
+ instrumentd lines = 8
+ executed lines = 8
+-- FUNCTION 15
+ name = _ZSt13__check_facetISt5ctypeIcEERKT_PS3_
+ instrumentd lines = 4
+ executed lines = 0
+-- FUNCTION 16
+ name = _ZNKSt5ctypeIcE5widenEc
+ instrumentd lines = 5
+ executed lines = 0
+-- FUNCTION 17
+ name = _ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 18
+ name = _ZSt5flushIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 19
+ name = _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
+ instrumentd lines = 2
+ executed lines = 0
+-- FUNCTION 20
+ name = _ZN1M4multC2Ev
+ instrumentd lines = 1
+ executed lines = 0
+-- FUNCTION 21
+ name = _ZN1M4multC1Ev
+ instrumentd lines = 0
+ executed lines = 1
+-- FUNCTION 22
+ name = _ZN1M4multD2Ev
+ instrumentd lines = 1
+ executed lines = 0
+-- FUNCTION 23
+ name = _ZN1M4multD1Ev
+ instrumentd lines = 0
+ executed lines = 1
+-- FUNCTION 24
+ name = _ZN1M4mult8multiplyEll
+ instrumentd lines = 6
+ executed lines = 6
+- PRINT SRCS ARRAY :
+-- FILE 0
+ name = fact.cpp
+ total lines = 27
+ instrumentd lines = 7
+ executed lines = 7
+-- FILE 1
+ name = /sw/gnu_compil/gnu/Linux-RH-WS-3/.package/gcc-4.4.1/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/../../../../include/c++/4.4.1/bits/ios_base.h
+ total lines = 168
+ instrumentd lines = 2
+ executed lines = 0
+-- FILE 2
+ name = /sw/gnu_compil/gnu/Linux-RH-WS-3/.package/gcc-4.4.1/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/../../../../include/c++/4.4.1/ostream
+ total lines = 561
+ instrumentd lines = 13
+ executed lines = 0
+-- FILE 3
+ name = /sw/gnu_compil/gnu/Linux-RH-WS-3/.package/gcc-4.4.1/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/../../../../include/c++/4.4.1/bits/basic_ios.h
+ total lines = 441
+ instrumentd lines = 10
+ executed lines = 0
+-- FILE 4
+ name = main.cpp
+ total lines = 31
+ instrumentd lines = 9
+ executed lines = 9
+-- FILE 5
+ name = /sw/gnu_compil/gnu/Linux-RH-WS-3/.package/gcc-4.4.1/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/../../../../include/c++/4.4.1/iostream
+ total lines = 73
+ instrumentd lines = 1
+ executed lines = 1
+-- FILE 6
+ name = /sw/gnu_compil/gnu/Linux-RH-WS-3/.package/gcc-4.4.1/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/../../../../include/c++/4.4.1/bits/char_traits.h
+ total lines = 264
+ instrumentd lines = 2
+ executed lines = 0
+-- FILE 7
+ name = /sw/gnu_compil/gnu/Linux-RH-WS-3/.package/gcc-4.4.1/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/../../../../include/c++/4.4.1/bits/locale_facets.h
+ total lines = 871
+ instrumentd lines = 5
+ executed lines = 0
+-- FILE 8
+ name = mult.cpp
+ total lines = 28
+ instrumentd lines = 8
+ executed lines = 8
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testView.ref b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testView.ref
new file mode 100644
index 0000000000..af0eefbb03
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testView.ref
@@ -0,0 +1,36 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;2464;57;25;43.86
+ +-;basic_ios.h;441;10;0;0.0
+ | +-;std::basic_ios<char, std::char_traits<char> >::rdstate() const;;2;0;0.0
+ | +-;std::basic_ios<char, std::char_traits<char> >::setstate(std::_Ios_Iostate);;2;0;0.0
+ | +-;std::basic_ios<char, std::char_traits<char> >::widen(char) const;;2;0;0.0
+ | +-;std::ctype<char> const& std::__check_facet<std::ctype<char> >(std::ctype<char> const*);;4;0;0.0
+ +-;char_traits.h;264;2;0;0.0
+ | +-;std::char_traits<char>::length(char const*);;2;0;0.0
+ +-;fact.cpp;27;7;7;100.0
+ | +-;F::fact::f(long);;5;5;100.0
+ | +-;F::fact::fact();;0;1;0.0
+ | +-;F::fact::fact();;1;0;0.0
+ | +-;F::fact::~fact();;0;1;0.0
+ | +-;F::fact::~fact();;1;0;0.0
+ +-;ios_base.h;168;2;0;0.0
+ | +-;std::operator|(std::_Ios_Iostate, std::_Ios_Iostate);;2;0;0.0
+ +-;iostream;73;1;1;100.0
+ +-;locale_facets.h;871;5;0;0.0
+ | +-;std::ctype<char>::widen(char) const;;5;0;0.0
+ +-;main.cpp;31;9;9;100.0
+ | +-;__static_initialization_and_destruction_0(int, int);;2;2;100.0
+ | +-;global constructors keyed to main;;0;0;0.0
+ | +-;main;;8;8;100.0
+ +-;mult.cpp;28;8;8;100.0
+ | +-;M::mult::mult();;0;1;0.0
+ | +-;M::mult::mult();;1;0;0.0
+ | +-;M::mult::multiply(long, long);;6;6;100.0
+ | +-;M::mult::~mult();;0;1;0.0
+ | +-;M::mult::~mult();;1;0;0.0
+ +-;ostream;561;13;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&);;2;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >& std::flush<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&);;2;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*);;5;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&));;2;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >::operator<<(unsigned long);;2;0;0.0
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testViewFolder.ref b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testViewFolder.ref
new file mode 100644
index 0000000000..ef35963330
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testViewFolder.ref
@@ -0,0 +1,39 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;2464;57;25;43.86
+ +-;4.4.1;634;14;1;7.14
+ | +-;iostream;73;1;1;100.0
+ | +-;ostream;561;13;0;0.0
+ | +-;std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&);;2;0;0.0
+ | +-;std::basic_ostream<char, std::char_traits<char> >& std::flush<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&);;2;0;0.0
+ | +-;std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*);;5;0;0.0
+ | +-;std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&));;2;0;0.0
+ | +-;std::basic_ostream<char, std::char_traits<char> >::operator<<(unsigned long);;2;0;0.0
+ +-;?;86;24;24;100.0
+ | +-;fact.cpp;27;7;7;100.0
+ | | +-;F::fact::f(long);;5;5;100.0
+ | | +-;F::fact::fact();;0;1;0.0
+ | | +-;F::fact::fact();;1;0;0.0
+ | | +-;F::fact::~fact();;0;1;0.0
+ | | +-;F::fact::~fact();;1;0;0.0
+ | +-;main.cpp;31;9;9;100.0
+ | | +-;__static_initialization_and_destruction_0(int, int);;2;2;100.0
+ | | +-;global constructors keyed to main;;0;0;0.0
+ | | +-;main;;8;8;100.0
+ | +-;mult.cpp;28;8;8;100.0
+ | +-;M::mult::mult();;0;1;0.0
+ | +-;M::mult::mult();;1;0;0.0
+ | +-;M::mult::multiply(long, long);;6;6;100.0
+ | +-;M::mult::~mult();;0;1;0.0
+ | +-;M::mult::~mult();;1;0;0.0
+ +-;bits;1744;19;0;0.0
+ +-;basic_ios.h;441;10;0;0.0
+ | +-;std::basic_ios<char, std::char_traits<char> >::rdstate() const;;2;0;0.0
+ | +-;std::basic_ios<char, std::char_traits<char> >::setstate(std::_Ios_Iostate);;2;0;0.0
+ | +-;std::basic_ios<char, std::char_traits<char> >::widen(char) const;;2;0;0.0
+ | +-;std::ctype<char> const& std::__check_facet<std::ctype<char> >(std::ctype<char> const*);;4;0;0.0
+ +-;char_traits.h;264;2;0;0.0
+ | +-;std::char_traits<char>::length(char const*);;2;0;0.0
+ +-;ios_base.h;168;2;0;0.0
+ | +-;std::operator|(std::_Ios_Iostate, std::_Ios_Iostate);;2;0;0.0
+ +-;locale_facets.h;871;5;0;0.0
+ +-;std::ctype<char>::widen(char) const;;5;0;0.0
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testViewFunction.ref b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testViewFunction.ref
new file mode 100644
index 0000000000..e8a0cbb4f8
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov.test/test_cpp/testViewFunction.ref
@@ -0,0 +1,27 @@
+Hierarchy;Name;Total Lines;Instrumented Lines;Executed Lines;Coverage %
++-;Summary;2464;57;25;43.86
+ +-;F::fact::f(long);;5;5;100.0
+ +-;F::fact::fact();;0;1;0.0
+ +-;F::fact::fact();;1;0;0.0
+ +-;F::fact::~fact();;0;1;0.0
+ +-;F::fact::~fact();;1;0;0.0
+ +-;M::mult::mult();;0;1;0.0
+ +-;M::mult::mult();;1;0;0.0
+ +-;M::mult::multiply(long, long);;6;6;100.0
+ +-;M::mult::~mult();;0;1;0.0
+ +-;M::mult::~mult();;1;0;0.0
+ +-;__static_initialization_and_destruction_0(int, int);;2;2;100.0
+ +-;global constructors keyed to main;;0;0;0.0
+ +-;main;;8;8;100.0
+ +-;std::basic_ios<char, std::char_traits<char> >::rdstate() const;;2;0;0.0
+ +-;std::basic_ios<char, std::char_traits<char> >::setstate(std::_Ios_Iostate);;2;0;0.0
+ +-;std::basic_ios<char, std::char_traits<char> >::widen(char) const;;2;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&);;2;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >& std::flush<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&);;2;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*);;5;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&));;2;0;0.0
+ +-;std::basic_ostream<char, std::char_traits<char> >::operator<<(unsigned long);;2;0;0.0
+ +-;std::char_traits<char>::length(char const*);;2;0;0.0
+ +-;std::ctype<char> const& std::__check_facet<std::ctype<char> >(std::ctype<char> const*);;4;0;0.0
+ +-;std::ctype<char>::widen(char) const;;5;0;0.0
+ +-;std::operator|(std::_Ios_Iostate, std::_Ios_Iostate);;2;0;0.0
diff --git a/gcov/org.eclipse.linuxtools.gcov/.classpath b/gcov/org.eclipse.linuxtools.gcov/.classpath
new file mode 100644
index 0000000000..a87b062760
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry excluding="**/.svn/**" kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/gcov/org.eclipse.linuxtools.gcov/.project b/gcov/org.eclipse.linuxtools.gcov/.project
new file mode 100644
index 0000000000..7c48214893
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.gcov</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/gcov/org.eclipse.linuxtools.gcov/.settings/org.eclipse.jdt.core.prefs b/gcov/org.eclipse.linuxtools.gcov/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..3d3c172187
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Thu Jan 15 16:04:09 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/gcov/org.eclipse.linuxtools.gcov/META-INF/MANIFEST.MF b/gcov/org.eclipse.linuxtools.gcov/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..e5efc5e0c0
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.gcov;singleton:=true
+Bundle-Version: 4.1.1.qualifier
+Bundle-Activator: org.eclipse.linuxtools.gcov.Activator
+Bundle-Vendor: %bundleProvider
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.linuxtools.dataviewers,
+ org.eclipse.core.filesystem,
+ org.eclipse.core.variables,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.editors,
+ org.eclipse.linuxtools.binutils,
+ org.eclipse.cdt.core,
+ org.eclipse.cdt.ui,
+ org.eclipse.jface.text,
+ org.eclipse.debug.ui,
+ org.eclipse.linuxtools.dataviewers.charts,
+ org.eclipse.linuxtools.dataviewers.annotatedsourceeditor
+Export-Package: org.eclipse.linuxtools.gcov.utils,
+ org.eclipse.linuxtools.gcov.view
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Localization: plugin
diff --git a/gcov/org.eclipse.linuxtools.gcov/about.html b/gcov/org.eclipse.linuxtools.gcov/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov/build.properties b/gcov/org.eclipse.linuxtools.gcov/build.properties
new file mode 100644
index 0000000000..a4d0a62e79
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ META-INF/,\
+ icons/,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov/icons/c_file_obj.gif b/gcov/org.eclipse.linuxtools.gcov/icons/c_file_obj.gif
new file mode 100644
index 0000000000..915b7f479b
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/icons/c_file_obj.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov/icons/directory_obj.gif b/gcov/org.eclipse.linuxtools.gcov/icons/directory_obj.gif
new file mode 100644
index 0000000000..7937f33e02
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/icons/directory_obj.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov/icons/function_obj.gif b/gcov/org.eclipse.linuxtools.gcov/icons/function_obj.gif
new file mode 100644
index 0000000000..08aef8f7cd
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/icons/function_obj.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov/icons/src_file_obj.gif b/gcov/org.eclipse.linuxtools.gcov/icons/src_file_obj.gif
new file mode 100644
index 0000000000..8fd6adbd9f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/icons/src_file_obj.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov/icons/toggle.gif b/gcov/org.eclipse.linuxtools.gcov/icons/toggle.gif
new file mode 100644
index 0000000000..62a7d865e5
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/icons/toggle.gif
Binary files differ
diff --git a/gcov/org.eclipse.linuxtools.gcov/plugin.properties b/gcov/org.eclipse.linuxtools.gcov/plugin.properties
new file mode 100644
index 0000000000..f29e54aba7
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/plugin.properties
@@ -0,0 +1,16 @@
+#******************************************************************************
+# Copyright (c) 2009 STMicroelectronics.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+#*******************************************************************************
+bundleProvider = Eclipse Linux Tools
+bundleName = Gcov Plug-in (Incubation)
+gcovEditor = Gcov Editor
+gcov = gcov
+gcovDescription = Gcov view displays the profiling information contained in gcda/gcno files
+gcovCategory = gcov \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov/plugin.xml b/gcov/org.eclipse.linuxtools.gcov/plugin.xml
new file mode 100644
index 0000000000..35247d61b6
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/plugin.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.linuxtools.gcov"
+ name="%gcovCategory">
+ </category>
+ <view
+ allowMultiple="true"
+ category="org.eclipse.linuxtools.gcov"
+ class="org.eclipse.linuxtools.gcov.view.CovView"
+ icon="icons/toggle.gif"
+ id="org.eclipse.linuxtools.gcov.view"
+ name="%gcov"
+ restorable="false">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.linuxtools.gcov.view.annotatedsource.STAnnotatedSourceNotFoundEditor"
+ icon="icons/src_file_obj.gif"
+ id="org.eclipse.linuxtools.gcov.view.annotatedsource.STAnnotatedSourceNotFoundEditor"
+ name="Source Not Found">
+ </editor>
+ <editor
+ extensions="gcda, gcno"
+ icon="icons/toggle.gif"
+ id="org.eclipse.linuxtools.gcov.editor"
+ launcher="org.eclipse.linuxtools.gcov.action.OpenGCAction"
+ name="%gcovEditor">
+ </editor>
+ </extension>
+
+
+</plugin>
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/Activator.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/Activator.java
new file mode 100644
index 0000000000..e595b1dd0d
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/Activator.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.gcov";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (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 Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java
new file mode 100644
index 0000000000..bfc86b41ae
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.action;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.linuxtools.gcov.Activator;
+import org.eclipse.linuxtools.gcov.dialog.OpenGCDialog;
+import org.eclipse.linuxtools.gcov.view.CovView;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorLauncher;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * Action performed when user clicks on a gcda/gcno file
+ *
+ * @author Xavier Raynaud <xavier.raynaud@st.com>
+ */
+public class OpenGCAction implements IEditorLauncher {
+
+ public void open(IPath file) {
+ Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ String extension = file.getFileExtension();
+ File gcno;
+ File gcda;
+ if ("gcno".equals(extension)) {
+ IPath file2 = file.removeFileExtension().addFileExtension("gcda");
+ gcno = file.toFile();
+ gcda = file2.toFile();
+ } else if ("gcda".equals(extension)) {
+ IPath file2 = file.removeFileExtension().addFileExtension("gcno");
+ gcda = file.toFile();
+ gcno = file2.toFile();
+
+ } else {
+ // should never occurs
+ return;
+ }
+
+ if (gcda == null || !gcda.isFile()) {
+ String msg = "File " + gcda + " does not exist.";
+ msg += "\nPlease run your application at least once.";
+ MessageDialog.openError(shell, "gcov Error", msg);
+ return;
+ }
+ if (gcno == null || !gcno.isFile()) {
+ String msg = "File " + gcno + " does not exist.";
+ msg += "\nPlease recompile your application.";
+ MessageDialog.openError(shell, "gcov Error", msg);
+ return;
+ }
+
+
+ String s = getDefaultBinary(file);
+ OpenGCDialog d = new OpenGCDialog(shell, s, file);
+ if (d.open() != OpenGCDialog.OK) {
+ return;
+ }
+ String binaryPath = d.getBinaryFile();
+ if (d.isCompleteCoverageResultWanted()) {
+ CovView.displayCovResults(binaryPath);
+ } else {
+ CovView.displayCovDetailedResult(binaryPath, gcda.getAbsolutePath());
+ }
+ }
+
+ private String getDefaultBinary(IPath file) {
+ File gmonFile = file.toFile();
+ File parent = gmonFile.getParentFile();
+ File info = new File(parent,"AnalysisInfo.txt");
+ IProject project = null;
+ IFile ifile = null;
+ try {
+ String line;
+ String tab[];
+ if (info.exists()) {
+ BufferedReader br = new BufferedReader(new FileReader(info.toString()));
+
+ while ((line = br.readLine())!= null){
+ tab = line.split("=");
+ String name="", value="";
+ if (tab.length > 1){
+ name=tab[0];
+ value=tab[1].trim();
+ if (name.equals("Project Name ")){
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(value);
+ }
+ else if (name.equals("Program Name ")){
+ if(project != null){
+ ifile = project.getFile(value);
+ br.close();
+ if (ifile.exists()) {
+ return ifile.getLocation().toString();
+ }
+ }
+ }
+ }
+ }
+ }else{
+ IFile c = ResourcesPlugin.getWorkspace().getRoot()
+ .getFileForLocation(file);
+ if (c != null) {
+ project = c.getProject();
+ if (project != null && project.exists()) {
+ ICProject cproject = CoreModel.getDefault().create(project);
+ if (cproject != null) {
+ try {
+ IBinary[] b = cproject.getBinaryContainer()
+ .getBinaries();
+ if (b != null && b.length > 0 && b[0] != null) {
+ IResource r = b[0].getResource();
+ return r.getLocation().toOSString();
+ }
+ } catch (CModelException _) {
+ }
+ }
+ }
+ }
+ }
+ } catch (FileNotFoundException e) {
+ Status status = new Status(
+ Status.WARNING,
+ Activator.PLUGIN_ID,
+ IStatus.WARNING,
+ e.getMessage(),
+ e
+ );
+ Activator.getDefault().getLog().log(status);
+ } catch (IOException e) {
+ Status status = new Status(
+ Status.ERROR,
+ Activator.PLUGIN_ID,
+ IStatus.ERROR,
+ e.getMessage(),
+ e
+ );
+ Activator.getDefault().getLog().log(status);
+ }
+ return "";
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/action/SwitchContentProviderAction.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/action/SwitchContentProviderAction.java
new file mode 100644
index 0000000000..b1ac0f24f0
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/action/SwitchContentProviderAction.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.action;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.linuxtools.gcov.Activator;
+
+
+ /**
+ * This action changes the content provider
+ */
+
+ public class SwitchContentProviderAction extends Action {
+
+ private final ColumnViewer viewer;
+ private final IContentProvider provider;
+
+ public SwitchContentProviderAction(String name, String iconPath, ColumnViewer viewer, IContentProvider provider) {
+ super(name, AS_RADIO_BUTTON);
+ this.setImageDescriptor(Activator.getImageDescriptor(iconPath));
+ this.setToolTipText(name);
+ this.viewer = viewer;
+ this.provider = provider;
+ }
+
+ @Override
+ public void run() {
+ viewer.getControl().setRedraw(false);
+ viewer.setContentProvider(provider);
+ ((TreeViewer)viewer).expandToLevel(2);
+ viewer.getControl().setRedraw(true);
+ }
+ } \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/dialog/OpenGCDialog.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/dialog/OpenGCDialog.java
new file mode 100644
index 0000000000..1d8b3ceb95
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/dialog/OpenGCDialog.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.dialog;
+
+import java.io.File;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+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.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.linuxtools.binutils.utils.STSymbolManager;
+import org.eclipse.linuxtools.gcov.Activator;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+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.PlatformUI;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.views.navigator.ResourceComparator;
+
+
+/**
+ * This dialog box is opened when user clicks on a gcno/gcda file.
+ * it allows the user to choose the binary file who produced the gcno/gcda file.
+ * @author Xavier Raynaud <xavier.raynaud@st.com>
+ *
+ */
+public class OpenGCDialog extends Dialog {
+
+ /* Inputs */
+ private Text binText;
+ private String binValue;
+
+ private Button openThisFileOnlyButton;
+ private Button openCoverageSummaryButton;
+ private boolean openCoverageSummary = true;
+
+ /* buttons */
+ private Button binBrowseWorkspaceButton;
+ private Button binBrowseFileSystemButton;
+
+ /* error label */
+ private Label errorLabel;
+
+ /* validation boolean */
+ private boolean binaryValid;
+
+ /* internal listener */
+ private final BinaryModifyListener binModifyListener = new BinaryModifyListener();
+
+ private final String defaultValue;
+ private final IPath gcFile;
+
+ /**
+ * Constructor
+ * @param parentShell
+ * @param binPath the path to a binary file.
+ */
+ public OpenGCDialog(Shell parentShell, String binPath, IPath gcFile) {
+ super(parentShell);
+ this.gcFile = gcFile;
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ this.defaultValue = binPath;
+ }
+
+ /**
+ * Gets the Binary file selected by the user
+ * @return a path to a binary file
+ */
+ public String getBinaryFile() {
+ return binValue;
+ }
+
+ /**
+ * Gets whether the user wants a complete coverage result, or a result specific file to the given gcFile.
+ */
+ public boolean isCompleteCoverageResultWanted() {
+ return openCoverageSummary;
+ }
+
+
+ protected Control createContents(Composite parent) {
+ Control composite = super.createContents(parent);
+ validateBinary();
+ return composite;
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ this.getShell().setText("Gcov - Open coverage results...");
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ /* first line */
+ Group c = new Group(composite, SWT.NONE);
+ c.setText("Binary File");
+ c.setToolTipText("Please enter here the binary file who produced this gcov trace.");
+ GridLayout layout = new GridLayout(2,false);
+ c.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ c.setLayoutData(data);
+
+ Label binLabel = new Label(c,SWT.NONE);
+ binLabel.setText("Please enter here the binary file who produced gcov trace");
+ data = new GridData();
+ data.horizontalSpan = 2;
+ binLabel.setLayoutData(data);
+
+ binText = new Text(c,SWT.BORDER);
+ binText.setText(this.defaultValue);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ binText.setLayoutData(data);
+ binText.addModifyListener(binModifyListener);
+
+ Composite cbBin = new Composite(c,SWT.NONE);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ cbBin.setLayoutData(data);
+ cbBin.setLayout(new GridLayout(2, true));
+ binBrowseWorkspaceButton = new Button(cbBin, SWT.PUSH);
+ binBrowseWorkspaceButton.setText("&Workspace...");
+ binBrowseWorkspaceButton.addSelectionListener(
+ new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent sev)
+ {
+ handleBrowseWorkspace("Open Binary file...", binText);
+ }
+ }
+ );
+ binBrowseFileSystemButton = new Button(cbBin, SWT.PUSH);
+ binBrowseFileSystemButton.setText("&File System...");
+ binBrowseFileSystemButton.addSelectionListener(
+ new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent sev)
+ {
+ handleBrowse("Open Binary file...", binText);
+ }
+ }
+ );
+
+ Group covMode = new Group(composite, SWT.NONE);
+ covMode.setText("Coverage result");
+ covMode.setToolTipText("Please choose the result scope.");
+ GridData covModeData = new GridData(GridData.FILL_BOTH);
+ covMode.setLayoutData(covModeData);
+ covMode.setLayout(new GridLayout());
+ openThisFileOnlyButton = new Button(covMode, SWT.RADIO);
+ openThisFileOnlyButton.setLayoutData(new GridData());
+ openCoverageSummaryButton = new Button(covMode, SWT.RADIO);
+ openCoverageSummaryButton.setLayoutData(new GridData());
+ String cFile = gcFile.removeFileExtension().lastSegment() + ".c";
+
+ openThisFileOnlyButton.setText("Show coverage details for \"" + cFile + "\" only.");
+ openCoverageSummaryButton.setText("Show coverage for the whole selected binary file");
+
+ openCoverageSummaryButton.setSelection(true);
+
+ SelectionAdapter sa = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent sev)
+ {
+ openCoverageSummary = openCoverageSummaryButton.getSelection();
+ }
+ };
+ openCoverageSummaryButton.addSelectionListener(sa);
+ openThisFileOnlyButton.addSelectionListener(sa);
+
+
+ /* 2sd line */
+ errorLabel = new Label(composite,SWT.NONE);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 3;
+ errorLabel.setLayoutData(data);
+ errorLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
+
+ c.layout();
+
+ return composite;
+ }
+
+ private void validateBinary() {
+ binValue = binText.getText();
+ IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
+ try {
+ binValue = mgr.performStringSubstitution(binValue, false);
+ } catch (CoreException _) {
+ // do nothing: never occurs
+ }
+
+ File f = new File(binValue);
+ if (f.exists()) {
+ IBinaryObject binary = STSymbolManager.sharedInstance.getBinaryObject(new Path(binValue));
+ if (binary == null) {
+ MessageDialog.openError(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ "Invalid binary file",
+ binText.getText() + " is not a valid binary file.");
+ return;
+ }
+ binaryValid = true;
+ getButton(IDialogConstants.OK_ID).setEnabled(binaryValid);
+ errorLabel.setText("");
+ } else {
+ binaryValid = false;
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ if (!binValue.equals("")) {
+ errorLabel.setText("\"" + binText.getText() + "\" doesn't exist");
+ } else {
+ errorLabel.setText("Please enter a binary file");
+ }
+ return;
+ }
+ }
+
+ private class BinaryModifyListener implements ModifyListener
+ {
+ public void modifyText(ModifyEvent e) {
+ validateBinary();
+ }
+
+ }
+
+ protected void handleBrowseWorkspace(String msg, Text text) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle(msg);
+ dialog.setMessage(msg);
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ dialog.setAllowMultiple(false);
+ IContainer c = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(this.gcFile);
+ if (c != null) dialog.setInitialSelection(c.getProject());
+ dialog.setValidator(new ISelectionStatusValidator() {
+ public IStatus validate(Object[] selection)
+ {
+ if (selection.length != 1) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ }
+ if (!(selection[0] instanceof IFile)) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ }
+ });
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ IResource resource = (IResource) dialog.getFirstResult();
+ text.setText("${resource_loc:" + resource.getFullPath() + "}");
+ }
+ }
+
+
+ protected void handleBrowse(String msg, Text text)
+ {
+ FileDialog dialog = new FileDialog(this.getShell(),SWT.OPEN);
+ dialog.setText(msg);
+ String t = text.getText();
+ IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
+ try {
+ t = mgr.performStringSubstitution(t, false);
+ } catch (CoreException _) {
+ // do nothing: never occurs
+ }
+ File f = new File(t);
+ t = f.getParent();
+ if (t == null || t.length() == 0) {
+ t = this.gcFile.removeLastSegments(1).toOSString();
+ }
+ dialog.setFilterPath(t);
+ String s = dialog.open();
+ if (s != null) text.setText(s);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/AbstractTreeElement.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/AbstractTreeElement.java
new file mode 100644
index 0000000000..0fcce342d6
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/AbstractTreeElement.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.model;
+
+import java.util.LinkedList;
+
+public abstract class AbstractTreeElement implements TreeElement{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4911602250295116203L;
+ private final TreeElement parent;
+ private final LinkedList<TreeElement> children = new LinkedList<TreeElement>();
+ private final String name;
+ private final int totalLines;
+ private final int executedLines;
+ private final int instrumentedLines;
+
+ public AbstractTreeElement(TreeElement parent, String name, int totalLines,
+ int executedLines, int instrumentedLines) {
+ this.parent = parent;
+ this.name = name;
+ this.totalLines = totalLines;
+ this.executedLines = executedLines;
+ this.instrumentedLines = instrumentedLines;
+ }
+
+ public TreeElement getParent() {
+ return parent;
+ }
+
+ public boolean hasChildren() {
+ return (children.size()>0);
+ }
+
+ public LinkedList<? extends TreeElement> getChildren() {
+ return children;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public TreeElement getRoot() {
+ if (parent == null) return this;
+ return parent.getRoot();
+ }
+
+ public int getExecutedLines() {
+ return executedLines;
+ }
+
+ public int getInstrumentedLines() {
+ return instrumentedLines;
+ }
+
+ public float getCoveragePercentage() {
+ if (instrumentedLines !=0 )
+ return (100.f*executedLines)/(instrumentedLines);
+ else return 0;
+ }
+
+ public void addChild(TreeElement child){
+ children.add(child);
+ }
+
+ public int getTotalLines() {
+ return totalLines;
+ }
+} \ No newline at end of file
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFileTreeElement.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFileTreeElement.java
new file mode 100644
index 0000000000..5bfa929760
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFileTreeElement.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.model;
+
+
+public class CovFileTreeElement extends AbstractTreeElement {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5017234616535899796L;
+
+ public CovFileTreeElement(TreeElement parent,
+ String name, int totalLines, int executedLines, int instrumentedLines) {
+ super(parent, name, totalLines, executedLines, instrumentedLines);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFolderTreeElement.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFolderTreeElement.java
new file mode 100644
index 0000000000..8bfafdf70b
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFolderTreeElement.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.model;
+
+public class CovFolderTreeElement extends AbstractTreeElement {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 583359546284716138L;
+
+ public CovFolderTreeElement(TreeElement parent,
+ String name, int totalLines, int executedLines, int instrumentedLines) {
+ super(parent, name, totalLines, executedLines, instrumentedLines);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFunctionTreeElement.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFunctionTreeElement.java
new file mode 100644
index 0000000000..3f5e32eeae
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovFunctionTreeElement.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.model;
+
+import java.util.LinkedList;
+
+
+public class CovFunctionTreeElement extends AbstractTreeElement {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2025221943523670378L;
+ private final String sourceFilePath;
+ private final long firstLnNmbr;
+
+ public CovFunctionTreeElement(TreeElement parent, String name, String sourceFilePath,
+ long firstLnNmbr, int executedLines, int instrumentedLines) {
+ super(parent, name, 0, executedLines, instrumentedLines);
+ this.sourceFilePath = sourceFilePath;
+ this.firstLnNmbr = firstLnNmbr;
+ }
+
+
+ /* no children for functions*/
+
+ public boolean hasChildren() {
+ return false;
+ }
+
+ public LinkedList<? extends TreeElement> getChildren() {
+ return null;
+ }
+
+ public void addChild(TreeElement child){
+ }
+
+
+ /* specific methods for functions*/
+
+ public String getSourceFilePath() {
+ return sourceFilePath;
+ }
+
+ public long getFirstLnNmbr() {
+ return firstLnNmbr;
+ }
+
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovRootTreeElement.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovRootTreeElement.java
new file mode 100644
index 0000000000..57d879e80d
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/CovRootTreeElement.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.model;
+
+import java.io.Serializable;
+
+public class CovRootTreeElement extends AbstractTreeElement implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 877070271548608926L;
+
+ public CovRootTreeElement(String name, int totalLines, int executedLines,
+ int instrumentedLines) {
+ super(null, name, totalLines, executedLines, instrumentedLines);
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/TreeElement.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/TreeElement.java
new file mode 100644
index 0000000000..d489010c0f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/model/TreeElement.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.model;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+
+public interface TreeElement extends Serializable{
+ TreeElement getParent();
+ LinkedList<? extends TreeElement> getChildren();
+ boolean hasChildren();
+ TreeElement getRoot();
+
+ String getName();
+ int getExecutedLines();
+ int getInstrumentedLines();
+ int getTotalLines();
+ float getCoveragePercentage();
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Arc.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Arc.java
new file mode 100644
index 0000000000..848462be4b
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Arc.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.parser;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class Arc implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4104429137191407662L;
+
+ private static final int VCOV_ARC_ON_TREE = (1 << 0);
+ private static final int VCOV_ARC_FAKE = (1 << 1);
+ private static final int VCOV_ARC_FALLTHROUGH = (1 << 2);
+
+ private final Block srcBlock;
+ private final Block dstnatnBlock;
+ private final long flag;
+ private final boolean fake;
+ private final boolean onTree;
+ private final boolean fallthrough;
+
+ private long count = 0;
+ private boolean countValid = false;
+ private boolean isCallNonReturn = false; // Arc is for a function that abnormally returns
+ private boolean isNonLoclaReturn = false; // Arc is for catch/setjump
+ private boolean isUnconditionnal = false; // Is an unconditional branch.
+
+ /**
+ * Constructor
+ */
+ public Arc(int srcBlockIndice, int dstnatnBlockIndice, long flag, List<Block> otherArcParams) {
+ this.flag = flag;
+ this.dstnatnBlock = otherArcParams.get(dstnatnBlockIndice);
+ this.srcBlock = otherArcParams.get(srcBlockIndice);
+ this.count = 0;
+ this.countValid = false;
+ if ((flag & VCOV_ARC_ON_TREE) != 0) {
+ onTree = true;
+ fake = false;
+ fallthrough = false;
+ } else if ((flag & VCOV_ARC_FAKE) != 0) {
+ onTree = false;
+ fake = true;
+ fallthrough = true;
+ } else if ((flag & VCOV_ARC_FALLTHROUGH) != 0) {
+ onTree = false;
+ fake = false;
+ fallthrough = true;
+ } else {
+ onTree = false;
+ fake = false;
+ fallthrough = false;
+ }
+ }
+
+ public Block getDstnatnBlock() {
+ return dstnatnBlock;
+ }
+
+ public long getFlag() {
+ return flag;
+ }
+
+ public boolean isFake() {
+ return fake;
+ }
+
+ public boolean isOnTree() {
+ return onTree;
+ }
+
+ public boolean isFallthrough() {
+ return fallthrough;
+ }
+
+ public boolean isUnconditionnal() {
+ return isUnconditionnal;
+ }
+
+ public boolean isNonLoclaReturn() {
+ return isNonLoclaReturn;
+ }
+
+ public boolean isCallNonReturn() {
+ return isCallNonReturn;
+ }
+
+ public void setCallNonReturn(boolean isCallNonReturn) {
+ this.isCallNonReturn = isCallNonReturn;
+ }
+
+ public void setNonLoclaReturn(boolean isNonLoclaReturn) {
+ this.isNonLoclaReturn = isNonLoclaReturn;
+ }
+
+ public void setUnconditionnal(boolean isUnconditionnal) {
+ this.isUnconditionnal = isUnconditionnal;
+ }
+
+ public Block getSrcBlock() {
+ return srcBlock;
+ }
+
+ public void setCount(long count) {
+ this.count = count;
+ }
+
+ public void setCountValid(boolean countValid) {
+ this.countValid = countValid;
+ }
+
+ public long getCount() {
+ return count;
+ }
+
+ public boolean isCountValid() {
+ return countValid;
+ }
+}
diff --git a/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Block.java b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Block.java
new file mode 100644
index 0000000000..495ebfe65f
--- /dev/null
+++ b/gcov/org.eclipse.linuxtools.gcov/src/org/eclipse/linuxtools/gcov/parser/Block.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2009 STMicroelectronics.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.gcov.parser;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class Block implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7665287885679756014L;
+ private final ArrayList<Arc> entryArcs = new ArrayList<Arc>();
+ private final ArrayList<Arc> exitArcs = new ArrayList<Arc>();
+ private final long flag;
+ private long numSuccs = 0;
+ private long numPreds = 0;
+ private long count = 0;
+ private boolean isCallSite = false;// Does the call
+ private boolean isCallReturn = false; // Is the return
+ private boolean isNonLocalReturn = false;
+ private boolean validChain = false;
+ private boolean invalidChain = false;
+ private boolean countValid = false;
+ private final BlkLine blkline = new BlkLine();
+
+ /**
+ * Constructor
+ */
+ public Block(long flag) {
+ this.flag = flag;
+ }
+
+
+ /* getters & setters */
+ public long getFlag() {
+ return flag;
+ }
+
+ public ArrayList<Arc> getEntryArcs() {
+ return entryArcs;
+ }
+
+ public ArrayList<Arc> getExitArcs() {
+ return exitArcs;
+ }
+
+ public boolean isCallSite() {
+ return isCallSite;
+ }
+
+ public boolean isCallReturn() {
+ return isCallReturn;
+ }
+
+ public boolean isNonLocalReturn() {
+ return isNonLocalReturn;