Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.coverage')
-rw-r--r--plugins/org.eclipse.osee.coverage/.classpath16
-rw-r--r--plugins/org.eclipse.osee.coverage/.project80
-rw-r--r--plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF140
-rw-r--r--plugins/org.eclipse.osee.coverage/plugin.xml220
-rw-r--r--plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/CoveragePackageSave.java586
-rw-r--r--plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/ObjectFactory.java120
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/CoverageManager.java88
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/ICoverageImporter.java48
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ConfigureCoverageMethodsAction.java214
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoverUnitAction.java142
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoveragePackageAction.java110
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditAssigneesAction.java142
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java142
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageNotesAction.java142
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditRationaleAction.java142
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/GenerateDetailedCoverageReportAction.java202
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ICoveragePackageHandler.java20
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/IRefreshable.java28
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ISelectedCoverageEditorItem.java24
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/LinkWithImportItemAction.java146
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/NewCoveragePackageAction.java82
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenCoveragePackageAction.java78
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/SaveImportRecordAction.java96
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ShowMergeDetailsAction.java138
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ViewSourceAction.java172
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/AbstractCoverageBlam.java102
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java376
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorHandler.java72
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorImportTab.java656
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorLoadingTab.java134
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorMergeTab.java874
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java434
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParameters.java642
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java562
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageXViewerFactory.java170
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewer.java180
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactory.java68
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryImport.java104
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryPackage.java100
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/XCoverageMergeViewer.java114
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageMessages.java88
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/OseeMessagingTracker.java74
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/CoveragePerspectiveFactory.java108
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/IMergeItem.java38
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchItem.java118
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchType.java192
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeImportManager.java658
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItem.java292
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java92
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemGroup.java278
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java1014
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeType.java80
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MessageMergeItem.java62
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageImport.java244
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java676
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOption.java166
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManager.java196
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManagerDefault.java52
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackage.java142
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java568
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePreferences.java120
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java246
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java786
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java82
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageItemProvider.java30
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnit.java234
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitFileContentsProvider.java30
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitProvider.java30
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ITestUnitProvider.java44
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java210
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/SimpleCoverageUnitFileContentsProvider.java42
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/SimpleTestUnitProvider.java122
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/navigate/CoverageNavigateView.java386
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageOptionManagerStore.java200
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageStore.java30
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/DbTestUnitProvider.java226
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/ICoverageStore.java30
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java358
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoverageStore.java132
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoverageUnitFileContentsProvider.java100
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoverageUnitStore.java346
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/TestUnitStore.java202
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/CoverageUtil.java478
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/ISaveable.java36
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/NotSaveable.java68
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageListDialog.java72
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoveragePackageArtifactListDialog.java72
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/widget/CoverageXWidgetFactory.java34
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/widget/XHyperlabelCoverageMethodSelection.java184
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/AggregateCoverageUnitResult.java88
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/CoverageDataFile.java152
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/CoverageDataSubProgram.java112
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/CoverageDataUnit.java108
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/IVectorCastCoverageImportProvider.java36
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/LineNumToBranches.java72
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/VCastAggregateReport.java144
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/VCastVcp.java122
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/VcpResultsFile.java102
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/VcpSourceLineFile.java74
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/VcpSourceLisFile.java162
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/vcast/VectorCastAdaCoverageImporter.java692
101 files changed, 9919 insertions, 9919 deletions
diff --git a/plugins/org.eclipse.osee.coverage/.classpath b/plugins/org.eclipse.osee.coverage/.classpath
index 9a39368d97..0c22b5d7e6 100644
--- a/plugins/org.eclipse.osee.coverage/.classpath
+++ b/plugins/org.eclipse.osee.coverage/.classpath
@@ -1,8 +1,8 @@
-<?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="src" path="src-gen"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?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="src" path="src-gen"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.coverage/.project b/plugins/org.eclipse.osee.coverage/.project
index ffab1fb46a..c2370f8443 100644
--- a/plugins/org.eclipse.osee.coverage/.project
+++ b/plugins/org.eclipse.osee.coverage/.project
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.coverage</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>
- <buildCommand>
- <name>org.eclipse.xtext.ui.core.xtextBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.xtext.ui.core.xtextNature</nature>
- <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.coverage</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>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.core.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.core.xtextNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF
index fc82b6e3bb..5931ee2380 100644
--- a/plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.coverage/META-INF/MANIFEST.MF
@@ -1,72 +1,72 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OSEE Coverage Plug-in (Incubation)
-Bundle-SymbolicName: org.eclipse.osee.coverage;singleton:=true
-Bundle-Version: 0.9.5.qualifier
-Bundle-Activator: org.eclipse.osee.coverage.internal.Activator
-Bundle-Vendor: Eclipse Open System Engineering Environment
-Eclipse-ExtensibleAPI: true
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.core.filesystem,
- org.eclipse.osee.framework.jdk.core,
- org.eclipse.ui.ide,
- org.eclipse.search,
- org.eclipse.osee.framework.plugin.core,
- org.eclipse.osee.framework.ui.plugin,
- org.eclipse.osee.framework.database,
- org.eclipse.ui.forms,
- org.eclipse.osee.framework.messaging.event.skynet,
- org.eclipse.osee.framework.jini,
- org.eclipse.nebula.widgets.xviewer,
- org.eclipse.osee.framework.ui.skynet,
- org.eclipse.ui.workbench.texteditor;bundle-version="3.5.0",
- org.eclipse.osee.framework.skynet.core,
- org.eclipse.osee.framework.core;bundle-version="0.9.1",
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Coverage Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.coverage;singleton:=true
+Bundle-Version: 0.9.5.qualifier
+Bundle-Activator: org.eclipse.osee.coverage.internal.Activator
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Eclipse-ExtensibleAPI: true
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.filesystem,
+ org.eclipse.osee.framework.jdk.core,
+ org.eclipse.ui.ide,
+ org.eclipse.search,
+ org.eclipse.osee.framework.plugin.core,
+ org.eclipse.osee.framework.ui.plugin,
+ org.eclipse.osee.framework.database,
+ org.eclipse.ui.forms,
+ org.eclipse.osee.framework.messaging.event.skynet,
+ org.eclipse.osee.framework.jini,
+ org.eclipse.nebula.widgets.xviewer,
+ org.eclipse.osee.framework.ui.skynet,
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.5.0",
+ org.eclipse.osee.framework.skynet.core,
+ org.eclipse.osee.framework.core;bundle-version="0.9.1",
org.eclipse.osee.framework.messaging;bundle-version="0.9.4",
org.apache.commons.lang;bundle-version="2.4.0"
-Bundle-ActivationPolicy: lazy
-Import-Package: com.lowagie.text;version="2.1.7",
- com.lowagie.text.pdf;version="2.1.7",
- org.eclipse.osee.framework.core.client,
- org.eclipse.osee.framework.core.data,
- org.eclipse.osee.framework.core.enums,
- org.eclipse.osee.framework.core.exception,
- org.eclipse.osee.framework.core.model,
- org.eclipse.osee.framework.core.model.event,
- org.eclipse.osee.framework.core.operation,
- org.eclipse.osee.framework.logging,
- org.eclipse.osee.framework.skynet.core,
- org.eclipse.osee.framework.access,
- org.eclipse.osee.framework.skynet.core.artifact,
- org.eclipse.osee.framework.skynet.core.artifact.search,
- org.eclipse.osee.framework.skynet.core.attribute,
- org.eclipse.osee.framework.skynet.core.linking,
- org.eclipse.osee.framework.skynet.core.relation,
- org.eclipse.osee.framework.skynet.core.transaction,
- org.eclipse.osee.framework.skynet.core.utility,
- org.eclipse.osee.framework.skynet.core.word,
- org.eclipse.osee.framework.ui.skynet,
- org.eclipse.osee.framework.ui.skynet.artifact.editor,
- org.eclipse.osee.framework.ui.skynet.ats,
- org.eclipse.osee.framework.ui.skynet.blam,
- org.eclipse.osee.framework.ui.skynet.branch,
- org.eclipse.osee.framework.ui.skynet.commandHandlers,
- org.eclipse.osee.framework.ui.skynet.render,
- org.eclipse.osee.framework.ui.skynet.results,
- org.eclipse.osee.framework.ui.skynet.results.html,
- org.eclipse.osee.framework.ui.skynet.results.table,
- org.eclipse.osee.framework.ui.skynet.search,
- org.eclipse.osee.framework.ui.skynet.templates,
- org.eclipse.osee.framework.ui.skynet.util,
- org.eclipse.osee.framework.ui.skynet.widgets,
- org.eclipse.osee.framework.ui.skynet.widgets.xBranch,
- org.eclipse.osee.framework.ui.skynet.widgets.xHistory,
- org.eclipse.osee.framework.ui.skynet.widgets.xnavigate,
- org.eclipse.osee.framework.ui.swt
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.eclipse.osee.coverage,
- org.eclipse.osee.coverage.blam,
- org.eclipse.osee.coverage.util,
- org.eclipse.osee.coverage.vcast
+Bundle-ActivationPolicy: lazy
+Import-Package: com.lowagie.text;version="2.1.7",
+ com.lowagie.text.pdf;version="2.1.7",
+ org.eclipse.osee.framework.core.client,
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.enums,
+ org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.model.event,
+ org.eclipse.osee.framework.core.operation,
+ org.eclipse.osee.framework.logging,
+ org.eclipse.osee.framework.skynet.core,
+ org.eclipse.osee.framework.access,
+ org.eclipse.osee.framework.skynet.core.artifact,
+ org.eclipse.osee.framework.skynet.core.artifact.search,
+ org.eclipse.osee.framework.skynet.core.attribute,
+ org.eclipse.osee.framework.skynet.core.linking,
+ org.eclipse.osee.framework.skynet.core.relation,
+ org.eclipse.osee.framework.skynet.core.transaction,
+ org.eclipse.osee.framework.skynet.core.utility,
+ org.eclipse.osee.framework.skynet.core.word,
+ org.eclipse.osee.framework.ui.skynet,
+ org.eclipse.osee.framework.ui.skynet.artifact.editor,
+ org.eclipse.osee.framework.ui.skynet.ats,
+ org.eclipse.osee.framework.ui.skynet.blam,
+ org.eclipse.osee.framework.ui.skynet.branch,
+ org.eclipse.osee.framework.ui.skynet.commandHandlers,
+ org.eclipse.osee.framework.ui.skynet.render,
+ org.eclipse.osee.framework.ui.skynet.results,
+ org.eclipse.osee.framework.ui.skynet.results.html,
+ org.eclipse.osee.framework.ui.skynet.results.table,
+ org.eclipse.osee.framework.ui.skynet.search,
+ org.eclipse.osee.framework.ui.skynet.templates,
+ org.eclipse.osee.framework.ui.skynet.util,
+ org.eclipse.osee.framework.ui.skynet.widgets,
+ org.eclipse.osee.framework.ui.skynet.widgets.xBranch,
+ org.eclipse.osee.framework.ui.skynet.widgets.xHistory,
+ org.eclipse.osee.framework.ui.skynet.widgets.xnavigate,
+ org.eclipse.osee.framework.ui.swt
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: org.eclipse.osee.coverage,
+ org.eclipse.osee.coverage.blam,
+ org.eclipse.osee.coverage.util,
+ org.eclipse.osee.coverage.vcast
diff --git a/plugins/org.eclipse.osee.coverage/plugin.xml b/plugins/org.eclipse.osee.coverage/plugin.xml
index de979ee450..ac0e8d122a 100644
--- a/plugins/org.eclipse.osee.coverage/plugin.xml
+++ b/plugins/org.eclipse.osee.coverage/plugin.xml
@@ -1,111 +1,111 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="CoverageNavigateItem" name="CoverageNavigateItem" schema="schema/CoverageNavigateItem.exsd"/>
- <extension point="org.eclipse.ui.editors">
- <editor
- class="org.eclipse.osee.coverage.editor.CoverageEditor"
- default="false"
- icon="images/coverage.gif"
- id="org.eclipse.osee.coverage.editor.CoverageEditor"
- name="Coverage Editor">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- class="org.eclipse.osee.coverage.internal.CoveragePerspectiveFactory"
- fixed="false"
- icon="images/coverage.gif"
- id="org.eclipse.osee.coverage.CoveragePerspective"
- name="Coverage"/>
- </extension>
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
- <perspectiveShortcut id="org.eclipse.osee.coverage.CoveragePerspective"/>
- </perspectiveExtension>
- <perspectiveExtension targetID="osee.define.PerspectiveFactory">
- <perspectiveShortcut id="org.eclipse.osee.coverage.CoveragePerspective"/>
- </perspectiveExtension>
- <perspectiveExtension targetID="org.eclipse.jdt.ui.JavaPerspective">
- <perspectiveShortcut id="org.eclipse.osee.coverage.CoveragePerspective"/>
- </perspectiveExtension>
- <perspectiveExtension targetID="org.eclipse.osee.coverage.CoveragePerspective">
- <perspectiveShortcut id="org.eclipse.jdt.ui.JavaPerspective"/>
- <perspectiveShortcut id="org.eclipse.ui.resourcePerspective"/>
- <perspectiveShortcut id="osee.define.PerspectiveFactory"/>
- <perspectiveShortcut id="org.eclipse.osee.ats.ATSPerspective"/>
- <perspectiveShortcut id="osee.define.PerspectiveFactory"/>
- </perspectiveExtension>
- </extension>
- <extension
- point="org.eclipse.ui.views">
- <category
- name="OSEE Coverage"
- id="osee.coverage.category">
- </category>
- <view
- allowMultiple="false"
- category="osee.coverage.category"
- class="org.eclipse.osee.coverage.navigate.CoverageNavigateView"
- icon="images/coverage.gif"
- id="org.eclipse.osee.coverage.navigate.CoverageNavigateView"
- name="Coverage Navigator"/>
- </extension>
- <extension
- point="org.eclipse.osee.framework.ui.skynet.XWidgetProvider">
- <XWidgetProvider
- classname="org.eclipse.osee.coverage.util.widget.CoverageXWidgetFactory">
- </XWidgetProvider>
- </extension>
- <extension
- id="OseeTypes_Coverage"
- name="OseeTypes_Coverage"
- point="org.eclipse.osee.framework.skynet.core.OseeTypes">
- <OseeTypes
- resource="support/OseeTypes_Coverage.osee">
- </OseeTypes>
- </extension>
- <extension
- point="org.eclipse.osee.framework.ui.skynet.ArtifactImageProvider">
- <ArtifactImageProvider
- class="org.eclipse.osee.coverage.store.CoverageArtifactImageProvider">
- </ArtifactImageProvider>
- </extension>
- <extension
- point="org.eclipse.ui.commandImages">
- <image
- commandId="org.eclipse.osee.coverage.editor.command"
- icon="images/coveragePackage.gif">
- </image>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- id="org.eclipse.osee.coverage.editor.command"
- name="Coverage Editor">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.osee.coverage.editor.CoverageEditorHandler"
- commandId="org.eclipse.osee.coverage.editor.command">
- <enabledWhen>
- <with
- variable="selection">
- <count
- value="+">
- </count>
- </with>
- </enabledWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.osee.framework.ui.skynet.ArtifactRenderer">
- <Renderer
- classname="org.eclipse.osee.coverage.editor.CoverageRenderer">
- </Renderer>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension-point id="CoverageNavigateItem" name="CoverageNavigateItem" schema="schema/CoverageNavigateItem.exsd"/>
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.osee.coverage.editor.CoverageEditor"
+ default="false"
+ icon="images/coverage.gif"
+ id="org.eclipse.osee.coverage.editor.CoverageEditor"
+ name="Coverage Editor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ class="org.eclipse.osee.coverage.internal.CoveragePerspectiveFactory"
+ fixed="false"
+ icon="images/coverage.gif"
+ id="org.eclipse.osee.coverage.CoveragePerspective"
+ name="Coverage"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
+ <perspectiveShortcut id="org.eclipse.osee.coverage.CoveragePerspective"/>
+ </perspectiveExtension>
+ <perspectiveExtension targetID="osee.define.PerspectiveFactory">
+ <perspectiveShortcut id="org.eclipse.osee.coverage.CoveragePerspective"/>
+ </perspectiveExtension>
+ <perspectiveExtension targetID="org.eclipse.jdt.ui.JavaPerspective">
+ <perspectiveShortcut id="org.eclipse.osee.coverage.CoveragePerspective"/>
+ </perspectiveExtension>
+ <perspectiveExtension targetID="org.eclipse.osee.coverage.CoveragePerspective">
+ <perspectiveShortcut id="org.eclipse.jdt.ui.JavaPerspective"/>
+ <perspectiveShortcut id="org.eclipse.ui.resourcePerspective"/>
+ <perspectiveShortcut id="osee.define.PerspectiveFactory"/>
+ <perspectiveShortcut id="org.eclipse.osee.ats.ATSPerspective"/>
+ <perspectiveShortcut id="osee.define.PerspectiveFactory"/>
+ </perspectiveExtension>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="OSEE Coverage"
+ id="osee.coverage.category">
+ </category>
+ <view
+ allowMultiple="false"
+ category="osee.coverage.category"
+ class="org.eclipse.osee.coverage.navigate.CoverageNavigateView"
+ icon="images/coverage.gif"
+ id="org.eclipse.osee.coverage.navigate.CoverageNavigateView"
+ name="Coverage Navigator"/>
+ </extension>
+ <extension
+ point="org.eclipse.osee.framework.ui.skynet.XWidgetProvider">
+ <XWidgetProvider
+ classname="org.eclipse.osee.coverage.util.widget.CoverageXWidgetFactory">
+ </XWidgetProvider>
+ </extension>
+ <extension
+ id="OseeTypes_Coverage"
+ name="OseeTypes_Coverage"
+ point="org.eclipse.osee.framework.skynet.core.OseeTypes">
+ <OseeTypes
+ resource="support/OseeTypes_Coverage.osee">
+ </OseeTypes>
+ </extension>
+ <extension
+ point="org.eclipse.osee.framework.ui.skynet.ArtifactImageProvider">
+ <ArtifactImageProvider
+ class="org.eclipse.osee.coverage.store.CoverageArtifactImageProvider">
+ </ArtifactImageProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.eclipse.osee.coverage.editor.command"
+ icon="images/coveragePackage.gif">
+ </image>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.osee.coverage.editor.command"
+ name="Coverage Editor">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.osee.coverage.editor.CoverageEditorHandler"
+ commandId="org.eclipse.osee.coverage.editor.command">
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count
+ value="+">
+ </count>
+ </with>
+ </enabledWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.osee.framework.ui.skynet.ArtifactRenderer">
+ <Renderer
+ classname="org.eclipse.osee.coverage.editor.CoverageRenderer">
+ </Renderer>
</extension>
-</plugin>
+</plugin>
diff --git a/plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/CoveragePackageSave.java b/plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/CoveragePackageSave.java
index 720f733991..a1f2cffb35 100644
--- a/plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/CoveragePackageSave.java
+++ b/plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/CoveragePackageSave.java
@@ -1,293 +1,293 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.04.08 at 07:37:57 AM MST
-//
-
-
-package org.eclipse.osee.coverage.msgs;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for CoveragePackageSave complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="CoveragePackageSave">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="guids" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="sourceObject" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="machineName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="userId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="machineIp" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="clientVersion" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="port" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "CoveragePackageSave", propOrder = {
- "name",
- "guids",
- "sourceObject",
- "sessionId",
- "machineName",
- "userId",
- "machineIp",
- "clientVersion",
- "port"
-})
-public class CoveragePackageSave {
-
- @XmlElement(required = true)
- protected String name;
- @XmlElement(required = true)
- protected String guids;
- @XmlElement(required = true)
- protected String sourceObject;
- @XmlElement(required = true)
- protected String sessionId;
- @XmlElement(required = true)
- protected String machineName;
- @XmlElement(required = true)
- protected String userId;
- @XmlElement(required = true)
- protected String machineIp;
- @XmlElement(required = true)
- protected String clientVersion;
- @XmlElement(required = true)
- protected String port;
-
- /**
- * Gets the value of the name property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the name property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setName(String value) {
- this.name = value;
- }
-
- /**
- * Gets the value of the guids property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getGuids() {
- return guids;
- }
-
- /**
- * Sets the value of the guids property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setGuids(String value) {
- this.guids = value;
- }
-
- /**
- * Gets the value of the sourceObject property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSourceObject() {
- return sourceObject;
- }
-
- /**
- * Sets the value of the sourceObject property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSourceObject(String value) {
- this.sourceObject = value;
- }
-
- /**
- * Gets the value of the sessionId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSessionId() {
- return sessionId;
- }
-
- /**
- * Sets the value of the sessionId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSessionId(String value) {
- this.sessionId = value;
- }
-
- /**
- * Gets the value of the machineName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMachineName() {
- return machineName;
- }
-
- /**
- * Sets the value of the machineName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMachineName(String value) {
- this.machineName = value;
- }
-
- /**
- * Gets the value of the userId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getUserId() {
- return userId;
- }
-
- /**
- * Sets the value of the userId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setUserId(String value) {
- this.userId = value;
- }
-
- /**
- * Gets the value of the machineIp property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMachineIp() {
- return machineIp;
- }
-
- /**
- * Sets the value of the machineIp property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMachineIp(String value) {
- this.machineIp = value;
- }
-
- /**
- * Gets the value of the clientVersion property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getClientVersion() {
- return clientVersion;
- }
-
- /**
- * Sets the value of the clientVersion property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setClientVersion(String value) {
- this.clientVersion = value;
- }
-
- /**
- * Gets the value of the port property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getPort() {
- return port;
- }
-
- /**
- * Sets the value of the port property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setPort(String value) {
- this.port = value;
- }
-
-}
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2010.04.08 at 07:37:57 AM MST
+//
+
+
+package org.eclipse.osee.coverage.msgs;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for CoveragePackageSave complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="CoveragePackageSave">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="guids" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="sourceObject" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="machineName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="userId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="machineIp" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="clientVersion" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="port" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "CoveragePackageSave", propOrder = {
+ "name",
+ "guids",
+ "sourceObject",
+ "sessionId",
+ "machineName",
+ "userId",
+ "machineIp",
+ "clientVersion",
+ "port"
+})
+public class CoveragePackageSave {
+
+ @XmlElement(required = true)
+ protected String name;
+ @XmlElement(required = true)
+ protected String guids;
+ @XmlElement(required = true)
+ protected String sourceObject;
+ @XmlElement(required = true)
+ protected String sessionId;
+ @XmlElement(required = true)
+ protected String machineName;
+ @XmlElement(required = true)
+ protected String userId;
+ @XmlElement(required = true)
+ protected String machineIp;
+ @XmlElement(required = true)
+ protected String clientVersion;
+ @XmlElement(required = true)
+ protected String port;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the guids property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getGuids() {
+ return guids;
+ }
+
+ /**
+ * Sets the value of the guids property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setGuids(String value) {
+ this.guids = value;
+ }
+
+ /**
+ * Gets the value of the sourceObject property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSourceObject() {
+ return sourceObject;
+ }
+
+ /**
+ * Sets the value of the sourceObject property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSourceObject(String value) {
+ this.sourceObject = value;
+ }
+
+ /**
+ * Gets the value of the sessionId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ /**
+ * Sets the value of the sessionId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSessionId(String value) {
+ this.sessionId = value;
+ }
+
+ /**
+ * Gets the value of the machineName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMachineName() {
+ return machineName;
+ }
+
+ /**
+ * Sets the value of the machineName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMachineName(String value) {
+ this.machineName = value;
+ }
+
+ /**
+ * Gets the value of the userId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getUserId() {
+ return userId;
+ }
+
+ /**
+ * Sets the value of the userId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setUserId(String value) {
+ this.userId = value;
+ }
+
+ /**
+ * Gets the value of the machineIp property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMachineIp() {
+ return machineIp;
+ }
+
+ /**
+ * Sets the value of the machineIp property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMachineIp(String value) {
+ this.machineIp = value;
+ }
+
+ /**
+ * Gets the value of the clientVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getClientVersion() {
+ return clientVersion;
+ }
+
+ /**
+ * Sets the value of the clientVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setClientVersion(String value) {
+ this.clientVersion = value;
+ }
+
+ /**
+ * Gets the value of the port property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPort() {
+ return port;
+ }
+
+ /**
+ * Sets the value of the port property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPort(String value) {
+ this.port = value;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/ObjectFactory.java b/plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/ObjectFactory.java
index afc7e0815e..8a962bab5a 100644
--- a/plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/ObjectFactory.java
+++ b/plugins/org.eclipse.osee.coverage/src-gen/org/eclipse/osee/coverage/msgs/ObjectFactory.java
@@ -1,60 +1,60 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.04.08 at 07:37:57 AM MST
-//
-
-
-package org.eclipse.osee.coverage.msgs;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.eclipse.osee.coverage.msgs package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- private final static QName _CoveragePackageSave_QNAME = new QName("", "CoveragePackageSave");
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.eclipse.osee.coverage.msgs
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link CoveragePackageSave }
- *
- */
- public CoveragePackageSave createCoveragePackageSave() {
- return new CoveragePackageSave();
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link CoveragePackageSave }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "", name = "CoveragePackageSave")
- public JAXBElement<CoveragePackageSave> createCoveragePackageSave(CoveragePackageSave value) {
- return new JAXBElement<CoveragePackageSave>(_CoveragePackageSave_QNAME, CoveragePackageSave.class, null, value);
- }
-
-}
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2010.04.08 at 07:37:57 AM MST
+//
+
+
+package org.eclipse.osee.coverage.msgs;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.eclipse.osee.coverage.msgs package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _CoveragePackageSave_QNAME = new QName("", "CoveragePackageSave");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.eclipse.osee.coverage.msgs
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link CoveragePackageSave }
+ *
+ */
+ public CoveragePackageSave createCoveragePackageSave() {
+ return new CoveragePackageSave();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link CoveragePackageSave }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "CoveragePackageSave")
+ public JAXBElement<CoveragePackageSave> createCoveragePackageSave(CoveragePackageSave value) {
+ return new JAXBElement<CoveragePackageSave>(_CoveragePackageSave_QNAME, CoveragePackageSave.class, null, value);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/CoverageManager.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/CoverageManager.java
index 768b513f33..16218470e9 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/CoverageManager.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/CoverageManager.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.coverage.blam.AbstractCoverageBlam;
-import org.eclipse.osee.coverage.editor.CoverageEditor;
-import org.eclipse.osee.coverage.editor.CoverageEditorInput;
-import org.eclipse.osee.coverage.model.CoverageImport;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-import org.eclipse.osee.framework.ui.skynet.blam.BlamContributionManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageManager {
-
- public static void importCoverage(ICoverageImporter coverageImporter) throws OseeCoreException {
- CoverageImport coverageImport = coverageImporter.run(null);
- CoverageEditor.open(new CoverageEditorInput(coverageImport.getName(), null, coverageImport, false));
- }
-
- public static Collection<AbstractCoverageBlam> getCoverageBlams() {
- List<AbstractCoverageBlam> blams = new ArrayList<AbstractCoverageBlam>();
- for (AbstractBlam blam : BlamContributionManager.getBlamOperations()) {
- if (blam instanceof AbstractCoverageBlam) {
- blams.add((AbstractCoverageBlam) blam);
- }
- }
- return blams;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.coverage.blam.AbstractCoverageBlam;
+import org.eclipse.osee.coverage.editor.CoverageEditor;
+import org.eclipse.osee.coverage.editor.CoverageEditorInput;
+import org.eclipse.osee.coverage.model.CoverageImport;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
+import org.eclipse.osee.framework.ui.skynet.blam.BlamContributionManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageManager {
+
+ public static void importCoverage(ICoverageImporter coverageImporter) throws OseeCoreException {
+ CoverageImport coverageImport = coverageImporter.run(null);
+ CoverageEditor.open(new CoverageEditorInput(coverageImport.getName(), null, coverageImport, false));
+ }
+
+ public static Collection<AbstractCoverageBlam> getCoverageBlams() {
+ List<AbstractCoverageBlam> blams = new ArrayList<AbstractCoverageBlam>();
+ for (AbstractBlam blam : BlamContributionManager.getBlamOperations()) {
+ if (blam instanceof AbstractCoverageBlam) {
+ blams.add((AbstractCoverageBlam) blam);
+ }
+ }
+ return blams;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/ICoverageImporter.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/ICoverageImporter.java
index 1ba6891754..78ad8f0ec2 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/ICoverageImporter.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/ICoverageImporter.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.coverage.model.CoverageImport;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ICoverageImporter {
-
- public String getName();
-
- public CoverageImport run(IProgressMonitor progressMonitor);
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.coverage.model.CoverageImport;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ICoverageImporter {
+
+ public String getName();
+
+ public CoverageImport run(IProgressMonitor progressMonitor);
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ConfigureCoverageMethodsAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ConfigureCoverageMethodsAction.java
index dedb60c51a..18fcce3b35 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ConfigureCoverageMethodsAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ConfigureCoverageMethodsAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jface.action.Action;
@@ -35,108 +35,108 @@ import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class ConfigureCoverageMethodsAction extends Action {
-
- public static KeyedImage OSEE_IMAGE = FrameworkImage.GEAR;
-
- public ConfigureCoverageMethodsAction() {
- super("Configure Coverage Methods");
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(OSEE_IMAGE);
- }
-
- @Override
- public void run() {
- try {
- if (!CoverageUtil.getBranchFromUser(false)) {
- return;
- }
- CoveragePackageArtifactListDialog dialog =
- new CoveragePackageArtifactListDialog("Open Coverage Package", "Select Coverage Package");
- dialog.setInput(OseeCoveragePackageStore.getCoveragePackageArtifacts(CoverageUtil.getBranch()));
- if (dialog.open() == 0) {
- Artifact coveragePackageArtifact = (Artifact) dialog.getResult()[0];
- OseeCoveragePackageStore packageStore = new OseeCoveragePackageStore(coveragePackageArtifact);
- CoverageOptionManagerStore optionsStore = new CoverageOptionManagerStore(packageStore);
- Result isSaveable = optionsStore.isSaveable();
- if (isSaveable.isFalse()) {
- isSaveable.popup();
- return;
- }
- String coverageOptions = null;
- StoreLocation storeLocation = optionsStore.getStoreLocation();
- if (storeLocation == StoreLocation.None) {
- MessageDialog localGlobalDialog =
- new MessageDialog(Displays.getActiveShell(), "Question", null,
- "No Custom Coverage Methods Configured, Configure Now?", MessageDialog.WARNING,
- new String[] {"Save local to Coverage Pacakge", "Save globally for Branch", "Cancel"}, 0);
-
- int result = localGlobalDialog.open();
- if (result == 0) {
- storeLocation = StoreLocation.Local;
- } else if (result == 1) {
- storeLocation = StoreLocation.Global;
- } else {
- return;
- }
- coverageOptions = CoverageOptionManagerDefault.instance().toXml();
- } else {
- coverageOptions = optionsStore.getCoverageOptions();
- }
-
- // Recheck save after option has been chosen
- optionsStore = new CoverageOptionManagerStore(packageStore);
- isSaveable = optionsStore.isSaveable();
- if (isSaveable.isFalse()) {
- isSaveable.popup();
- return;
- }
-
- boolean successOrCancel = false;
- // Keep allowing user to enter options until valid
- while (!successOrCancel) {
- EntryDialog entryDiag = new EntryDialog(getText(), "Edit Configure Options");
- entryDiag.setFillVertically(true);
- entryDiag.setEntry(coverageOptions);
- if (entryDiag.open() == 0) {
- coverageOptions = entryDiag.getEntry();
- try {
- CoverageOptionManager manager = new CoverageOptionManager(coverageOptions);
- if (manager.get().isEmpty()) {
- throw new OseeArgumentException("No options specified");
- }
- if (manager.get(CoverageOptionManager.Not_Covered.getName()) == null) {
- throw new OseeArgumentException("Can't remove Not_Covered item");
- }
- Set<String> names = new HashSet<String>();
- for (CoverageOption option : manager.get()) {
- if (names.contains(option.getName())) {
- throw new OseeArgumentException(String.format("Multiple options with same name [%s]",
- option.getName()));
- } else {
- names.add(option.getName());
- }
- }
- optionsStore.store(coverageOptions, storeLocation);
- successOrCancel = true;
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP,
- "Invalid coverage options\n\n" + ex.getLocalizedMessage(), ex);
- }
- } else {
- successOrCancel = true;
- }
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ConfigureCoverageMethodsAction extends Action {
+
+ public static KeyedImage OSEE_IMAGE = FrameworkImage.GEAR;
+
+ public ConfigureCoverageMethodsAction() {
+ super("Configure Coverage Methods");
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(OSEE_IMAGE);
+ }
+
+ @Override
+ public void run() {
+ try {
+ if (!CoverageUtil.getBranchFromUser(false)) {
+ return;
+ }
+ CoveragePackageArtifactListDialog dialog =
+ new CoveragePackageArtifactListDialog("Open Coverage Package", "Select Coverage Package");
+ dialog.setInput(OseeCoveragePackageStore.getCoveragePackageArtifacts(CoverageUtil.getBranch()));
+ if (dialog.open() == 0) {
+ Artifact coveragePackageArtifact = (Artifact) dialog.getResult()[0];
+ OseeCoveragePackageStore packageStore = new OseeCoveragePackageStore(coveragePackageArtifact);
+ CoverageOptionManagerStore optionsStore = new CoverageOptionManagerStore(packageStore);
+ Result isSaveable = optionsStore.isSaveable();
+ if (isSaveable.isFalse()) {
+ isSaveable.popup();
+ return;
+ }
+ String coverageOptions = null;
+ StoreLocation storeLocation = optionsStore.getStoreLocation();
+ if (storeLocation == StoreLocation.None) {
+ MessageDialog localGlobalDialog =
+ new MessageDialog(Displays.getActiveShell(), "Question", null,
+ "No Custom Coverage Methods Configured, Configure Now?", MessageDialog.WARNING,
+ new String[] {"Save local to Coverage Pacakge", "Save globally for Branch", "Cancel"}, 0);
+
+ int result = localGlobalDialog.open();
+ if (result == 0) {
+ storeLocation = StoreLocation.Local;
+ } else if (result == 1) {
+ storeLocation = StoreLocation.Global;
+ } else {
+ return;
+ }
+ coverageOptions = CoverageOptionManagerDefault.instance().toXml();
+ } else {
+ coverageOptions = optionsStore.getCoverageOptions();
+ }
+
+ // Recheck save after option has been chosen
+ optionsStore = new CoverageOptionManagerStore(packageStore);
+ isSaveable = optionsStore.isSaveable();
+ if (isSaveable.isFalse()) {
+ isSaveable.popup();
+ return;
+ }
+
+ boolean successOrCancel = false;
+ // Keep allowing user to enter options until valid
+ while (!successOrCancel) {
+ EntryDialog entryDiag = new EntryDialog(getText(), "Edit Configure Options");
+ entryDiag.setFillVertically(true);
+ entryDiag.setEntry(coverageOptions);
+ if (entryDiag.open() == 0) {
+ coverageOptions = entryDiag.getEntry();
+ try {
+ CoverageOptionManager manager = new CoverageOptionManager(coverageOptions);
+ if (manager.get().isEmpty()) {
+ throw new OseeArgumentException("No options specified");
+ }
+ if (manager.get(CoverageOptionManager.Not_Covered.getName()) == null) {
+ throw new OseeArgumentException("Can't remove Not_Covered item");
+ }
+ Set<String> names = new HashSet<String>();
+ for (CoverageOption option : manager.get()) {
+ if (names.contains(option.getName())) {
+ throw new OseeArgumentException(String.format("Multiple options with same name [%s]",
+ option.getName()));
+ } else {
+ names.add(option.getName());
+ }
+ }
+ optionsStore.store(coverageOptions, storeLocation);
+ successOrCancel = true;
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP,
+ "Invalid coverage options\n\n" + ex.getLocalizedMessage(), ex);
+ }
+ } else {
+ successOrCancel = true;
+ }
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoverUnitAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoverUnitAction.java
index 465c72ef24..e6f2d5f0ad 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoverUnitAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoverUnitAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.action.Action;
@@ -30,72 +30,72 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class DeleteCoverUnitAction extends Action {
- private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
- private final ISaveable saveable;
- private final IRefreshable refreshable;
-
- public DeleteCoverUnitAction(ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
- super("Delete Coverage Unit");
- this.selectedCoverageEditorItem = selectedCoverageEditorItem;
- this.refreshable = refreshable;
- this.saveable = saveable;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.DELETE);
- }
-
- @Override
- public void run() {
- if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
- AWorkbench.popup("Select Coverage Unit");
- return;
- }
- for (ICoverage item : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (!(item instanceof CoverageUnit)) {
- AWorkbench.popup("Can only delete Coverage Units");
- return;
- }
- }
- Result result = saveable.isEditable();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- if (MessageDialog.openConfirm(Displays.getActiveShell(), "Delete Coverage Unit",
- "Delete Coverage Units")) {
- try {
- SkynetTransaction transaction =
- new SkynetTransaction(saveable.getBranch(), "Coverage - Delete Coverage Unit");
- List<ICoverage> deleteItems = new ArrayList<ICoverage>();
- for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverageItem.getParent() instanceof ICoverageUnitProvider) {
- ((ICoverageUnitProvider) coverageItem.getParent()).removeCoverageUnit((CoverageUnit) coverageItem);
- deleteItems.add(coverageItem);
- new OseeCoverageUnitStore((CoverageUnit) coverageItem, saveable.getBranch()).delete(transaction,
- false);
- }
- }
- transaction.execute();
- for (ICoverage coverageItem : deleteItems) {
- refreshable.remove(coverageItem);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
- }
- try {
- saveable.save();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DeleteCoverUnitAction extends Action {
+ private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
+ private final ISaveable saveable;
+ private final IRefreshable refreshable;
+
+ public DeleteCoverUnitAction(ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
+ super("Delete Coverage Unit");
+ this.selectedCoverageEditorItem = selectedCoverageEditorItem;
+ this.refreshable = refreshable;
+ this.saveable = saveable;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.DELETE);
+ }
+
+ @Override
+ public void run() {
+ if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
+ AWorkbench.popup("Select Coverage Unit");
+ return;
+ }
+ for (ICoverage item : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (!(item instanceof CoverageUnit)) {
+ AWorkbench.popup("Can only delete Coverage Units");
+ return;
+ }
+ }
+ Result result = saveable.isEditable();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ if (MessageDialog.openConfirm(Displays.getActiveShell(), "Delete Coverage Unit",
+ "Delete Coverage Units")) {
+ try {
+ SkynetTransaction transaction =
+ new SkynetTransaction(saveable.getBranch(), "Coverage - Delete Coverage Unit");
+ List<ICoverage> deleteItems = new ArrayList<ICoverage>();
+ for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (coverageItem.getParent() instanceof ICoverageUnitProvider) {
+ ((ICoverageUnitProvider) coverageItem.getParent()).removeCoverageUnit((CoverageUnit) coverageItem);
+ deleteItems.add(coverageItem);
+ new OseeCoverageUnitStore((CoverageUnit) coverageItem, saveable.getBranch()).delete(transaction,
+ false);
+ }
+ }
+ transaction.execute();
+ for (ICoverage coverageItem : deleteItems) {
+ refreshable.remove(coverageItem);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+ }
+ try {
+ saveable.save();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoveragePackageAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoveragePackageAction.java
index 30ed627c21..277e811965 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoveragePackageAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/DeleteCoveragePackageAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.coverage.internal.Activator;
@@ -27,56 +27,56 @@ import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.widgets.dialog.CheckBoxDialog;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class DeleteCoveragePackageAction extends Action {
-
- public static KeyedImage OSEE_IMAGE = FrameworkImage.DELETE;
-
- public DeleteCoveragePackageAction() {
- super("Delete/Purge Coverage Package");
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(OSEE_IMAGE);
- }
-
- @Override
- public void run() {
- try {
- if (!CoverageUtil.getBranchFromUser(false)) {
- return;
- }
- Branch branch = CoverageUtil.getBranch();
- CoveragePackageArtifactListDialog dialog =
- new CoveragePackageArtifactListDialog("Delete Package", "Select Package");
- dialog.setInput(OseeCoveragePackageStore.getCoveragePackageArtifacts(branch));
- if (dialog.open() == 0) {
- Artifact coveragePackageArtifact = (Artifact) dialog.getResult()[0];
- CoveragePackage coveragePackage = OseeCoveragePackageStore.get(coveragePackageArtifact);
- CheckBoxDialog cDialog =
- new CheckBoxDialog(
- "Delete/Purge Package",
- String.format(
- "This will delete Coverage Package and all realted Coverage Units and Test Units.\n\nDelete/Purge Package [%s]?",
- coveragePackage.getName()), "Purge");
- if (cDialog.open() == 0) {
- boolean purge = cDialog.isChecked();
- SkynetTransaction transaction = null;
- if (!purge) {
- transaction = new SkynetTransaction(branch, "Delete Coverage Package");
- }
- OseeCoveragePackageStore.get(coveragePackage, branch).delete(transaction, purge);
- if (!purge) {
- transaction.execute();
- }
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DeleteCoveragePackageAction extends Action {
+
+ public static KeyedImage OSEE_IMAGE = FrameworkImage.DELETE;
+
+ public DeleteCoveragePackageAction() {
+ super("Delete/Purge Coverage Package");
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(OSEE_IMAGE);
+ }
+
+ @Override
+ public void run() {
+ try {
+ if (!CoverageUtil.getBranchFromUser(false)) {
+ return;
+ }
+ Branch branch = CoverageUtil.getBranch();
+ CoveragePackageArtifactListDialog dialog =
+ new CoveragePackageArtifactListDialog("Delete Package", "Select Package");
+ dialog.setInput(OseeCoveragePackageStore.getCoveragePackageArtifacts(branch));
+ if (dialog.open() == 0) {
+ Artifact coveragePackageArtifact = (Artifact) dialog.getResult()[0];
+ CoveragePackage coveragePackage = OseeCoveragePackageStore.get(coveragePackageArtifact);
+ CheckBoxDialog cDialog =
+ new CheckBoxDialog(
+ "Delete/Purge Package",
+ String.format(
+ "This will delete Coverage Package and all realted Coverage Units and Test Units.\n\nDelete/Purge Package [%s]?",
+ coveragePackage.getName()), "Purge");
+ if (cDialog.open() == 0) {
+ boolean purge = cDialog.isChecked();
+ SkynetTransaction transaction = null;
+ if (!purge) {
+ transaction = new SkynetTransaction(branch, "Delete Coverage Package");
+ }
+ OseeCoveragePackageStore.get(coveragePackage, branch).delete(transaction, purge);
+ if (!purge) {
+ transaction.execute();
+ }
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditAssigneesAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditAssigneesAction.java
index c4089f03f6..2857c7adca 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditAssigneesAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditAssigneesAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -31,72 +31,72 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserCheckTreeDialog;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class EditAssigneesAction extends Action {
- private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
- private final ISaveable saveable;
- private final IRefreshable refreshable;
-
- public EditAssigneesAction(ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
- super("Edit Assignees");
- this.selectedCoverageEditorItem = selectedCoverageEditorItem;
- this.refreshable = refreshable;
- this.saveable = saveable;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.USER);
- }
-
- @Override
- public void run() {
- if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
- AWorkbench.popup("Select Coverage Unit(s)");
- return;
- }
- for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (!(coverage instanceof CoverageUnit)) {
- AWorkbench.popup("Assignees can only be set on Coverage Units");
- return;
- }
- }
- Result result = saveable.isEditable();
- if (result.isFalse()) {
- result.popup();
- return;
- }
-
- try {
- Set<User> initalUsers = new HashSet<User>();
- for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverageItem.isAssignable()) {
- if (Strings.isValid(((CoverageUnit) coverageItem).getAssignees())) {
- initalUsers.addAll(UsersByIds.getUsers(((CoverageUnit) coverageItem).getAssignees()));
- }
- }
- }
-
- UserCheckTreeDialog uld = new UserCheckTreeDialog();
- uld.setInitialSelections(initalUsers);
- uld.setMessage("Select to assign.\nDeSelect to un-assign.");
- if (uld.open() == 0) {
- Collection<User> users = uld.getUsersSelected();
- Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
- for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverageItem.isAssignable()) {
- OseeCoverageUnitStore.setAssignees(((CoverageUnit) coverageItem), users);
- refreshable.update(coverageItem);
- coveragesToSave.add(coverageItem);
- }
- }
- saveable.save(coveragesToSave);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class EditAssigneesAction extends Action {
+ private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
+ private final ISaveable saveable;
+ private final IRefreshable refreshable;
+
+ public EditAssigneesAction(ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
+ super("Edit Assignees");
+ this.selectedCoverageEditorItem = selectedCoverageEditorItem;
+ this.refreshable = refreshable;
+ this.saveable = saveable;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.USER);
+ }
+
+ @Override
+ public void run() {
+ if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
+ AWorkbench.popup("Select Coverage Unit(s)");
+ return;
+ }
+ for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (!(coverage instanceof CoverageUnit)) {
+ AWorkbench.popup("Assignees can only be set on Coverage Units");
+ return;
+ }
+ }
+ Result result = saveable.isEditable();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+
+ try {
+ Set<User> initalUsers = new HashSet<User>();
+ for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (coverageItem.isAssignable()) {
+ if (Strings.isValid(((CoverageUnit) coverageItem).getAssignees())) {
+ initalUsers.addAll(UsersByIds.getUsers(((CoverageUnit) coverageItem).getAssignees()));
+ }
+ }
+ }
+
+ UserCheckTreeDialog uld = new UserCheckTreeDialog();
+ uld.setInitialSelections(initalUsers);
+ uld.setMessage("Select to assign.\nDeSelect to un-assign.");
+ if (uld.open() == 0) {
+ Collection<User> users = uld.getUsersSelected();
+ Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
+ for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (coverageItem.isAssignable()) {
+ OseeCoverageUnitStore.setAssignees(((CoverageUnit) coverageItem), users);
+ refreshable.update(coverageItem);
+ coveragesToSave.add(coverageItem);
+ }
+ }
+ saveable.save(coveragesToSave);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java
index a2abe3ddce..03b84ce701 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jface.action.Action;
@@ -28,72 +28,72 @@ import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class EditCoverageMethodAction extends Action {
-
- private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
- private final ISaveable saveable;
- private final IRefreshable refreshable;
- private final CoverageXViewer coverageXViewer;
-
- public EditCoverageMethodAction(CoverageXViewer coverageXViewer, ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
- super("Edit Coverage Method");
- this.coverageXViewer = coverageXViewer;
- this.selectedCoverageEditorItem = selectedCoverageEditorItem;
- this.refreshable = refreshable;
- this.saveable = saveable;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.EDIT);
- }
-
- @Override
- public void run() {
- if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
- AWorkbench.popup("Select Coverage Item(s)");
- return;
- }
- for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (!(coverage instanceof CoverageItem)) {
- AWorkbench.popup("Coverage Method can only be set on Coverage Items");
- return;
- }
- CoverageItem item = (CoverageItem) coverage;
- if (!item.getCoverageMethod().isEnabled()) {
- AWorkbench.popup(String.format("Invalid to change locked Coverage Method [%s] for Coveage Item:\n\n[%s]",
- item.getCoverageMethod().getName(), item));
- return;
- }
- }
-
- Result result = saveable.isEditable();
- if (result.isFalse()) {
- result.popup();
- return;
- }
-
- CoverageMethodListDialog dialog =
- new CoverageMethodListDialog(coverageXViewer.getCoverageOptionManager().getEnabled());
- if (dialog.open() == 0) {
- Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
- for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverageItem instanceof CoverageItem) {
- ((CoverageItem) coverageItem).setCoverageMethod((CoverageOption) dialog.getFirstResult());
- refreshable.update(coverageItem);
- coveragesToSave.add(coverageItem);
- }
- }
- try {
- saveable.save(coveragesToSave);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class EditCoverageMethodAction extends Action {
+
+ private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
+ private final ISaveable saveable;
+ private final IRefreshable refreshable;
+ private final CoverageXViewer coverageXViewer;
+
+ public EditCoverageMethodAction(CoverageXViewer coverageXViewer, ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
+ super("Edit Coverage Method");
+ this.coverageXViewer = coverageXViewer;
+ this.selectedCoverageEditorItem = selectedCoverageEditorItem;
+ this.refreshable = refreshable;
+ this.saveable = saveable;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.EDIT);
+ }
+
+ @Override
+ public void run() {
+ if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
+ AWorkbench.popup("Select Coverage Item(s)");
+ return;
+ }
+ for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (!(coverage instanceof CoverageItem)) {
+ AWorkbench.popup("Coverage Method can only be set on Coverage Items");
+ return;
+ }
+ CoverageItem item = (CoverageItem) coverage;
+ if (!item.getCoverageMethod().isEnabled()) {
+ AWorkbench.popup(String.format("Invalid to change locked Coverage Method [%s] for Coveage Item:\n\n[%s]",
+ item.getCoverageMethod().getName(), item));
+ return;
+ }
+ }
+
+ Result result = saveable.isEditable();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+
+ CoverageMethodListDialog dialog =
+ new CoverageMethodListDialog(coverageXViewer.getCoverageOptionManager().getEnabled());
+ if (dialog.open() == 0) {
+ Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
+ for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (coverageItem instanceof CoverageItem) {
+ ((CoverageItem) coverageItem).setCoverageMethod((CoverageOption) dialog.getFirstResult());
+ refreshable.update(coverageItem);
+ coveragesToSave.add(coverageItem);
+ }
+ }
+ try {
+ saveable.save(coveragesToSave);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageNotesAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageNotesAction.java
index f8d4e5d35f..b6c9267c85 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageNotesAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageNotesAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jface.action.Action;
@@ -27,72 +27,72 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class EditCoverageNotesAction extends Action {
-
- private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
- private final ISaveable saveable;
- private final IRefreshable refreshable;
-
- public EditCoverageNotesAction(ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
- super("Edit Coverage Notes");
- this.selectedCoverageEditorItem = selectedCoverageEditorItem;
- this.refreshable = refreshable;
- this.saveable = saveable;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.EDIT);
- }
-
- @Override
- public void run() {
- if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
- AWorkbench.popup("Select Coverage Unit(s)");
- return;
- }
- for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (!(coverage instanceof CoverageUnit)) {
- AWorkbench.popup("Notes can only be set on Coverage Units");
- return;
- }
- }
-
- Result result = saveable.isEditable();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- Set<String> rationale = new HashSet<String>();
- for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverageItem instanceof CoverageUnit) {
- rationale.add(((CoverageUnit) coverageItem).getNotes());
- }
- }
- EntryDialog ed = new EntryDialog("Coverage Notes", "Enter Coverage Notes");
- if (rationale.size() == 1 && Strings.isValid(rationale.iterator().next())) {
- ed.setEntry(rationale.iterator().next());
- }
- if (ed.open() == 0) {
- Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
- for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverageItem instanceof CoverageUnit) {
- ((CoverageUnit) coverageItem).setNotes(ed.getEntry());
- refreshable.update(coverageItem);
- coveragesToSave.add(coverageItem);
- }
- }
- try {
- saveable.save(coveragesToSave);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
- }
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class EditCoverageNotesAction extends Action {
+
+ private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
+ private final ISaveable saveable;
+ private final IRefreshable refreshable;
+
+ public EditCoverageNotesAction(ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
+ super("Edit Coverage Notes");
+ this.selectedCoverageEditorItem = selectedCoverageEditorItem;
+ this.refreshable = refreshable;
+ this.saveable = saveable;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.EDIT);
+ }
+
+ @Override
+ public void run() {
+ if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
+ AWorkbench.popup("Select Coverage Unit(s)");
+ return;
+ }
+ for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (!(coverage instanceof CoverageUnit)) {
+ AWorkbench.popup("Notes can only be set on Coverage Units");
+ return;
+ }
+ }
+
+ Result result = saveable.isEditable();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ Set<String> rationale = new HashSet<String>();
+ for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (coverageItem instanceof CoverageUnit) {
+ rationale.add(((CoverageUnit) coverageItem).getNotes());
+ }
+ }
+ EntryDialog ed = new EntryDialog("Coverage Notes", "Enter Coverage Notes");
+ if (rationale.size() == 1 && Strings.isValid(rationale.iterator().next())) {
+ ed.setEntry(rationale.iterator().next());
+ }
+ if (ed.open() == 0) {
+ Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
+ for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (coverageItem instanceof CoverageUnit) {
+ ((CoverageUnit) coverageItem).setNotes(ed.getEntry());
+ refreshable.update(coverageItem);
+ coveragesToSave.add(coverageItem);
+ }
+ }
+ try {
+ saveable.save(coveragesToSave);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditRationaleAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditRationaleAction.java
index e4a8be2fac..29489f7144 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditRationaleAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditRationaleAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jface.action.Action;
@@ -27,72 +27,72 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class EditRationaleAction extends Action {
-
- private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
- private final ISaveable saveable;
- private final IRefreshable refreshable;
-
- public EditRationaleAction(ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
- super("Edit Rationale");
- this.selectedCoverageEditorItem = selectedCoverageEditorItem;
- this.refreshable = refreshable;
- this.saveable = saveable;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.EDIT);
- }
-
- @Override
- public void run() {
- if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
- AWorkbench.popup("Select Coverage Item(s)");
- return;
- }
- for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (!(coverage instanceof CoverageItem)) {
- AWorkbench.popup("Coverage Rationale can only be set on Coverage Items");
- return;
- }
- }
-
- Result result = saveable.isEditable();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- Set<String> rationale = new HashSet<String>();
- for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverageItem instanceof CoverageItem) {
- rationale.add(((CoverageItem) coverageItem).getRationale());
- }
- }
- EntryDialog ed = new EntryDialog("Coverage Rationale", "Enter Coverage Rationale");
- if (rationale.size() == 1 && Strings.isValid(rationale.iterator().next())) {
- ed.setEntry(rationale.iterator().next());
- }
- if (ed.open() == 0) {
- Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
- for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverageItem instanceof CoverageItem) {
- ((CoverageItem) coverageItem).setRationale(ed.getEntry());
- refreshable.update(coverageItem);
- coveragesToSave.add(coverageItem);
- }
- }
- try {
- saveable.save(coveragesToSave);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
- }
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class EditRationaleAction extends Action {
+
+ private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
+ private final ISaveable saveable;
+ private final IRefreshable refreshable;
+
+ public EditRationaleAction(ISelectedCoverageEditorItem selectedCoverageEditorItem, IRefreshable refreshable, ISaveable saveable) {
+ super("Edit Rationale");
+ this.selectedCoverageEditorItem = selectedCoverageEditorItem;
+ this.refreshable = refreshable;
+ this.saveable = saveable;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.EDIT);
+ }
+
+ @Override
+ public void run() {
+ if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
+ AWorkbench.popup("Select Coverage Item(s)");
+ return;
+ }
+ for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (!(coverage instanceof CoverageItem)) {
+ AWorkbench.popup("Coverage Rationale can only be set on Coverage Items");
+ return;
+ }
+ }
+
+ Result result = saveable.isEditable();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ Set<String> rationale = new HashSet<String>();
+ for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (coverageItem instanceof CoverageItem) {
+ rationale.add(((CoverageItem) coverageItem).getRationale());
+ }
+ }
+ EntryDialog ed = new EntryDialog("Coverage Rationale", "Enter Coverage Rationale");
+ if (rationale.size() == 1 && Strings.isValid(rationale.iterator().next())) {
+ ed.setEntry(rationale.iterator().next());
+ }
+ if (ed.open() == 0) {
+ Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
+ for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
+ if (coverageItem instanceof CoverageItem) {
+ ((CoverageItem) coverageItem).setRationale(ed.getEntry());
+ refreshable.update(coverageItem);
+ coveragesToSave.add(coverageItem);
+ }
+ }
+ try {
+ saveable.save(coveragesToSave);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/GenerateDetailedCoverageReportAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/GenerateDetailedCoverageReportAction.java
index 715055e685..61c95a7a05 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/GenerateDetailedCoverageReportAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/GenerateDetailedCoverageReportAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
@@ -41,102 +41,102 @@ import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.swt.program.Program;
import com.lowagie.text.Table;
-
-/**
- * @author Donald G. Dunne
- */
-public class GenerateDetailedCoverageReportAction extends Action {
-
- private final ICoveragePackageHandler coveragePackageHandler;
- private Collection<XViewerColumn> columns =
- Arrays.asList(CoverageXViewerFactory.Namespace, CoverageXViewerFactory.Coverage_Method,
- CoverageXViewerFactory.Guid, CoverageXViewerFactory.Name);
-
- public GenerateDetailedCoverageReportAction(ICoveragePackageHandler coveragePackageHandler) {
- super("Generate Detailed Coverage Report");
- this.coveragePackageHandler = coveragePackageHandler;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.REPORT);
- }
-
- @Override
- public void run() {
- if (!MessageDialog.openConfirm(Displays.getActiveShell(), getText(), getText())) {
- return;
- }
- try {
- Date date = new Date();
- File file =
- OseeData.getFile("coverage_" + XDate.getDateStr(date, XDate.YYYY_MM_DD).replaceAll("\\\\", "_") + ".pdf");
- OutputStream outputStream = new FileOutputStream(file, true);
- TableWriterAdaptor masterAdaptor = new TableWriterAdaptor("pdf", outputStream);
-
- CoveragePackageBase coveragePackageBase = this.coveragePackageHandler.getCoveragePackageBase();
-
- List<String> sortedHeaders = CoverageEditorOverviewTab.getSortedHeaders(coveragePackageBase);
- masterAdaptor.writeHeader(sortedHeaders.toArray(new String[sortedHeaders.size()]));
- masterAdaptor.getTable().setWidth(100);
- for (String[] values : CoverageEditorOverviewTab.getRows(sortedHeaders, coveragePackageBase, false)) {
- masterAdaptor.writeRow(values);
- }
-
- masterAdaptor.writeTitle("Detailed Coverage Report as of " + XDate.getDateStr(date, XDate.MMDDYYHHMM) + " for " + this.coveragePackageHandler.getCoveragePackageBase().getName());
- masterAdaptor.openDocument();
- masterAdaptor.writeDocument();
-
- masterAdaptor.addTable(getDetailTable());
- masterAdaptor.close();
-
- Program.launch(file.getAbsolutePath());
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- private Table getDetailTable() throws Exception {
- TableWriterAdaptor detailAdaptor = new TableWriterAdaptor("pdf", null);
- detailAdaptor.writeHeader(getColumns());
- detailAdaptor.getTable().setWidths(new float[] {400, 75, 75, 200});
- detailAdaptor.getTable().setWidth(100);
- writeRows(detailAdaptor);
- return detailAdaptor.getTable();
- }
-
- private void writeRows(TableWriterAdaptor writerAdaptor) {
- CoverageLabelProvider labelProvider = new CoverageLabelProvider(null);
- for (CoverageItem item : this.coveragePackageHandler.getCoveragePackageBase().getCoverageItems()) {
- List<String> values = new ArrayList<String>();
- for (XViewerColumn column : columns) {
- try {
- if (column.equals(CoverageXViewerFactory.Namespace)) {
- values.add(String.format("%s[%s][%s]", CoverageUtil.getFullPath(item), labelProvider.getColumnText(
- item, CoverageXViewerFactory.Method_Number, 0), labelProvider.getColumnText(item,
- CoverageXViewerFactory.Execution_Number, 0)));
- } else if (column.equals(CoverageXViewerFactory.Coverage_Method)) {
- String rationale = labelProvider.getColumnText(item, CoverageXViewerFactory.Coverage_Rationale, 0);
- values.add(String.format("%s%s", labelProvider.getColumnText(item,
- CoverageXViewerFactory.Coverage_Method, 0),
- Strings.isValid(rationale) ? "Rationale: " + rationale : ""));
- } else {
- values.add(labelProvider.getColumnText(item, column, 0));
- }
- } catch (OseeCoreException ex) {
- values.add("Exception: " + ex.getLocalizedMessage());
- OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
- }
- }
- writerAdaptor.writeRow(values.toArray(new String[values.size()]));
- }
- }
-
- private String[] getColumns() {
- List<String> columnNames = new ArrayList<String>();
- for (XViewerColumn column : columns) {
- columnNames.add(column.getName());
- }
- return columnNames.toArray(new String[columnNames.size()]);
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class GenerateDetailedCoverageReportAction extends Action {
+
+ private final ICoveragePackageHandler coveragePackageHandler;
+ private Collection<XViewerColumn> columns =
+ Arrays.asList(CoverageXViewerFactory.Namespace, CoverageXViewerFactory.Coverage_Method,
+ CoverageXViewerFactory.Guid, CoverageXViewerFactory.Name);
+
+ public GenerateDetailedCoverageReportAction(ICoveragePackageHandler coveragePackageHandler) {
+ super("Generate Detailed Coverage Report");
+ this.coveragePackageHandler = coveragePackageHandler;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.REPORT);
+ }
+
+ @Override
+ public void run() {
+ if (!MessageDialog.openConfirm(Displays.getActiveShell(), getText(), getText())) {
+ return;
+ }
+ try {
+ Date date = new Date();
+ File file =
+ OseeData.getFile("coverage_" + XDate.getDateStr(date, XDate.YYYY_MM_DD).replaceAll("\\\\", "_") + ".pdf");
+ OutputStream outputStream = new FileOutputStream(file, true);
+ TableWriterAdaptor masterAdaptor = new TableWriterAdaptor("pdf", outputStream);
+
+ CoveragePackageBase coveragePackageBase = this.coveragePackageHandler.getCoveragePackageBase();
+
+ List<String> sortedHeaders = CoverageEditorOverviewTab.getSortedHeaders(coveragePackageBase);
+ masterAdaptor.writeHeader(sortedHeaders.toArray(new String[sortedHeaders.size()]));
+ masterAdaptor.getTable().setWidth(100);
+ for (String[] values : CoverageEditorOverviewTab.getRows(sortedHeaders, coveragePackageBase, false)) {
+ masterAdaptor.writeRow(values);
+ }
+
+ masterAdaptor.writeTitle("Detailed Coverage Report as of " + XDate.getDateStr(date, XDate.MMDDYYHHMM) + " for " + this.coveragePackageHandler.getCoveragePackageBase().getName());
+ masterAdaptor.openDocument();
+ masterAdaptor.writeDocument();
+
+ masterAdaptor.addTable(getDetailTable());
+ masterAdaptor.close();
+
+ Program.launch(file.getAbsolutePath());
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ private Table getDetailTable() throws Exception {
+ TableWriterAdaptor detailAdaptor = new TableWriterAdaptor("pdf", null);
+ detailAdaptor.writeHeader(getColumns());
+ detailAdaptor.getTable().setWidths(new float[] {400, 75, 75, 200});
+ detailAdaptor.getTable().setWidth(100);
+ writeRows(detailAdaptor);
+ return detailAdaptor.getTable();
+ }
+
+ private void writeRows(TableWriterAdaptor writerAdaptor) {
+ CoverageLabelProvider labelProvider = new CoverageLabelProvider(null);
+ for (CoverageItem item : this.coveragePackageHandler.getCoveragePackageBase().getCoverageItems()) {
+ List<String> values = new ArrayList<String>();
+ for (XViewerColumn column : columns) {
+ try {
+ if (column.equals(CoverageXViewerFactory.Namespace)) {
+ values.add(String.format("%s[%s][%s]", CoverageUtil.getFullPath(item), labelProvider.getColumnText(
+ item, CoverageXViewerFactory.Method_Number, 0), labelProvider.getColumnText(item,
+ CoverageXViewerFactory.Execution_Number, 0)));
+ } else if (column.equals(CoverageXViewerFactory.Coverage_Method)) {
+ String rationale = labelProvider.getColumnText(item, CoverageXViewerFactory.Coverage_Rationale, 0);
+ values.add(String.format("%s%s", labelProvider.getColumnText(item,
+ CoverageXViewerFactory.Coverage_Method, 0),
+ Strings.isValid(rationale) ? "Rationale: " + rationale : ""));
+ } else {
+ values.add(labelProvider.getColumnText(item, column, 0));
+ }
+ } catch (OseeCoreException ex) {
+ values.add("Exception: " + ex.getLocalizedMessage());
+ OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
+ }
+ }
+ writerAdaptor.writeRow(values.toArray(new String[values.size()]));
+ }
+ }
+
+ private String[] getColumns() {
+ List<String> columnNames = new ArrayList<String>();
+ for (XViewerColumn column : columns) {
+ columnNames.add(column.getName());
+ }
+ return columnNames.toArray(new String[columnNames.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ICoveragePackageHandler.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ICoveragePackageHandler.java
index 49f8d74bdb..e2fe1e81e2 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ICoveragePackageHandler.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ICoveragePackageHandler.java
@@ -8,14 +8,14 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import org.eclipse.osee.coverage.model.CoveragePackageBase;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ICoveragePackageHandler {
-
- public CoveragePackageBase getCoveragePackageBase();
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ICoveragePackageHandler {
+
+ public CoveragePackageBase getCoveragePackageBase();
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/IRefreshable.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/IRefreshable.java
index 386aa6c2dc..9e232a1f38 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/IRefreshable.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/IRefreshable.java
@@ -8,17 +8,17 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
-
-/**
- * @author Donald G. Dunne
- */
-public interface IRefreshable {
-
- public void refresh(Object element);
-
- public void update(Object element);
-
- public void remove(Object element);
-}
+package org.eclipse.osee.coverage.action;
+
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IRefreshable {
+
+ public void refresh(Object element);
+
+ public void update(Object element);
+
+ public void remove(Object element);
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ISelectedCoverageEditorItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ISelectedCoverageEditorItem.java
index 703a9ba9c5..0f9266d6a7 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ISelectedCoverageEditorItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ISelectedCoverageEditorItem.java
@@ -8,17 +8,17 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import java.util.Collection;
import org.eclipse.osee.coverage.model.ICoverage;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ISelectedCoverageEditorItem {
-
- public Collection<ICoverage> getSelectedCoverageEditorItems();
-
- public void setSelectedCoverageEditorItem(ICoverage item);
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ISelectedCoverageEditorItem {
+
+ public Collection<ICoverage> getSelectedCoverageEditorItems();
+
+ public void setSelectedCoverageEditorItem(ICoverage item);
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/LinkWithImportItemAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/LinkWithImportItemAction.java
index b2871af2b3..9e1206ec17 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/LinkWithImportItemAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/LinkWithImportItemAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.coverage.editor.xmerge.XCoverageMergeViewer;
@@ -27,74 +27,74 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-
-/**
- * @author Donald G. Dunne
- */
-public class LinkWithImportItemAction extends Action {
- private XCoverageMergeViewer packageXViewer;
- private XCoverageMergeViewer importXViewer;
- private CoveragePackage coveragePackage;
-
- public LinkWithImportItemAction() {
- super("Link with Import Item", Action.AS_CHECK_BOX);
- }
-
- private void updateSelection() throws OseeStateException {
- if (linkActionEnabled() && ((ISelectedCoverageEditorItem) importXViewer.getXViewer()).getSelectedCoverageEditorItems().size() == 1) {
- ICoverage importCoverageEditorItem =
- ((ISelectedCoverageEditorItem) importXViewer.getXViewer()).getSelectedCoverageEditorItems().iterator().next();
- // If mergeitemgroup, want to link with parent of one of the children items
- if (importCoverageEditorItem instanceof MergeItemGroup) {
- importCoverageEditorItem =
- ((MergeItemGroup) importCoverageEditorItem).getMergeItems().iterator().next().getParent();
- }
- MatchItem matchItem = MergeManager.getPackageCoverageItem(coveragePackage, importCoverageEditorItem);
- if (matchItem != null && matchItem.getPackageItem() != null) {
- ((ISelectedCoverageEditorItem) packageXViewer.getXViewer()).setSelectedCoverageEditorItem(matchItem.getPackageItem());
- }
- }
- }
-
- private boolean linkActionEnabled() {
- return isChecked();
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(CoverageImage.LINK);
- }
-
- @Override
- public void run() {
- try {
- updateSelection();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void setPackageXViewer(XCoverageMergeViewer packageXViewer, CoveragePackage coveragePackage) {
- this.packageXViewer = packageXViewer;
- this.coveragePackage = coveragePackage;
- }
-
- public XCoverageMergeViewer getImportXViewer() {
- return importXViewer;
- }
-
- public void setImportXViewer(XCoverageMergeViewer importXViewer) {
- this.importXViewer = importXViewer;
- this.importXViewer.getXViewer().getTree().addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- updateSelection();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
-
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class LinkWithImportItemAction extends Action {
+ private XCoverageMergeViewer packageXViewer;
+ private XCoverageMergeViewer importXViewer;
+ private CoveragePackage coveragePackage;
+
+ public LinkWithImportItemAction() {
+ super("Link with Import Item", Action.AS_CHECK_BOX);
+ }
+
+ private void updateSelection() throws OseeStateException {
+ if (linkActionEnabled() && ((ISelectedCoverageEditorItem) importXViewer.getXViewer()).getSelectedCoverageEditorItems().size() == 1) {
+ ICoverage importCoverageEditorItem =
+ ((ISelectedCoverageEditorItem) importXViewer.getXViewer()).getSelectedCoverageEditorItems().iterator().next();
+ // If mergeitemgroup, want to link with parent of one of the children items
+ if (importCoverageEditorItem instanceof MergeItemGroup) {
+ importCoverageEditorItem =
+ ((MergeItemGroup) importCoverageEditorItem).getMergeItems().iterator().next().getParent();
+ }
+ MatchItem matchItem = MergeManager.getPackageCoverageItem(coveragePackage, importCoverageEditorItem);
+ if (matchItem != null && matchItem.getPackageItem() != null) {
+ ((ISelectedCoverageEditorItem) packageXViewer.getXViewer()).setSelectedCoverageEditorItem(matchItem.getPackageItem());
+ }
+ }
+ }
+
+ private boolean linkActionEnabled() {
+ return isChecked();
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(CoverageImage.LINK);
+ }
+
+ @Override
+ public void run() {
+ try {
+ updateSelection();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void setPackageXViewer(XCoverageMergeViewer packageXViewer, CoveragePackage coveragePackage) {
+ this.packageXViewer = packageXViewer;
+ this.coveragePackage = coveragePackage;
+ }
+
+ public XCoverageMergeViewer getImportXViewer() {
+ return importXViewer;
+ }
+
+ public void setImportXViewer(XCoverageMergeViewer importXViewer) {
+ this.importXViewer = importXViewer;
+ this.importXViewer.getXViewer().getTree().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ updateSelection();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/NewCoveragePackageAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/NewCoveragePackageAction.java
index 712751f27f..8dbb0a073d 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/NewCoveragePackageAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/NewCoveragePackageAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.coverage.editor.CoverageEditor;
@@ -28,42 +28,42 @@ import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class NewCoveragePackageAction extends Action {
-
- public static KeyedImage OSEE_IMAGE = CoverageImage.COVERAGE_PACKAGE;
-
- public NewCoveragePackageAction() {
- super("Create New Coverage Package");
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(OSEE_IMAGE);
- }
-
- @Override
- public void run() {
- try {
- if (!CoverageUtil.getBranchFromUser(false)) {
- return;
- }
- Branch branch = CoverageUtil.getBranch();
- EntryDialog dialog = new EntryDialog(getText(), "Enter Coverage Package Name");
- if (dialog.open() == 0) {
- CoveragePackage coveragePackage =
- new CoveragePackage(dialog.getEntry(), CoverageOptionManagerDefault.instance());
- SkynetTransaction transaction = new SkynetTransaction(branch, "Add Coverage Package");
- OseeCoveragePackageStore.get(coveragePackage, branch).save(transaction);
- transaction.execute();
- CoverageEditor.open(new CoverageEditorInput(dialog.getEntry(), OseeCoveragePackageStore.get(
- coveragePackage, branch).getArtifact(false), coveragePackage, false));
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NewCoveragePackageAction extends Action {
+
+ public static KeyedImage OSEE_IMAGE = CoverageImage.COVERAGE_PACKAGE;
+
+ public NewCoveragePackageAction() {
+ super("Create New Coverage Package");
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(OSEE_IMAGE);
+ }
+
+ @Override
+ public void run() {
+ try {
+ if (!CoverageUtil.getBranchFromUser(false)) {
+ return;
+ }
+ Branch branch = CoverageUtil.getBranch();
+ EntryDialog dialog = new EntryDialog(getText(), "Enter Coverage Package Name");
+ if (dialog.open() == 0) {
+ CoveragePackage coveragePackage =
+ new CoveragePackage(dialog.getEntry(), CoverageOptionManagerDefault.instance());
+ SkynetTransaction transaction = new SkynetTransaction(branch, "Add Coverage Package");
+ OseeCoveragePackageStore.get(coveragePackage, branch).save(transaction);
+ transaction.execute();
+ CoverageEditor.open(new CoverageEditorInput(dialog.getEntry(), OseeCoveragePackageStore.get(
+ coveragePackage, branch).getArtifact(false), coveragePackage, false));
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenCoveragePackageAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenCoveragePackageAction.java
index 2b1ec6254b..9c117e33df 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenCoveragePackageAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenCoveragePackageAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.coverage.editor.CoverageEditor;
@@ -26,40 +26,40 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class OpenCoveragePackageAction extends Action {
-
- public static KeyedImage OSEE_IMAGE = CoverageImage.COVERAGE_PACKAGE;
-
- public OpenCoveragePackageAction() {
- super("Open Coverage Package");
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(CoverageImage.COVERAGE_PACKAGE);
- }
-
- @Override
- public void run() {
- try {
- if (!CoverageUtil.getBranchFromUser(false)) {
- return;
- }
- Branch branch = CoverageUtil.getBranch();
- CoveragePackageArtifactListDialog dialog =
- new CoveragePackageArtifactListDialog("Open Coverage Package", "Select Coverage Package");
- dialog.setInput(OseeCoveragePackageStore.getCoveragePackageArtifacts(branch));
- if (dialog.open() == 0) {
- Artifact coveragePackageArtifact = (Artifact) dialog.getResult()[0];
- CoverageEditor.open(new CoverageEditorInput(coveragePackageArtifact.getName(), coveragePackageArtifact,
- null, false));
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class OpenCoveragePackageAction extends Action {
+
+ public static KeyedImage OSEE_IMAGE = CoverageImage.COVERAGE_PACKAGE;
+
+ public OpenCoveragePackageAction() {
+ super("Open Coverage Package");
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(CoverageImage.COVERAGE_PACKAGE);
+ }
+
+ @Override
+ public void run() {
+ try {
+ if (!CoverageUtil.getBranchFromUser(false)) {
+ return;
+ }
+ Branch branch = CoverageUtil.getBranch();
+ CoveragePackageArtifactListDialog dialog =
+ new CoveragePackageArtifactListDialog("Open Coverage Package", "Select Coverage Package");
+ dialog.setInput(OseeCoveragePackageStore.getCoveragePackageArtifacts(branch));
+ if (dialog.open() == 0) {
+ Artifact coveragePackageArtifact = (Artifact) dialog.getResult()[0];
+ CoverageEditor.open(new CoverageEditorInput(coveragePackageArtifact.getName(), coveragePackageArtifact,
+ null, false));
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/SaveImportRecordAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/SaveImportRecordAction.java
index f6f91824fa..2ef7b9bea4 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/SaveImportRecordAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/SaveImportRecordAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -24,49 +24,49 @@ import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class SaveImportRecordAction extends Action {
- private final ISaveable saveable;
- private final CoverageImport coverageImport;
-
- public SaveImportRecordAction(CoverageImport coverageImport, ISaveable saveable) {
- super("Save Coverage Import Record");
- this.coverageImport = coverageImport;
- this.saveable = saveable;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.REPORT);
- }
-
- @Override
- public void run() {
- Result result = saveable.isEditable();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- if (MessageDialog.openConfirm(Displays.getActiveShell(), "Save Coverage Import Record",
- "Overwrite coverage import record with current import information?")) {
- try {
- SkynetTransaction transaction =
- new SkynetTransaction(saveable.getBranch(), "Coverage - Save Import Record");
- saveable.saveImportRecord(transaction, coverageImport);
- transaction.execute();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
- }
- try {
- saveable.save();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SaveImportRecordAction extends Action {
+ private final ISaveable saveable;
+ private final CoverageImport coverageImport;
+
+ public SaveImportRecordAction(CoverageImport coverageImport, ISaveable saveable) {
+ super("Save Coverage Import Record");
+ this.coverageImport = coverageImport;
+ this.saveable = saveable;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.REPORT);
+ }
+
+ @Override
+ public void run() {
+ Result result = saveable.isEditable();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ if (MessageDialog.openConfirm(Displays.getActiveShell(), "Save Coverage Import Record",
+ "Overwrite coverage import record with current import information?")) {
+ try {
+ SkynetTransaction transaction =
+ new SkynetTransaction(saveable.getBranch(), "Coverage - Save Import Record");
+ saveable.saveImportRecord(transaction, coverageImport);
+ transaction.execute();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+ }
+ try {
+ saveable.save();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ShowMergeDetailsAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ShowMergeDetailsAction.java
index fdc5aa51dc..54e1bf2ce9 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ShowMergeDetailsAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ShowMergeDetailsAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.coverage.editor.xmerge.XCoverageMergeViewer;
@@ -28,70 +28,70 @@ import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.results.XResultData;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class ShowMergeDetailsAction extends Action {
- private CoveragePackage coveragePackage;
- private CoverageImport coverageImport;
- private XCoverageMergeViewer importXViewer;
-
- public ShowMergeDetailsAction() {
- super("Show Merge Details", Action.AS_PUSH_BUTTON);
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.REPORT);
- }
-
- @Override
- public void run() {
- try {
- if (((ISelectedCoverageEditorItem) importXViewer.getXViewer()).getSelectedCoverageEditorItems().size() == 1) {
- ICoverage importCoverageEditorItem =
- ((ISelectedCoverageEditorItem) importXViewer.getXViewer()).getSelectedCoverageEditorItems().iterator().next();
- // If mergeitemgroup, want to link with parent of one of the children items
- if (importCoverageEditorItem instanceof MergeItemGroup) {
- importCoverageEditorItem =
- ((MergeItemGroup) importCoverageEditorItem).getMergeItems().iterator().next().getParent();
- } else if (importCoverageEditorItem instanceof MergeItem) {
- importCoverageEditorItem = ((MergeItem) importCoverageEditorItem).getImportItem().getParent();
- } else {
- AWorkbench.popup("Must select a Merge Item");
- return;
- }
- MatchItem matchItem = MergeManager.getPackageCoverageItem(coveragePackage, importCoverageEditorItem);
- if (matchItem != null && matchItem.getPackageItem() != null) {
- MergeManager mergeManager = new MergeManager(coveragePackage, coverageImport);
- XResultData resultData = mergeManager.getMergeDetails(importCoverageEditorItem, new XResultData(false));
- resultData.report("Merge Details - " + importCoverageEditorItem.getName());
- } else {
- AWorkbench.popup("Can't find match item");
- return;
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void setPackageXViewer(XCoverageMergeViewer packageXViewer, CoveragePackage coveragePackage) {
- this.coveragePackage = coveragePackage;
- }
-
- public XCoverageMergeViewer getImportXViewer() {
- return importXViewer;
- }
-
- public void setImportXViewer(XCoverageMergeViewer importXViewer, CoverageImport coverageImport) {
- this.coverageImport = coverageImport;
- this.importXViewer = importXViewer;
- }
-
- public CoverageImport getCoverageImport() {
- return coverageImport;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ShowMergeDetailsAction extends Action {
+ private CoveragePackage coveragePackage;
+ private CoverageImport coverageImport;
+ private XCoverageMergeViewer importXViewer;
+
+ public ShowMergeDetailsAction() {
+ super("Show Merge Details", Action.AS_PUSH_BUTTON);
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.REPORT);
+ }
+
+ @Override
+ public void run() {
+ try {
+ if (((ISelectedCoverageEditorItem) importXViewer.getXViewer()).getSelectedCoverageEditorItems().size() == 1) {
+ ICoverage importCoverageEditorItem =
+ ((ISelectedCoverageEditorItem) importXViewer.getXViewer()).getSelectedCoverageEditorItems().iterator().next();
+ // If mergeitemgroup, want to link with parent of one of the children items
+ if (importCoverageEditorItem instanceof MergeItemGroup) {
+ importCoverageEditorItem =
+ ((MergeItemGroup) importCoverageEditorItem).getMergeItems().iterator().next().getParent();
+ } else if (importCoverageEditorItem instanceof MergeItem) {
+ importCoverageEditorItem = ((MergeItem) importCoverageEditorItem).getImportItem().getParent();
+ } else {
+ AWorkbench.popup("Must select a Merge Item");
+ return;
+ }
+ MatchItem matchItem = MergeManager.getPackageCoverageItem(coveragePackage, importCoverageEditorItem);
+ if (matchItem != null && matchItem.getPackageItem() != null) {
+ MergeManager mergeManager = new MergeManager(coveragePackage, coverageImport);
+ XResultData resultData = mergeManager.getMergeDetails(importCoverageEditorItem, new XResultData(false));
+ resultData.report("Merge Details - " + importCoverageEditorItem.getName());
+ } else {
+ AWorkbench.popup("Can't find match item");
+ return;
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void setPackageXViewer(XCoverageMergeViewer packageXViewer, CoveragePackage coveragePackage) {
+ this.coveragePackage = coveragePackage;
+ }
+
+ public XCoverageMergeViewer getImportXViewer() {
+ return importXViewer;
+ }
+
+ public void setImportXViewer(XCoverageMergeViewer importXViewer, CoverageImport coverageImport) {
+ this.coverageImport = coverageImport;
+ this.importXViewer = importXViewer;
+ }
+
+ public CoverageImport getCoverageImport() {
+ return coverageImport;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ViewSourceAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ViewSourceAction.java
index f426489f13..7eb5fc49f6 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ViewSourceAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/ViewSourceAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.action;
-
+package org.eclipse.osee.coverage.action;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.coverage.internal.Activator;
@@ -25,87 +25,87 @@ import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class ViewSourceAction extends Action {
-
- private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
-
- public ViewSourceAction(ISelectedCoverageEditorItem selectedCoverageEditorItem) {
- super("View Source");
- this.selectedCoverageEditorItem = selectedCoverageEditorItem;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.REPORT);
- }
-
- @Override
- public void run() {
- if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
- AWorkbench.popup("Select Coverage Item");
- return;
- }
- if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().size() > 0) {
- ICoverage item = selectedCoverageEditorItem.getSelectedCoverageEditorItems().iterator().next();
- String highlightLine = null;
-
- try {
- if (item instanceof CoverageItem) {
- if (Strings.isValid(item.getName())) {
- highlightLine = item.getName();
- }
- item = item.getParent();
- }
- // If order number then parent has full file contents
- // attempt to find line in file that matches
- if (Strings.isValid(item.getOrderNumber())) {
- if (item.getParent() != null) {
- String itemLineText = item.getName();
- String parentFileContents = item.getParent().getFileContents();
- if (!Strings.isValid(parentFileContents)) {
- AWorkbench.popup("No File Contents Available");
- return;
- }
- String html = parentFileContents;
- // mark text for method
- if (Strings.isValid(itemLineText)) {
- html = html.replaceAll(itemLineText, "HEREBEGIN" + itemLineText + "HEREEND");
- }
- // mark text for executable line
- if (Strings.isValid(highlightLine)) {
- html = html.replaceAll(highlightLine, "HEREBEGIN" + highlightLine + "HEREEND");
- }
- html = AHTML.textToHtml(html);
- html = html.replaceAll(" ", "&nbsp;");
- html = html.replaceAll("HEREBEGIN", "<FONT style=\"BACKGROUND-COLOR: yellow\">");
- html = html.replaceAll("HEREEND", "</FONT>");
- ResultsEditor.open("source",
- CoverageUtil.getFullPathWithName(item.getParent()) + "[" + item.getName() + "]", html);
- } else {
- AWorkbench.popup("No File Contents Available");
- return;
- }
- }
- // If no order number, just open full text
- else {
- String text = item.getFileContents();
- if (!Strings.isValid(text)) {
- AWorkbench.popup("No File Contents Available");
- return;
- }
- String html = AHTML.textToHtml(text);
- html = html.replaceAll(" ", "&nbsp;");
- ResultsEditor.open("source", CoverageUtil.getFullPathWithName(item), html);
- }
-
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ViewSourceAction extends Action {
+
+ private final ISelectedCoverageEditorItem selectedCoverageEditorItem;
+
+ public ViewSourceAction(ISelectedCoverageEditorItem selectedCoverageEditorItem) {
+ super("View Source");
+ this.selectedCoverageEditorItem = selectedCoverageEditorItem;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.REPORT);
+ }
+
+ @Override
+ public void run() {
+ if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().isEmpty()) {
+ AWorkbench.popup("Select Coverage Item");
+ return;
+ }
+ if (selectedCoverageEditorItem.getSelectedCoverageEditorItems().size() > 0) {
+ ICoverage item = selectedCoverageEditorItem.getSelectedCoverageEditorItems().iterator().next();
+ String highlightLine = null;
+
+ try {
+ if (item instanceof CoverageItem) {
+ if (Strings.isValid(item.getName())) {
+ highlightLine = item.getName();
+ }
+ item = item.getParent();
+ }
+ // If order number then parent has full file contents
+ // attempt to find line in file that matches
+ if (Strings.isValid(item.getOrderNumber())) {
+ if (item.getParent() != null) {
+ String itemLineText = item.getName();
+ String parentFileContents = item.getParent().getFileContents();
+ if (!Strings.isValid(parentFileContents)) {
+ AWorkbench.popup("No File Contents Available");
+ return;
+ }
+ String html = parentFileContents;
+ // mark text for method
+ if (Strings.isValid(itemLineText)) {
+ html = html.replaceAll(itemLineText, "HEREBEGIN" + itemLineText + "HEREEND");
+ }
+ // mark text for executable line
+ if (Strings.isValid(highlightLine)) {
+ html = html.replaceAll(highlightLine, "HEREBEGIN" + highlightLine + "HEREEND");
+ }
+ html = AHTML.textToHtml(html);
+ html = html.replaceAll(" ", "&nbsp;");
+ html = html.replaceAll("HEREBEGIN", "<FONT style=\"BACKGROUND-COLOR: yellow\">");
+ html = html.replaceAll("HEREEND", "</FONT>");
+ ResultsEditor.open("source",
+ CoverageUtil.getFullPathWithName(item.getParent()) + "[" + item.getName() + "]", html);
+ } else {
+ AWorkbench.popup("No File Contents Available");
+ return;
+ }
+ }
+ // If no order number, just open full text
+ else {
+ String text = item.getFileContents();
+ if (!Strings.isValid(text)) {
+ AWorkbench.popup("No File Contents Available");
+ return;
+ }
+ String html = AHTML.textToHtml(text);
+ html = html.replaceAll(" ", "&nbsp;");
+ ResultsEditor.open("source", CoverageUtil.getFullPathWithName(item), html);
+ }
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/AbstractCoverageBlam.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/AbstractCoverageBlam.java
index 4802be2e05..3c31a4aae4 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/AbstractCoverageBlam.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/blam/AbstractCoverageBlam.java
@@ -8,57 +8,57 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.blam;
-
+package org.eclipse.osee.coverage.blam;
+
import org.eclipse.osee.coverage.editor.CoverageEditor;
import org.eclipse.osee.coverage.model.CoverageImport;
import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class AbstractCoverageBlam extends AbstractBlam {
-
- CoverageImport coverageImport;
- CoverageEditor coverageEditor;
-
- public CoverageImport getCoverageImport() {
- return coverageImport;
- }
-
- public void setCoverageImport(CoverageImport coverageImport) {
- this.coverageImport = coverageImport;
- if (coverageEditor != null) {
- coverageEditor.getCoverageEditorImportTab().setCoverageImportResults(getName(), coverageImport);
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((coverageImport.getName() == null) ? 0 : coverageImport.getName().hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
- AbstractCoverageBlam other = (AbstractCoverageBlam) obj;
- if (coverageImport == null) {
- if (other.coverageImport != null) return false;
- } else if (!coverageImport.getName().equals(other.coverageImport.getName())) return false;
- return true;
- }
-
- public CoverageEditor getCoverageEditor() {
- return coverageEditor;
- }
-
- public void setCoverageEditor(CoverageEditor coverageEditor) {
- this.coverageEditor = coverageEditor;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class AbstractCoverageBlam extends AbstractBlam {
+
+ CoverageImport coverageImport;
+ CoverageEditor coverageEditor;
+
+ public CoverageImport getCoverageImport() {
+ return coverageImport;
+ }
+
+ public void setCoverageImport(CoverageImport coverageImport) {
+ this.coverageImport = coverageImport;
+ if (coverageEditor != null) {
+ coverageEditor.getCoverageEditorImportTab().setCoverageImportResults(getName(), coverageImport);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((coverageImport.getName() == null) ? 0 : coverageImport.getName().hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ AbstractCoverageBlam other = (AbstractCoverageBlam) obj;
+ if (coverageImport == null) {
+ if (other.coverageImport != null) return false;
+ } else if (!coverageImport.getName().equals(other.coverageImport.getName())) return false;
+ return true;
+ }
+
+ public CoverageEditor getCoverageEditor() {
+ return coverageEditor;
+ }
+
+ public void setCoverageEditor(CoverageEditor coverageEditor) {
+ this.coverageEditor = coverageEditor;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
index 6de7f4c2fb..ca384f8076 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
@@ -1,188 +1,188 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.coverage.editor;
-
-import java.util.Collection;
-import java.util.Set;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.osee.coverage.editor.params.CoverageParameters;
-import org.eclipse.osee.coverage.editor.params.CoverageParametersComposite;
-import org.eclipse.osee.coverage.editor.params.CoverageParametersTextFilter;
-import org.eclipse.osee.coverage.editor.xcover.XCoverageViewer;
-import org.eclipse.osee.coverage.editor.xcover.XCoverageViewer.TableType;
-import org.eclipse.osee.coverage.model.CoverageImport;
-import org.eclipse.osee.coverage.model.CoveragePackage;
-import org.eclipse.osee.coverage.model.CoveragePackageBase;
-import org.eclipse.osee.coverage.model.ICoverage;
-import org.eclipse.osee.coverage.model.MessageCoverageItem;
-import org.eclipse.osee.coverage.store.OseeCoveragePackageStore;
-import org.eclipse.osee.coverage.util.CoverageUtil;
-import org.eclipse.osee.coverage.util.ISaveable;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.action.CollapseAllAction;
-import org.eclipse.osee.framework.ui.skynet.action.ExpandAllAction;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-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.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageEditorCoverageTab extends FormPage implements ISaveable {
-
- private XCoverageViewer xCoverageViewer;
- private ScrolledForm scrolledForm;
- private final CoveragePackageBase coveragePackageBase;
- private final CoverageEditor coverageEditor;
- private CoverageParameters coverageParameters;
- private CoverageParametersTextFilter parametersFilter;
-
- public CoverageEditorCoverageTab(String name, CoverageEditor coverageEditor, CoveragePackageBase provider) {
- super(coverageEditor, name, name);
- this.coverageEditor = coverageEditor;
- this.coveragePackageBase = provider;
- }
-
- @Override
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
-
- scrolledForm = managedForm.getForm();
- scrolledForm.setText(coveragePackageBase.getName() + " - " + XDate.getDateStr(coveragePackageBase.getDate(),
- XDate.MMDDYYHHMM) + " - " + coveragePackageBase.getCoverageItems().size() + " Coverage Items");
- scrolledForm.setImage(ImageManager.getImage(CoverageUtil.getCoveragePackageBaseImage(coveragePackageBase)));
- scrolledForm.getBody().setLayout(new GridLayout(2, false));
- Composite mainComp = scrolledForm.getBody();
- coverageEditor.getToolkit().adapt(mainComp);
- mainComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
-
- coverageParameters = new CoverageParameters(coveragePackageBase);
- new CoverageParametersComposite(mainComp, managedForm, coverageEditor, coverageParameters,
- new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSearchButtonPressed();
- }
- });
-
- Composite tableComp = new Composite(mainComp, SWT.NONE);
- tableComp.setLayout(ALayout.getZeroMarginLayout(1, false));
- coverageEditor.getToolkit().adapt(tableComp);
- GridData tableData = new GridData(SWT.FILL, SWT.FILL, true, true);
- tableData.horizontalSpan = 2;
- tableComp.setLayoutData(tableData);
- coverageEditor.getToolkit().adapt(tableComp);
-
- xCoverageViewer =
- new XCoverageViewer(this, coveragePackageBase.getCoverageOptionManager(),
- coveragePackageBase instanceof CoverageImport ? TableType.Import : TableType.Package);
- xCoverageViewer.setDisplayLabel(false);
- xCoverageViewer.createWidgets(managedForm, tableComp, 1);
- xCoverageViewer.getXViewer().getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createToolbar();
- }
-
- private void handleSearchButtonPressed() {
- if (parametersFilter == null) {
- parametersFilter = new CoverageParametersTextFilter(xCoverageViewer.getXViewer());
- xCoverageViewer.getXViewer().addFilter(parametersFilter);
- }
- handleSearchButtonPressed(xCoverageViewer, coverageParameters, parametersFilter);
- }
-
- public static void handleSearchButtonPressed(XCoverageViewer xCoverageViewer, CoverageParameters coverageParameters, CoverageParametersTextFilter parametersFilter) {
- try {
- Result result = coverageParameters.isParameterSelectionValid();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- Pair<Set<ICoverage>, Set<ICoverage>> itemsAndParents = coverageParameters.performSearchGetResults();
- if (itemsAndParents.getSecond().size() != 0) {
- xCoverageViewer.loadTable(itemsAndParents.getSecond());
- } else {
- xCoverageViewer.getXViewer().setInput(new MessageCoverageItem("No Match"));
- }
- xCoverageViewer.refresh();
- parametersFilter.setShowAll(coverageParameters.isShowAll());
- parametersFilter.setShownCoverages(itemsAndParents.getFirst());
- xCoverageViewer.getXViewer().refresh();
-
- if (!coverageParameters.isShowAll()) {
- // Don't reveal too low cause it's too much, just reveal to first non folder Coverage Unit
- for (ICoverage coverage : CoverageUtil.getFirstNonFolderCoverageUnits(itemsAndParents.getFirst())) {
- xCoverageViewer.getXViewer().setSelection(new StructuredSelection(coverage));
- xCoverageViewer.getXViewer().reveal(new StructuredSelection(coverage));
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void createToolbar() {
- IToolBarManager toolBarManager = scrolledForm.getToolBarManager();
- toolBarManager.add(new CollapseAllAction(xCoverageViewer.getXViewer()));
- toolBarManager.add(new ExpandAllAction(xCoverageViewer.getXViewer()));
- toolBarManager.add(xCoverageViewer.getXViewer().getCustomizeAction());
- CoverageEditor.addToToolBar(scrolledForm.getToolBarManager(), coverageEditor);
- scrolledForm.updateToolBar();
- }
-
- @Override
- public FormEditor getEditor() {
- return super.getEditor();
- }
-
- @Override
- public Result isEditable() {
- return coveragePackageBase.isEditable();
- }
-
- @Override
- public Result save() throws OseeCoreException {
- return OseeCoveragePackageStore.get((CoveragePackage) coveragePackageBase, coverageEditor.getBranch()).save();
- }
-
- @Override
- public Result save(Collection<ICoverage> coverages) throws OseeCoreException {
- return (OseeCoveragePackageStore.get((CoveragePackage) coveragePackageBase, coverageEditor.getBranch())).save(coverages);
- }
-
- @Override
- public Result saveImportRecord(SkynetTransaction transaction, CoverageImport coverageImport) throws OseeCoreException {
- return new Result(false, "Not valid for this tab.");
- }
-
- @Override
- public Branch getBranch() throws OseeCoreException {
- return coverageEditor.getBranch();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.coverage.editor;
+
+import java.util.Collection;
+import java.util.Set;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osee.coverage.editor.params.CoverageParameters;
+import org.eclipse.osee.coverage.editor.params.CoverageParametersComposite;
+import org.eclipse.osee.coverage.editor.params.CoverageParametersTextFilter;
+import org.eclipse.osee.coverage.editor.xcover.XCoverageViewer;
+import org.eclipse.osee.coverage.editor.xcover.XCoverageViewer.TableType;
+import org.eclipse.osee.coverage.model.CoverageImport;
+import org.eclipse.osee.coverage.model.CoveragePackage;
+import org.eclipse.osee.coverage.model.CoveragePackageBase;
+import org.eclipse.osee.coverage.model.ICoverage;
+import org.eclipse.osee.coverage.model.MessageCoverageItem;
+import org.eclipse.osee.coverage.store.OseeCoveragePackageStore;
+import org.eclipse.osee.coverage.util.CoverageUtil;
+import org.eclipse.osee.coverage.util.ISaveable;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.action.CollapseAllAction;
+import org.eclipse.osee.framework.ui.skynet.action.ExpandAllAction;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+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.Composite;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageEditorCoverageTab extends FormPage implements ISaveable {
+
+ private XCoverageViewer xCoverageViewer;
+ private ScrolledForm scrolledForm;
+ private final CoveragePackageBase coveragePackageBase;
+ private final CoverageEditor coverageEditor;
+ private CoverageParameters coverageParameters;
+ private CoverageParametersTextFilter parametersFilter;
+
+ public CoverageEditorCoverageTab(String name, CoverageEditor coverageEditor, CoveragePackageBase provider) {
+ super(coverageEditor, name, name);
+ this.coverageEditor = coverageEditor;
+ this.coveragePackageBase = provider;
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+
+ scrolledForm = managedForm.getForm();
+ scrolledForm.setText(coveragePackageBase.getName() + " - " + XDate.getDateStr(coveragePackageBase.getDate(),
+ XDate.MMDDYYHHMM) + " - " + coveragePackageBase.getCoverageItems().size() + " Coverage Items");
+ scrolledForm.setImage(ImageManager.getImage(CoverageUtil.getCoveragePackageBaseImage(coveragePackageBase)));
+ scrolledForm.getBody().setLayout(new GridLayout(2, false));
+ Composite mainComp = scrolledForm.getBody();
+ coverageEditor.getToolkit().adapt(mainComp);
+ mainComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ coverageParameters = new CoverageParameters(coveragePackageBase);
+ new CoverageParametersComposite(mainComp, managedForm, coverageEditor, coverageParameters,
+ new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleSearchButtonPressed();
+ }
+ });
+
+ Composite tableComp = new Composite(mainComp, SWT.NONE);
+ tableComp.setLayout(ALayout.getZeroMarginLayout(1, false));
+ coverageEditor.getToolkit().adapt(tableComp);
+ GridData tableData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ tableData.horizontalSpan = 2;
+ tableComp.setLayoutData(tableData);
+ coverageEditor.getToolkit().adapt(tableComp);
+
+ xCoverageViewer =
+ new XCoverageViewer(this, coveragePackageBase.getCoverageOptionManager(),
+ coveragePackageBase instanceof CoverageImport ? TableType.Import : TableType.Package);
+ xCoverageViewer.setDisplayLabel(false);
+ xCoverageViewer.createWidgets(managedForm, tableComp, 1);
+ xCoverageViewer.getXViewer().getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createToolbar();
+ }
+
+ private void handleSearchButtonPressed() {
+ if (parametersFilter == null) {
+ parametersFilter = new CoverageParametersTextFilter(xCoverageViewer.getXViewer());
+ xCoverageViewer.getXViewer().addFilter(parametersFilter);
+ }
+ handleSearchButtonPressed(xCoverageViewer, coverageParameters, parametersFilter);
+ }
+
+ public static void handleSearchButtonPressed(XCoverageViewer xCoverageViewer, CoverageParameters coverageParameters, CoverageParametersTextFilter parametersFilter) {
+ try {
+ Result result = coverageParameters.isParameterSelectionValid();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ Pair<Set<ICoverage>, Set<ICoverage>> itemsAndParents = coverageParameters.performSearchGetResults();
+ if (itemsAndParents.getSecond().size() != 0) {
+ xCoverageViewer.loadTable(itemsAndParents.getSecond());
+ } else {
+ xCoverageViewer.getXViewer().setInput(new MessageCoverageItem("No Match"));
+ }
+ xCoverageViewer.refresh();
+ parametersFilter.setShowAll(coverageParameters.isShowAll());
+ parametersFilter.setShownCoverages(itemsAndParents.getFirst());
+ xCoverageViewer.getXViewer().refresh();
+
+ if (!coverageParameters.isShowAll()) {
+ // Don't reveal too low cause it's too much, just reveal to first non folder Coverage Unit
+ for (ICoverage coverage : CoverageUtil.getFirstNonFolderCoverageUnits(itemsAndParents.getFirst())) {
+ xCoverageViewer.getXViewer().setSelection(new StructuredSelection(coverage));
+ xCoverageViewer.getXViewer().reveal(new StructuredSelection(coverage));
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void createToolbar() {
+ IToolBarManager toolBarManager = scrolledForm.getToolBarManager();
+ toolBarManager.add(new CollapseAllAction(xCoverageViewer.getXViewer()));
+ toolBarManager.add(new ExpandAllAction(xCoverageViewer.getXViewer()));
+ toolBarManager.add(xCoverageViewer.getXViewer().getCustomizeAction());
+ CoverageEditor.addToToolBar(scrolledForm.getToolBarManager(), coverageEditor);
+ scrolledForm.updateToolBar();
+ }
+
+ @Override
+ public FormEditor getEditor() {
+ return super.getEditor();
+ }
+
+ @Override
+ public Result isEditable() {
+ return coveragePackageBase.isEditable();
+ }
+
+ @Override
+ public Result save() throws OseeCoreException {
+ return OseeCoveragePackageStore.get((CoveragePackage) coveragePackageBase, coverageEditor.getBranch()).save();
+ }
+
+ @Override
+ public Result save(Collection<ICoverage> coverages) throws OseeCoreException {
+ return (OseeCoveragePackageStore.get((CoveragePackage) coveragePackageBase, coverageEditor.getBranch())).save(coverages);
+ }
+
+ @Override
+ public Result saveImportRecord(SkynetTransaction transaction, CoverageImport coverageImport) throws OseeCoreException {
+ return new Result(false, "Not valid for this tab.");
+ }
+
+ @Override
+ public Branch getBranch() throws OseeCoreException {
+ return coverageEditor.getBranch();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorHandler.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorHandler.java
index e6329e2be2..e330f82627 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorHandler.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorHandler.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.editor;
-
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers.AbstractEditorHandler;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageEditorHandler extends AbstractEditorHandler {
-
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.editor;
+
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers.AbstractEditorHandler;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageEditorHandler extends AbstractEditorHandler {
+
+ @Override
public Object execute(ExecutionEvent event) {
- if (!artifacts.isEmpty()) {
- CoverageRenderer renderer = new CoverageRenderer();
- try {
+ if (!artifacts.isEmpty()) {
+ CoverageRenderer renderer = new CoverageRenderer();
+ try {
renderer.open(artifacts, PresentationType.SPECIALIZED_EDIT);
- } catch (OseeCoreException ex) {
- OseeLog.log(CoverageEditorHandler.class, Level.SEVERE, ex);
- }
- dispose();
- }
- return null;
- }
-}
+ } catch (OseeCoreException ex) {
+ OseeLog.log(CoverageEditorHandler.class, Level.SEVERE, ex);
+ }
+ dispose();
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorImportTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorImportTab.java
index 0d7eb26a13..f663dac513 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorImportTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorImportTab.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.editor;
-
+package org.eclipse.osee.coverage.editor;
+
import java.util.logging.Level;
import org.eclipse.core.runtime.AssertionFailedException;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
@@ -57,329 +57,329 @@ import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageEditorImportTab extends FormPage {
-
- private final CoverageEditor coverageEditor;
- private final CoveragePackageBase coveragePackageBase;
- private XComboViewer combo;
- private BlamUsageSection blamUsageSection;
- private BlamInputSection blamInputSection;
- private BlamOutputSection blamOutputSection;
- private CoverageImport coverageImport;
- private CoverageEditorCoverageTab coverageImportTab;
- private CoverageEditorOverviewTab coverageImportOverviewTab;
- private CoverageEditorMergeTab coverageEditorMergeTab;
- private int coverageImportIndex, coverageImportOverviewIndex, coverageEditorMergeIndex;
- private Composite destroyableComposite;
- private boolean isSimulateImput = false;
-
- public CoverageEditorImportTab(CoverageEditor coverageEditor) throws OseeCoreException {
- super(coverageEditor, "Import", "Import");
- this.coverageEditor = coverageEditor;
- this.coveragePackageBase = coverageEditor.getCoveragePackageBase();
- }
-
- @Override
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
-
- final ScrolledForm scrolledForm = managedForm.getForm();
- scrolledForm.setText(coveragePackageBase.getName());
- scrolledForm.setImage(ImageManager.getImage(CoverageUtil.getCoveragePackageBaseImage(coveragePackageBase)));
-
- scrolledForm.getBody().setLayout(ALayout.getZeroMarginLayout());
- CoverageEditor.addToToolBar(scrolledForm.getToolBarManager(), coverageEditor);
-
- scrolledForm.getBody().setLayout(new GridLayout(1, false));
- scrolledForm.getBody().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- managedForm.getMessageManager().setAutoUpdate(false);
-
- combo = new XComboViewer("Select Import Blam");
- combo.setLabelProvider(labelProvider);
- combo.setContentProvider(new ArrayTreeContentProvider());
- combo.createWidgets(managedForm, scrolledForm.getBody(), 1);
- combo.setInput(Collections.castAll(CoverageManager.getCoverageBlams()));
- combo.getCombo().setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
- combo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- createBlamSections();
- }
- });
-
- createDestroyableComposite();
-
- }
-
- public void simulateImport(String importName) throws OseeCoreException {
- if (!Strings.isValid(importName)) {
- throw new OseeStateException(String.format("Invalid importName [%s]", importName));
- }
- AbstractCoverageBlam blam = null;
- for (AbstractCoverageBlam abstractCoverageBlam : CoverageManager.getCoverageBlams()) {
- if (abstractCoverageBlam.getName().equals(importName)) {
- blam = abstractCoverageBlam;
- }
- }
- if (blam == null) {
- throw new OseeArgumentException(String.format("Can't find blam matching name [%s]", importName));
- }
- blam.setCoverageEditor(coverageEditor);
- combo.getComboViewer().setSelection(new StructuredSelection(blam), true);
- createBlamSections();
- blamOutputSection.simluateRun();
- isSimulateImput = true;
- }
-
- public void simulateImportSearch() throws OseeArgumentException {
- coverageEditorMergeTab.simulateSearchAll();
- }
-
- private AbstractCoverageBlam getBlam() {
- if (combo.getSelected() != null) {
- AbstractCoverageBlam blam = (AbstractCoverageBlam) combo.getSelected();
- blam.setCoverageEditor(coverageEditor);
- return blam;
- }
- return null;
- }
-
- private void createDestroyableComposite() {
- if (destroyableComposite != null) {
- destroyableComposite.dispose();
- }
- destroyableComposite =
- getManagedForm().getToolkit().createComposite(getManagedForm().getForm().getBody(), SWT.NONE);
- destroyableComposite.setLayout(new GridLayout());
- destroyableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- }
-
- private void createBlamSections() {
- if (blamUsageSection != null) {
- if (blamUsageSection != null) {
- getManagedForm().removePart(blamUsageSection);
- }
- blamUsageSection.dispose();
- if (blamInputSection != null) {
- getManagedForm().removePart(blamInputSection);
- blamInputSection.dispose();
- }
- if (blamOutputSection != null) {
- getManagedForm().removePart(blamOutputSection);
- blamOutputSection.dispose();
- }
- createDestroyableComposite();
- }
- int sectionStyle = Section.TITLE_BAR | Section.EXPANDED | Section.TWISTIE;
- blamUsageSection =
- new BlamUsageSection(getEditor(), getBlam(), destroyableComposite, getManagedForm().getToolkit(),
- sectionStyle);
-
- blamInputSection =
- new BlamInputSection(getEditor(), getBlam(), destroyableComposite, getManagedForm().getToolkit(),
- sectionStyle);
-
- blamOutputSection =
- new BlamOutputSection(getEditor(), getBlam(), destroyableComposite, getManagedForm().getToolkit(),
- sectionStyle, new ExecuteBlamAction());
-
- getManagedForm().addPart(blamUsageSection);
- getManagedForm().addPart(blamInputSection);
- blamInputSection.getSection().setExpanded(true);
- getManagedForm().addPart(blamOutputSection);
- blamInputSection.getSection().setExpanded(true);
-
- getManagedForm().refresh();
- getManagedForm().getForm().layout();
-
- }
- private final class BlamEditorExecutionAdapter extends JobChangeAdapter {
- private long startTime = 0;
- private final String name;
-
- public BlamEditorExecutionAdapter(String name) {
- this.name = name;
- }
-
- @Override
- public void scheduled(IJobChangeEvent event) {
- super.scheduled(event);
- showBusy(true);
- blamOutputSection.setText("Importing...\n");
- }
-
- @Override
- public void aboutToRun(IJobChangeEvent event) {
- super.aboutToRun(event);
- startTime = System.currentTimeMillis();
- blamOutputSection.setText(String.format("Starting [%s] BLAM at [%s]\n", name, Lib.getElapseString(startTime)));
- }
-
- @Override
- public void done(IJobChangeEvent event) {
- super.done(event);
- }
- }
-
- public final class ExecuteBlamAction extends Action {
-
- public ExecuteBlamAction() {
- super("Run BLAM in Job", Action.AS_PUSH_BUTTON);
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.RUN_EXC));
- setToolTipText("Executes the BLAM Operation");
- }
-
- @Override
- public void run() {
- try {
- if (coverageEditorMergeTab != null) {
- if (coverageEditorMergeIndex != 0) {
- try {
- coverageEditor.removePage(coverageEditorMergeIndex);
- } catch (AssertionFailedException ex) {
- // page already removed; do nothing
- }
- coverageEditorMergeIndex = 0;
- }
- }
- if (coverageImportTab != null) {
- if (coverageImportIndex != 0) {
- try {
- coverageEditor.removePage(coverageImportIndex);
- } catch (AssertionFailedException ex) {
- // page already removed; do nothing
- }
- coverageImportIndex = 0;
- }
- }
- if (coverageImportOverviewTab != null) {
- if (coverageImportOverviewIndex != 0) {
- try {
- coverageEditor.removePage(coverageImportOverviewIndex);
- } catch (AssertionFailedException ex) {
- // page already removed; do nothing
- }
- coverageImportOverviewIndex = 0;
- }
- }
- coverageImport = null;
-
- getBlam().execute(getBlam().getName(), blamOutputSection.getOutput(), blamInputSection.getData(),
- new BlamEditorExecutionAdapter(getBlam().getName()));
- } catch (Exception ex) {
- OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- public void createImportParts() {
- coverageImportOverviewTab = new CoverageEditorOverviewTab("Import Overview", coverageEditor, coverageImport);
- coverageImportOverviewIndex = coverageEditor.addFormPage(coverageImportOverviewTab);
-
- coverageImportTab =
- new CoverageEditorCoverageTab(String.format("Import Items (%d)", coverageImport.getCoverageItems().size()),
- coverageEditor, coverageImport);
- coverageImportIndex = coverageEditor.addFormPage(coverageImportTab);
-
- try {
- coverageEditorMergeTab =
- new CoverageEditorMergeTab("Import Merge", coverageEditor,
- (CoveragePackage) coverageEditor.getCoveragePackageBase(), coverageImport);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
- }
- coverageEditorMergeIndex = coverageEditor.addFormPage(coverageEditorMergeTab);
- }
-
- @Override
- public void showBusy(boolean busy) {
- super.showBusy(busy);
- if (Widgets.isAccessible(getManagedForm().getForm())) {
- getManagedForm().getForm().getForm().setBusy(busy);
- }
- }
-
- @Override
- public FormEditor getEditor() {
- return super.getEditor();
- }
-
- static ILabelProvider labelProvider = new ILabelProvider() {
-
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- if (element instanceof AbstractBlam) {
- return ((AbstractBlam) element).getName();
- }
- return "Unknown";
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- };
-
- public CoverageImport getCoverageImport() {
- return coverageImport;
- }
-
- /**
- * This method is called at the end of the import blam being run
- */
- public void setCoverageImportResults(final String blamName, final CoverageImport coverageImport) {
- this.coverageImport = coverageImport;
- showBusy(false);
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- blamOutputSection.appendText("BLAM completed\n");
- coverageImport.setBlamName(blamName);
- createImportParts();
-
- if (isSimulateImput) {
- Thread thread = new Thread() {
- @Override
- public void run() {
- try {
- Thread.sleep(1000);
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- coverageEditor.simulateImportPostRun();
- isSimulateImput = false;
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- } catch (InterruptedException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- };
- thread.start();
- }
- }
- });
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageEditorImportTab extends FormPage {
+
+ private final CoverageEditor coverageEditor;
+ private final CoveragePackageBase coveragePackageBase;
+ private XComboViewer combo;
+ private BlamUsageSection blamUsageSection;
+ private BlamInputSection blamInputSection;
+ private BlamOutputSection blamOutputSection;
+ private CoverageImport coverageImport;
+ private CoverageEditorCoverageTab coverageImportTab;
+ private CoverageEditorOverviewTab coverageImportOverviewTab;
+ private CoverageEditorMergeTab coverageEditorMergeTab;
+ private int coverageImportIndex, coverageImportOverviewIndex, coverageEditorMergeIndex;
+ private Composite destroyableComposite;
+ private boolean isSimulateImput = false;
+
+ public CoverageEditorImportTab(CoverageEditor coverageEditor) throws OseeCoreException {
+ super(coverageEditor, "Import", "Import");
+ this.coverageEditor = coverageEditor;
+ this.coveragePackageBase = coverageEditor.getCoveragePackageBase();
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+
+ final ScrolledForm scrolledForm = managedForm.getForm();
+ scrolledForm.setText(coveragePackageBase.getName());
+ scrolledForm.setImage(ImageManager.getImage(CoverageUtil.getCoveragePackageBaseImage(coveragePackageBase)));
+
+ scrolledForm.getBody().setLayout(ALayout.getZeroMarginLayout());
+ CoverageEditor.addToToolBar(scrolledForm.getToolBarManager(), coverageEditor);
+
+ scrolledForm.getBody().setLayout(new GridLayout(1, false));
+ scrolledForm.getBody().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ managedForm.getMessageManager().setAutoUpdate(false);
+
+ combo = new XComboViewer("Select Import Blam");
+ combo.setLabelProvider(labelProvider);
+ combo.setContentProvider(new ArrayTreeContentProvider());
+ combo.createWidgets(managedForm, scrolledForm.getBody(), 1);
+ combo.setInput(Collections.castAll(CoverageManager.getCoverageBlams()));
+ combo.getCombo().setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
+ combo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ createBlamSections();
+ }
+ });
+
+ createDestroyableComposite();
+
+ }
+
+ public void simulateImport(String importName) throws OseeCoreException {
+ if (!Strings.isValid(importName)) {
+ throw new OseeStateException(String.format("Invalid importName [%s]", importName));
+ }
+ AbstractCoverageBlam blam = null;
+ for (AbstractCoverageBlam abstractCoverageBlam : CoverageManager.getCoverageBlams()) {
+ if (abstractCoverageBlam.getName().equals(importName)) {
+ blam = abstractCoverageBlam;
+ }
+ }
+ if (blam == null) {
+ throw new OseeArgumentException(String.format("Can't find blam matching name [%s]", importName));
+ }
+ blam.setCoverageEditor(coverageEditor);
+ combo.getComboViewer().setSelection(new StructuredSelection(blam), true);
+ createBlamSections();
+ blamOutputSection.simluateRun();
+ isSimulateImput = true;
+ }
+
+ public void simulateImportSearch() throws OseeArgumentException {
+ coverageEditorMergeTab.simulateSearchAll();
+ }
+
+ private AbstractCoverageBlam getBlam() {
+ if (combo.getSelected() != null) {
+ AbstractCoverageBlam blam = (AbstractCoverageBlam) combo.getSelected();
+ blam.setCoverageEditor(coverageEditor);
+ return blam;
+ }
+ return null;
+ }
+
+ private void createDestroyableComposite() {
+ if (destroyableComposite != null) {
+ destroyableComposite.dispose();
+ }
+ destroyableComposite =
+ getManagedForm().getToolkit().createComposite(getManagedForm().getForm().getBody(), SWT.NONE);
+ destroyableComposite.setLayout(new GridLayout());
+ destroyableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ }
+
+ private void createBlamSections() {
+ if (blamUsageSection != null) {
+ if (blamUsageSection != null) {
+ getManagedForm().removePart(blamUsageSection);
+ }
+ blamUsageSection.dispose();
+ if (blamInputSection != null) {
+ getManagedForm().removePart(blamInputSection);
+ blamInputSection.dispose();
+ }
+ if (blamOutputSection != null) {
+ getManagedForm().removePart(blamOutputSection);
+ blamOutputSection.dispose();
+ }
+ createDestroyableComposite();
+ }
+ int sectionStyle = Section.TITLE_BAR | Section.EXPANDED | Section.TWISTIE;
+ blamUsageSection =
+ new BlamUsageSection(getEditor(), getBlam(), destroyableComposite, getManagedForm().getToolkit(),
+ sectionStyle);
+
+ blamInputSection =
+ new BlamInputSection(getEditor(), getBlam(), destroyableComposite, getManagedForm().getToolkit(),
+ sectionStyle);
+
+ blamOutputSection =
+ new BlamOutputSection(getEditor(), getBlam(), destroyableComposite, getManagedForm().getToolkit(),
+ sectionStyle, new ExecuteBlamAction());
+
+ getManagedForm().addPart(blamUsageSection);
+ getManagedForm().addPart(blamInputSection);
+ blamInputSection.getSection().setExpanded(true);
+ getManagedForm().addPart(blamOutputSection);
+ blamInputSection.getSection().setExpanded(true);
+
+ getManagedForm().refresh();
+ getManagedForm().getForm().layout();
+
+ }
+ private final class BlamEditorExecutionAdapter extends JobChangeAdapter {
+ private long startTime = 0;
+ private final String name;
+
+ public BlamEditorExecutionAdapter(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public void scheduled(IJobChangeEvent event) {
+ super.scheduled(event);
+ showBusy(true);
+ blamOutputSection.setText("Importing...\n");
+ }
+
+ @Override
+ public void aboutToRun(IJobChangeEvent event) {
+ super.aboutToRun(event);
+ startTime = System.currentTimeMillis();
+ blamOutputSection.setText(String.format("Starting [%s] BLAM at [%s]\n", name, Lib.getElapseString(startTime)));
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ super.done(event);
+ }
+ }
+
+ public final class ExecuteBlamAction extends Action {
+
+ public ExecuteBlamAction() {
+ super("Run BLAM in Job", Action.AS_PUSH_BUTTON);
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.RUN_EXC));
+ setToolTipText("Executes the BLAM Operation");
+ }
+
+ @Override
+ public void run() {
+ try {
+ if (coverageEditorMergeTab != null) {
+ if (coverageEditorMergeIndex != 0) {
+ try {
+ coverageEditor.removePage(coverageEditorMergeIndex);
+ } catch (AssertionFailedException ex) {
+ // page already removed; do nothing
+ }
+ coverageEditorMergeIndex = 0;
+ }
+ }
+ if (coverageImportTab != null) {
+ if (coverageImportIndex != 0) {
+ try {
+ coverageEditor.removePage(coverageImportIndex);
+ } catch (AssertionFailedException ex) {
+ // page already removed; do nothing
+ }
+ coverageImportIndex = 0;
+ }
+ }
+ if (coverageImportOverviewTab != null) {
+ if (coverageImportOverviewIndex != 0) {
+ try {
+ coverageEditor.removePage(coverageImportOverviewIndex);
+ } catch (AssertionFailedException ex) {
+ // page already removed; do nothing
+ }
+ coverageImportOverviewIndex = 0;
+ }
+ }
+ coverageImport = null;
+
+ getBlam().execute(getBlam().getName(), blamOutputSection.getOutput(), blamInputSection.getData(),
+ new BlamEditorExecutionAdapter(getBlam().getName()));
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ public void createImportParts() {
+ coverageImportOverviewTab = new CoverageEditorOverviewTab("Import Overview", coverageEditor, coverageImport);
+ coverageImportOverviewIndex = coverageEditor.addFormPage(coverageImportOverviewTab);
+
+ coverageImportTab =
+ new CoverageEditorCoverageTab(String.format("Import Items (%d)", coverageImport.getCoverageItems().size()),
+ coverageEditor, coverageImport);
+ coverageImportIndex = coverageEditor.addFormPage(coverageImportTab);
+
+ try {
+ coverageEditorMergeTab =
+ new CoverageEditorMergeTab("Import Merge", coverageEditor,
+ (CoveragePackage) coverageEditor.getCoveragePackageBase(), coverageImport);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
+ }
+ coverageEditorMergeIndex = coverageEditor.addFormPage(coverageEditorMergeTab);
+ }
+
+ @Override
+ public void showBusy(boolean busy) {
+ super.showBusy(busy);
+ if (Widgets.isAccessible(getManagedForm().getForm())) {
+ getManagedForm().getForm().getForm().setBusy(busy);
+ }
+ }
+
+ @Override
+ public FormEditor getEditor() {
+ return super.getEditor();
+ }
+
+ static ILabelProvider labelProvider = new ILabelProvider() {
+
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof AbstractBlam) {
+ return ((AbstractBlam) element).getName();
+ }
+ return "Unknown";
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ };
+
+ public CoverageImport getCoverageImport() {
+ return coverageImport;
+ }
+
+ /**
+ * This method is called at the end of the import blam being run
+ */
+ public void setCoverageImportResults(final String blamName, final CoverageImport coverageImport) {
+ this.coverageImport = coverageImport;
+ showBusy(false);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ blamOutputSection.appendText("BLAM completed\n");
+ coverageImport.setBlamName(blamName);
+ createImportParts();
+
+ if (isSimulateImput) {
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ coverageEditor.simulateImportPostRun();
+ isSimulateImput = false;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ } catch (InterruptedException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ };
+ thread.start();
+ }
+ }
+ });
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorLoadingTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorLoadingTab.java
index 5039356428..8ca76e01e9 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorLoadingTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorLoadingTab.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.editor;
-
+package org.eclipse.osee.coverage.editor;
+
import org.eclipse.osee.coverage.util.CoverageImage;
import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
import org.eclipse.osee.framework.ui.skynet.action.RefreshAction.IRefreshActionHandler;
@@ -25,68 +25,68 @@ import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageEditorLoadingTab extends FormPage implements IRefreshActionHandler {
-
- private final CoverageEditor coverageEditor;
- XResultsComposite xResultsComp;
-
- public CoverageEditorLoadingTab(String name, CoverageEditor coverageEditor) {
- super(coverageEditor, name, name);
- this.coverageEditor = coverageEditor;
- }
-
- @Override
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
-
- final ScrolledForm scrolledForm = managedForm.getForm();
- scrolledForm.setText(getTitle());
- scrolledForm.setImage(ImageManager.getImage(CoverageImage.COVERAGE));
-
- scrolledForm.getBody().setLayout(ALayout.getZeroMarginLayout());
- createToolBar();
- Composite composite = scrolledForm.getBody();
- composite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
-
- xResultsComp = new XResultsComposite(composite, SWT.NONE);
- xResultsComp.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 500;
- xResultsComp.setLayoutData(gd);
- coverageEditor.getToolkit().adapt(xResultsComp);
- getManagedForm().getForm().getForm().setBusy(true);
-
- refreshHtml();
- }
-
- public void refreshHtml() {
- final XResultData rd = new XResultData(false);
- rd.log(getTitle());
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- xResultsComp.setHtmlText(rd.getReport("").getManipulatedHtml(), "");
- }
- });
- }
-
- public void createToolBar() {
- getManagedForm().getForm().getToolBarManager().add(new RefreshAction(this));
- CoverageEditor.addToToolBar(getManagedForm().getForm().getToolBarManager(), coverageEditor);
- }
-
- @Override
- public FormEditor getEditor() {
- return super.getEditor();
- }
-
- @Override
- public void refreshActionHandler() {
- refreshHtml();
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageEditorLoadingTab extends FormPage implements IRefreshActionHandler {
+
+ private final CoverageEditor coverageEditor;
+ XResultsComposite xResultsComp;
+
+ public CoverageEditorLoadingTab(String name, CoverageEditor coverageEditor) {
+ super(coverageEditor, name, name);
+ this.coverageEditor = coverageEditor;
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+
+ final ScrolledForm scrolledForm = managedForm.getForm();
+ scrolledForm.setText(getTitle());
+ scrolledForm.setImage(ImageManager.getImage(CoverageImage.COVERAGE));
+
+ scrolledForm.getBody().setLayout(ALayout.getZeroMarginLayout());
+ createToolBar();
+ Composite composite = scrolledForm.getBody();
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ xResultsComp = new XResultsComposite(composite, SWT.NONE);
+ xResultsComp.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 500;
+ xResultsComp.setLayoutData(gd);
+ coverageEditor.getToolkit().adapt(xResultsComp);
+ getManagedForm().getForm().getForm().setBusy(true);
+
+ refreshHtml();
+ }
+
+ public void refreshHtml() {
+ final XResultData rd = new XResultData(false);
+ rd.log(getTitle());
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ xResultsComp.setHtmlText(rd.getReport("").getManipulatedHtml(), "");
+ }
+ });
+ }
+
+ public void createToolBar() {
+ getManagedForm().getForm().getToolBarManager().add(new RefreshAction(this));
+ CoverageEditor.addToToolBar(getManagedForm().getForm().getToolBarManager(), coverageEditor);
+ }
+
+ @Override
+ public FormEditor getEditor() {
+ return super.getEditor();
+ }
+
+ @Override
+ public void refreshActionHandler() {
+ refreshHtml();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorMergeTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorMergeTab.java
index 7b075dea10..92d7659e72 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorMergeTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorMergeTab.java
@@ -1,437 +1,437 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.coverage.editor;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.coverage.action.LinkWithImportItemAction;
-import org.eclipse.osee.coverage.action.ShowMergeDetailsAction;
-import org.eclipse.osee.coverage.editor.params.CoverageParameters;
-import org.eclipse.osee.coverage.editor.params.CoverageParametersComposite;
-import org.eclipse.osee.coverage.editor.params.CoverageParametersTextFilter;
-import org.eclipse.osee.coverage.editor.xcover.XCoverageViewer.TableType;
-import org.eclipse.osee.coverage.editor.xmerge.CoverageMergeXViewerFactoryImport;
-import org.eclipse.osee.coverage.editor.xmerge.CoverageMergeXViewerFactoryPackage;
-import org.eclipse.osee.coverage.editor.xmerge.XCoverageMergeViewer;
-import org.eclipse.osee.coverage.internal.Activator;
-import org.eclipse.osee.coverage.merge.IMergeItem;
-import org.eclipse.osee.coverage.merge.MergeImportManager;
-import org.eclipse.osee.coverage.merge.MergeManager;
-import org.eclipse.osee.coverage.merge.MessageMergeItem;
-import org.eclipse.osee.coverage.model.CoverageImport;
-import org.eclipse.osee.coverage.model.CoverageOption;
-import org.eclipse.osee.coverage.model.CoveragePackage;
-import org.eclipse.osee.coverage.model.ICoverage;
-import org.eclipse.osee.coverage.store.OseeCoveragePackageStore;
-import org.eclipse.osee.coverage.util.CoverageImage;
-import org.eclipse.osee.coverage.util.CoverageUtil;
-import org.eclipse.osee.coverage.util.ISaveable;
-import org.eclipse.osee.coverage.util.NotSaveable;
-import org.eclipse.osee.coverage.util.widget.XHyperlabelCoverageMethodSelection;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.action.CollapseAllAction;
-import org.eclipse.osee.framework.ui.skynet.action.ExpandAllAction;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.CheckBoxDialog;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-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.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageEditorMergeTab extends FormPage implements ISaveable {
-
- private XCoverageMergeViewer xPackageViewer1;
- private final CoveragePackage coveragePackage;
- private XCoverageMergeViewer xImportViewer2;
- private final CoverageImport coverageImport;
- private ScrolledForm scrolledForm;
- private Label titleLabel1, titleLabel2;
- private final CoverageEditor coverageEditor;
- private CoverageParametersComposite coverageParametersComposite;
- private CoverageParameters coverageParameters;
- LinkWithImportItemAction linkWithImportItemAction;
- ShowMergeDetailsAction showMergeDetailsAction;
- private MergeManager mergeManager;
- private boolean loading = false;
- private CoverageParametersTextFilter parametersFilter;
-
- public CoverageEditorMergeTab(String name, CoverageEditor coverageEditor, CoveragePackage provider1, CoverageImport provider2) {
- super(coverageEditor, name, name);
- this.coverageEditor = coverageEditor;
- this.coveragePackage = provider1;
- this.coverageImport = provider2;
- }
-
- @Override
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
-
- scrolledForm = managedForm.getForm();
- scrolledForm.setText("Merge of " + coverageImport.getName());
- scrolledForm.setImage(ImageManager.getImage(CoverageImage.COVERAGE_PACKAGE));
-
- scrolledForm.getBody().setLayout(new GridLayout(2, false));
- Composite mainComp = scrolledForm.getBody();
- coverageEditor.getToolkit().adapt(mainComp);
- mainComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
-
- coverageParameters = new CoverageParameters(coveragePackage);
- coverageParametersComposite =
- new CoverageParametersComposite(mainComp, managedForm, coverageEditor, coverageParameters,
- new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSearchButtonPressed();
- }
- });
-
- Composite tableComp = coverageEditor.getToolkit().createComposite(mainComp, SWT.NONE);
- tableComp.setLayout(ALayout.getZeroMarginLayout(3, false));
- GridData tableData = new GridData(SWT.FILL, SWT.FILL, true, true);
- tableData.horizontalSpan = 2;
- tableComp.setLayoutData(tableData);
- coverageEditor.getToolkit().adapt(tableComp);
-
- SashForm sashForm = new SashForm(tableComp, SWT.NONE);
- sashForm.setLayout(new GridLayout());
- sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- managedForm.getToolkit().adapt(sashForm);
-
- Composite leftComp = coverageEditor.getToolkit().createComposite(sashForm, SWT.NONE);
- leftComp.setLayout(ALayout.getZeroMarginLayout(1, false));
- leftComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Composite rightComp = coverageEditor.getToolkit().createComposite(sashForm, SWT.NONE);
- rightComp.setLayout(ALayout.getZeroMarginLayout(1, false));
- rightComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- createLeftComposite(managedForm, leftComp);
- createRightComposite(managedForm, rightComp);
-
- createEditorToolbar();
- updateTitles();
- }
-
- private void handleImportSelected() {
- Collection<IMergeItem> mergeItems = getSelectedMergeItems();
- if (mergeItems.isEmpty()) {
- AWorkbench.popup("Select Items to Import via Import Column");
- return;
- }
- try {
- CheckBoxDialog dialog =
- new CheckBoxDialog("Import Items", String.format("Importing [%d] items.", mergeItems.size()),
- "Save Import Record?");
- if (dialog.open() == 0) {
- XResultData rd = new MergeImportManager(mergeManager).importItems(this, mergeItems);
- rd.report("Import");
- if (dialog.isChecked()) {
- Branch branch = coverageEditor.getBranch();
- if (branch == null) {
- AWorkbench.popup("Can't determine branch");
- return;
- }
- SkynetTransaction transaction = new SkynetTransaction(branch, "Save Import Record");
- saveImportRecord(transaction, coverageImport);
- transaction.execute();
- }
- handleSearchButtonPressed();
- updateTitles();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- private void updateTitles() {
- titleLabel1.setText(coveragePackage.getName());
- titleLabel2.setText(coverageImport.getName());
- }
-
- private Collection<IMergeItem> getSelectedMergeItems() {
- Collection<IMergeItem> selected = new ArrayList<IMergeItem>();
- for (Object obj : (Collection<?>) xImportViewer2.getXViewer().getInput()) {
- if (obj instanceof IMergeItem && ((IMergeItem) obj).isChecked()) {
- selected.add((IMergeItem) obj);
- }
- }
- return selected;
- }
-
- public void createLeftComposite(IManagedForm managedForm, Composite leftComp) {
- // Fill LEFT Composite
- titleLabel1 = managedForm.getToolkit().createLabel(leftComp, coveragePackage.getName());
-
- ToolBar leftToolBar = new ToolBar(leftComp, SWT.FLAT | SWT.RIGHT);
- leftToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- managedForm.getToolkit().adapt(leftToolBar);
-
- xPackageViewer1 =
- new XCoverageMergeViewer(null, this, new CoverageMergeXViewerFactoryPackage(),
- coveragePackage.getCoverageOptionManager(), TableType.Package, TableType.Merge);
- xPackageViewer1.setDisplayLabel(false);
- xPackageViewer1.createWidgets(managedForm, leftComp, 1);
- xPackageViewer1.getXViewer().getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- linkWithImportItemAction = new LinkWithImportItemAction();
- linkWithImportItemAction.setPackageXViewer(xPackageViewer1, coveragePackage);
-
- new ActionContributionItem(linkWithImportItemAction).fill(leftToolBar, 0);
- new ActionContributionItem(new RefreshAction(xPackageViewer1)).fill(leftToolBar, 0);
- new ActionContributionItem(xPackageViewer1.getXViewer().getCustomizeAction()).fill(leftToolBar, 0);
- new ActionContributionItem(new CollapseAllAction(xPackageViewer1.getXViewer())).fill(leftToolBar, 0);
- new ActionContributionItem(new ExpandAllAction(xPackageViewer1.getXViewer())).fill(leftToolBar, 0);
- }
-
- public void createRightComposite(IManagedForm managedForm, Composite rightComp) {
- // Fill RIGHT Composite
- titleLabel2 = managedForm.getToolkit().createLabel(rightComp, coverageImport.getName());
-
- ToolBar rightToolBar = new ToolBar(rightComp, SWT.FLAT | SWT.RIGHT);
- rightToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- managedForm.getToolkit().adapt(rightToolBar);
-
- xImportViewer2 =
- new XCoverageMergeViewer(mergeManager, new NotSaveable(), new CoverageMergeXViewerFactoryImport(),
- coverageImport.getCoverageOptionManager(), TableType.Import, TableType.Merge);
- xImportViewer2.setDisplayLabel(false);
- xImportViewer2.createWidgets(managedForm, rightComp, 1);
- xImportViewer2.getXViewer().getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- linkWithImportItemAction.setImportXViewer(xImportViewer2);
-
- showMergeDetailsAction = new ShowMergeDetailsAction();
- showMergeDetailsAction.setPackageXViewer(xPackageViewer1, coveragePackage);
- showMergeDetailsAction.setImportXViewer(xImportViewer2, coverageImport);
- new ActionContributionItem(showMergeDetailsAction).fill(rightToolBar, 0);
- new ActionContributionItem(reloadAction).fill(rightToolBar, 0);
- new ActionContributionItem(new RefreshAction(xPackageViewer1)).fill(rightToolBar, 0);
- new ActionContributionItem(xImportViewer2.getXViewer().getCustomizeAction()).fill(rightToolBar, 0);
- new ActionContributionItem(new CollapseAllAction(xImportViewer2.getXViewer())).fill(rightToolBar, 0);
- new ActionContributionItem(new ExpandAllAction(xImportViewer2.getXViewer())).fill(rightToolBar, 0);
- new ActionContributionItem(importAction).fill(rightToolBar, 0);
-
- loadImportViewer(false);
- }
-
- private class ImportJobChangeListener implements IJobChangeListener {
-
- @Override
- public void aboutToRun(IJobChangeEvent event) {
- }
-
- @Override
- public void awake(IJobChangeEvent event) {
- }
-
- @Override
- public void done(IJobChangeEvent event) {
- showBusy(false);
- loading = false;
- coverageEditor.getCoverageEditorOverviewTab().refreshHtml();
- }
-
- @Override
- public void running(IJobChangeEvent event) {
- }
-
- @Override
- public void scheduled(IJobChangeEvent event) {
- showBusy(true);
- }
-
- @Override
- public void sleeping(IJobChangeEvent event) {
- }
-
- }
-
- private void loadImportViewer(boolean force) {
- if (loading) {
- AWorkbench.popup("Already Loading");
- return;
- }
- if (force || mergeManager == null) {
- mergeManager = new MergeManager(coveragePackage, coverageImport);
- }
- xImportViewer2.getXViewer().setInput(new MessageMergeItem("Loading..."));
- xImportViewer2.getXViewer().refresh();
- loading = true;
- Operations.executeAsJob(new LoadImportViewerJob(), true, Job.LONG, new ImportJobChangeListener());
- }
-
- public class LoadImportViewerJob extends AbstractOperation {
-
- public LoadImportViewerJob() {
- super("Loading Coverage Import Viewer", Activator.PLUGIN_ID);
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- final List<IMergeItem> mergeItems = mergeManager.getMergeItems();
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- xImportViewer2.getXViewer().setInput(mergeItems);
- }
- });
- }
- }
-
- private final Action reloadAction = new Action() {
- @Override
- public void run() {
- loadImportViewer(true);
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.LOAD);
- }
-
- @Override
- public String getToolTipText() {
- return "Re-Load";
- }
-
- };
-
- private final Action importAction = new Action() {
-
- @Override
- public void run() {
- try {
- Artifact artifact = ((CoverageEditorInput) coverageEditor.getEditorInput()).getCoveragePackageArtifact();
- if (artifact != null) {
- CoverageUtil.setNavigatorSelectedBranch(artifact.getBranch());
- } else {
- if (!CoverageUtil.getBranchFromUser(true)) {
- return;
- }
- }
- handleImportSelected();
- loadImportViewer(true);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public org.eclipse.jface.resource.ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.ARROW_LEFT_YELLOW);
- }
-
- @Override
- public String getToolTipText() {
- return "Import Selected Items into Coverage Package";
- };
- };
-
- public void simulateSearchAll() throws OseeArgumentException {
- XHyperlabelCoverageMethodSelection methodSelectionWidget =
- coverageParametersComposite.getCoverageMethodHyperlinkSelection();
- List<CoverageOption> values = new ArrayList<CoverageOption>();
- for (CoverageOption method : coveragePackage.getCoverageOptionManager().get()) {
- values.add(method);
- }
- methodSelectionWidget.setSelectedCoverageMethods(values);
- handleSearchButtonPressed();
- }
-
- public void createEditorToolbar() {
- CoverageEditor.addToToolBar(scrolledForm.getToolBarManager(), coverageEditor);
- scrolledForm.updateToolBar();
- }
-
- @Override
- public FormEditor getEditor() {
- return super.getEditor();
- }
-
- private void handleSearchButtonPressed() {
- if (parametersFilter == null) {
- parametersFilter = new CoverageParametersTextFilter(xPackageViewer1.getXViewer());
- xPackageViewer1.getXViewer().addFilter(parametersFilter);
- }
- CoverageEditorCoverageTab.handleSearchButtonPressed(xPackageViewer1, coverageParameters, parametersFilter);
- }
-
- @Override
- public Result isEditable() {
- return coveragePackage.isEditable();
- }
-
- @Override
- public Result save() throws OseeCoreException {
- OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, coverageEditor.getBranch());
- Result result = store.save();
- if (result.isFalse()) return result;
- Artifact artifact = store.getArtifact(false);
- coverageEditor.getCoverageEditorInput().setCoveragePackageArtifact(artifact);
- return result;
- }
-
- @Override
- public Result save(Collection<ICoverage> coverages) throws OseeCoreException {
- OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, coverageEditor.getBranch());
- Result result = store.save(coverages);
- if (result.isFalse()) return result;
- Artifact artifact = store.getArtifact(false);
- coverageEditor.getCoverageEditorInput().setCoveragePackageArtifact(artifact);
- return result;
- }
-
- @Override
- public Result saveImportRecord(SkynetTransaction transaction, CoverageImport coverageImport) throws OseeCoreException {
- OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, transaction.getBranch());
- Result result = store.saveImportRecord(transaction, coverageImport);
- return result;
- }
-
- @Override
- public Branch getBranch() throws OseeCoreException {
- return coverageEditor.getBranch();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.coverage.editor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.coverage.action.LinkWithImportItemAction;
+import org.eclipse.osee.coverage.action.ShowMergeDetailsAction;
+import org.eclipse.osee.coverage.editor.params.CoverageParameters;
+import org.eclipse.osee.coverage.editor.params.CoverageParametersComposite;
+import org.eclipse.osee.coverage.editor.params.CoverageParametersTextFilter;
+import org.eclipse.osee.coverage.editor.xcover.XCoverageViewer.TableType;
+import org.eclipse.osee.coverage.editor.xmerge.CoverageMergeXViewerFactoryImport;
+import org.eclipse.osee.coverage.editor.xmerge.CoverageMergeXViewerFactoryPackage;
+import org.eclipse.osee.coverage.editor.xmerge.XCoverageMergeViewer;
+import org.eclipse.osee.coverage.internal.Activator;
+import org.eclipse.osee.coverage.merge.IMergeItem;
+import org.eclipse.osee.coverage.merge.MergeImportManager;
+import org.eclipse.osee.coverage.merge.MergeManager;
+import org.eclipse.osee.coverage.merge.MessageMergeItem;
+import org.eclipse.osee.coverage.model.CoverageImport;
+import org.eclipse.osee.coverage.model.CoverageOption;
+import org.eclipse.osee.coverage.model.CoveragePackage;
+import org.eclipse.osee.coverage.model.ICoverage;
+import org.eclipse.osee.coverage.store.OseeCoveragePackageStore;
+import org.eclipse.osee.coverage.util.CoverageImage;
+import org.eclipse.osee.coverage.util.CoverageUtil;
+import org.eclipse.osee.coverage.util.ISaveable;
+import org.eclipse.osee.coverage.util.NotSaveable;
+import org.eclipse.osee.coverage.util.widget.XHyperlabelCoverageMethodSelection;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.action.CollapseAllAction;
+import org.eclipse.osee.framework.ui.skynet.action.ExpandAllAction;
+import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.CheckBoxDialog;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+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.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageEditorMergeTab extends FormPage implements ISaveable {
+
+ private XCoverageMergeViewer xPackageViewer1;
+ private final CoveragePackage coveragePackage;
+ private XCoverageMergeViewer xImportViewer2;
+ private final CoverageImport coverageImport;
+ private ScrolledForm scrolledForm;
+ private Label titleLabel1, titleLabel2;
+ private final CoverageEditor coverageEditor;
+ private CoverageParametersComposite coverageParametersComposite;
+ private CoverageParameters coverageParameters;
+ LinkWithImportItemAction linkWithImportItemAction;
+ ShowMergeDetailsAction showMergeDetailsAction;
+ private MergeManager mergeManager;
+ private boolean loading = false;
+ private CoverageParametersTextFilter parametersFilter;
+
+ public CoverageEditorMergeTab(String name, CoverageEditor coverageEditor, CoveragePackage provider1, CoverageImport provider2) {
+ super(coverageEditor, name, name);
+ this.coverageEditor = coverageEditor;
+ this.coveragePackage = provider1;
+ this.coverageImport = provider2;
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+
+ scrolledForm = managedForm.getForm();
+ scrolledForm.setText("Merge of " + coverageImport.getName());
+ scrolledForm.setImage(ImageManager.getImage(CoverageImage.COVERAGE_PACKAGE));
+
+ scrolledForm.getBody().setLayout(new GridLayout(2, false));
+ Composite mainComp = scrolledForm.getBody();
+ coverageEditor.getToolkit().adapt(mainComp);
+ mainComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ coverageParameters = new CoverageParameters(coveragePackage);
+ coverageParametersComposite =
+ new CoverageParametersComposite(mainComp, managedForm, coverageEditor, coverageParameters,
+ new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleSearchButtonPressed();
+ }
+ });
+
+ Composite tableComp = coverageEditor.getToolkit().createComposite(mainComp, SWT.NONE);
+ tableComp.setLayout(ALayout.getZeroMarginLayout(3, false));
+ GridData tableData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ tableData.horizontalSpan = 2;
+ tableComp.setLayoutData(tableData);
+ coverageEditor.getToolkit().adapt(tableComp);
+
+ SashForm sashForm = new SashForm(tableComp, SWT.NONE);
+ sashForm.setLayout(new GridLayout());
+ sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ managedForm.getToolkit().adapt(sashForm);
+
+ Composite leftComp = coverageEditor.getToolkit().createComposite(sashForm, SWT.NONE);
+ leftComp.setLayout(ALayout.getZeroMarginLayout(1, false));
+ leftComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Composite rightComp = coverageEditor.getToolkit().createComposite(sashForm, SWT.NONE);
+ rightComp.setLayout(ALayout.getZeroMarginLayout(1, false));
+ rightComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ createLeftComposite(managedForm, leftComp);
+ createRightComposite(managedForm, rightComp);
+
+ createEditorToolbar();
+ updateTitles();
+ }
+
+ private void handleImportSelected() {
+ Collection<IMergeItem> mergeItems = getSelectedMergeItems();
+ if (mergeItems.isEmpty()) {
+ AWorkbench.popup("Select Items to Import via Import Column");
+ return;
+ }
+ try {
+ CheckBoxDialog dialog =
+ new CheckBoxDialog("Import Items", String.format("Importing [%d] items.", mergeItems.size()),
+ "Save Import Record?");
+ if (dialog.open() == 0) {
+ XResultData rd = new MergeImportManager(mergeManager).importItems(this, mergeItems);
+ rd.report("Import");
+ if (dialog.isChecked()) {
+ Branch branch = coverageEditor.getBranch();
+ if (branch == null) {
+ AWorkbench.popup("Can't determine branch");
+ return;
+ }
+ SkynetTransaction transaction = new SkynetTransaction(branch, "Save Import Record");
+ saveImportRecord(transaction, coverageImport);
+ transaction.execute();
+ }
+ handleSearchButtonPressed();
+ updateTitles();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ private void updateTitles() {
+ titleLabel1.setText(coveragePackage.getName());
+ titleLabel2.setText(coverageImport.getName());
+ }
+
+ private Collection<IMergeItem> getSelectedMergeItems() {
+ Collection<IMergeItem> selected = new ArrayList<IMergeItem>();
+ for (Object obj : (Collection<?>) xImportViewer2.getXViewer().getInput()) {
+ if (obj instanceof IMergeItem && ((IMergeItem) obj).isChecked()) {
+ selected.add((IMergeItem) obj);
+ }
+ }
+ return selected;
+ }
+
+ public void createLeftComposite(IManagedForm managedForm, Composite leftComp) {
+ // Fill LEFT Composite
+ titleLabel1 = managedForm.getToolkit().createLabel(leftComp, coveragePackage.getName());
+
+ ToolBar leftToolBar = new ToolBar(leftComp, SWT.FLAT | SWT.RIGHT);
+ leftToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ managedForm.getToolkit().adapt(leftToolBar);
+
+ xPackageViewer1 =
+ new XCoverageMergeViewer(null, this, new CoverageMergeXViewerFactoryPackage(),
+ coveragePackage.getCoverageOptionManager(), TableType.Package, TableType.Merge);
+ xPackageViewer1.setDisplayLabel(false);
+ xPackageViewer1.createWidgets(managedForm, leftComp, 1);
+ xPackageViewer1.getXViewer().getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ linkWithImportItemAction = new LinkWithImportItemAction();
+ linkWithImportItemAction.setPackageXViewer(xPackageViewer1, coveragePackage);
+
+ new ActionContributionItem(linkWithImportItemAction).fill(leftToolBar, 0);
+ new ActionContributionItem(new RefreshAction(xPackageViewer1)).fill(leftToolBar, 0);
+ new ActionContributionItem(xPackageViewer1.getXViewer().getCustomizeAction()).fill(leftToolBar, 0);
+ new ActionContributionItem(new CollapseAllAction(xPackageViewer1.getXViewer())).fill(leftToolBar, 0);
+ new ActionContributionItem(new ExpandAllAction(xPackageViewer1.getXViewer())).fill(leftToolBar, 0);
+ }
+
+ public void createRightComposite(IManagedForm managedForm, Composite rightComp) {
+ // Fill RIGHT Composite
+ titleLabel2 = managedForm.getToolkit().createLabel(rightComp, coverageImport.getName());
+
+ ToolBar rightToolBar = new ToolBar(rightComp, SWT.FLAT | SWT.RIGHT);
+ rightToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ managedForm.getToolkit().adapt(rightToolBar);
+
+ xImportViewer2 =
+ new XCoverageMergeViewer(mergeManager, new NotSaveable(), new CoverageMergeXViewerFactoryImport(),
+ coverageImport.getCoverageOptionManager(), TableType.Import, TableType.Merge);
+ xImportViewer2.setDisplayLabel(false);
+ xImportViewer2.createWidgets(managedForm, rightComp, 1);
+ xImportViewer2.getXViewer().getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ linkWithImportItemAction.setImportXViewer(xImportViewer2);
+
+ showMergeDetailsAction = new ShowMergeDetailsAction();
+ showMergeDetailsAction.setPackageXViewer(xPackageViewer1, coveragePackage);
+ showMergeDetailsAction.setImportXViewer(xImportViewer2, coverageImport);
+ new ActionContributionItem(showMergeDetailsAction).fill(rightToolBar, 0);
+ new ActionContributionItem(reloadAction).fill(rightToolBar, 0);
+ new ActionContributionItem(new RefreshAction(xPackageViewer1)).fill(rightToolBar, 0);
+ new ActionContributionItem(xImportViewer2.getXViewer().getCustomizeAction()).fill(rightToolBar, 0);
+ new ActionContributionItem(new CollapseAllAction(xImportViewer2.getXViewer())).fill(rightToolBar, 0);
+ new ActionContributionItem(new ExpandAllAction(xImportViewer2.getXViewer())).fill(rightToolBar, 0);
+ new ActionContributionItem(importAction).fill(rightToolBar, 0);
+
+ loadImportViewer(false);
+ }
+
+ private class ImportJobChangeListener implements IJobChangeListener {
+
+ @Override
+ public void aboutToRun(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void awake(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ showBusy(false);
+ loading = false;
+ coverageEditor.getCoverageEditorOverviewTab().refreshHtml();
+ }
+
+ @Override
+ public void running(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void scheduled(IJobChangeEvent event) {
+ showBusy(true);
+ }
+
+ @Override
+ public void sleeping(IJobChangeEvent event) {
+ }
+
+ }
+
+ private void loadImportViewer(boolean force) {
+ if (loading) {
+ AWorkbench.popup("Already Loading");
+ return;
+ }
+ if (force || mergeManager == null) {
+ mergeManager = new MergeManager(coveragePackage, coverageImport);
+ }
+ xImportViewer2.getXViewer().setInput(new MessageMergeItem("Loading..."));
+ xImportViewer2.getXViewer().refresh();
+ loading = true;
+ Operations.executeAsJob(new LoadImportViewerJob(), true, Job.LONG, new ImportJobChangeListener());
+ }
+
+ public class LoadImportViewerJob extends AbstractOperation {
+
+ public LoadImportViewerJob() {
+ super("Loading Coverage Import Viewer", Activator.PLUGIN_ID);
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ final List<IMergeItem> mergeItems = mergeManager.getMergeItems();
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ xImportViewer2.getXViewer().setInput(mergeItems);
+ }
+ });
+ }
+ }
+
+ private final Action reloadAction = new Action() {
+ @Override
+ public void run() {
+ loadImportViewer(true);
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.LOAD);
+ }
+
+ @Override
+ public String getToolTipText() {
+ return "Re-Load";
+ }
+
+ };
+
+ private final Action importAction = new Action() {
+
+ @Override
+ public void run() {
+ try {
+ Artifact artifact = ((CoverageEditorInput) coverageEditor.getEditorInput()).getCoveragePackageArtifact();
+ if (artifact != null) {
+ CoverageUtil.setNavigatorSelectedBranch(artifact.getBranch());
+ } else {
+ if (!CoverageUtil.getBranchFromUser(true)) {
+ return;
+ }
+ }
+ handleImportSelected();
+ loadImportViewer(true);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public org.eclipse.jface.resource.ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.ARROW_LEFT_YELLOW);
+ }
+
+ @Override
+ public String getToolTipText() {
+ return "Import Selected Items into Coverage Package";
+ };
+ };
+
+ public void simulateSearchAll() throws OseeArgumentException {
+ XHyperlabelCoverageMethodSelection methodSelectionWidget =
+ coverageParametersComposite.getCoverageMethodHyperlinkSelection();
+ List<CoverageOption> values = new ArrayList<CoverageOption>();
+ for (CoverageOption method : coveragePackage.getCoverageOptionManager().get()) {
+ values.add(method);
+ }
+ methodSelectionWidget.setSelectedCoverageMethods(values);
+ handleSearchButtonPressed();
+ }
+
+ public void createEditorToolbar() {
+ CoverageEditor.addToToolBar(scrolledForm.getToolBarManager(), coverageEditor);
+ scrolledForm.updateToolBar();
+ }
+
+ @Override
+ public FormEditor getEditor() {
+ return super.getEditor();
+ }
+
+ private void handleSearchButtonPressed() {
+ if (parametersFilter == null) {
+ parametersFilter = new CoverageParametersTextFilter(xPackageViewer1.getXViewer());
+ xPackageViewer1.getXViewer().addFilter(parametersFilter);
+ }
+ CoverageEditorCoverageTab.handleSearchButtonPressed(xPackageViewer1, coverageParameters, parametersFilter);
+ }
+
+ @Override
+ public Result isEditable() {
+ return coveragePackage.isEditable();
+ }
+
+ @Override
+ public Result save() throws OseeCoreException {
+ OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, coverageEditor.getBranch());
+ Result result = store.save();
+ if (result.isFalse()) return result;
+ Artifact artifact = store.getArtifact(false);
+ coverageEditor.getCoverageEditorInput().setCoveragePackageArtifact(artifact);
+ return result;
+ }
+
+ @Override
+ public Result save(Collection<ICoverage> coverages) throws OseeCoreException {
+ OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, coverageEditor.getBranch());
+ Result result = store.save(coverages);
+ if (result.isFalse()) return result;
+ Artifact artifact = store.getArtifact(false);
+ coverageEditor.getCoverageEditorInput().setCoveragePackageArtifact(artifact);
+ return result;
+ }
+
+ @Override
+ public Result saveImportRecord(SkynetTransaction transaction, CoverageImport coverageImport) throws OseeCoreException {
+ OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, transaction.getBranch());
+ Result result = store.saveImportRecord(transaction, coverageImport);
+ return result;
+ }
+
+ @Override
+ public Branch getBranch() throws OseeCoreException {
+ return coverageEditor.getBranch();
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java
index e9b98c17af..896dc46298 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.editor;
-
+package org.eclipse.osee.coverage.editor;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -40,218 +40,218 @@ import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageEditorOverviewTab extends FormPage implements IRefreshActionHandler, ICoveragePackageHandler, IBrowserActionHandler {
-
- private final CoverageEditor coverageEditor;
- private final CoveragePackageBase coveragePackageBase;
- XResultsComposite xResultsComp;
- private static String ALL_COVERAGE_METHODS = " ALL Coverage Methods";
- private static String ALL_TOP_FOLDERS = " ALL Top Folders";
-
- public CoverageEditorOverviewTab(String name, CoverageEditor coverageEditor, CoveragePackageBase provider) {
- super(coverageEditor, name, name);
- this.coverageEditor = coverageEditor;
- this.coveragePackageBase = provider;
- }
-
- @Override
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
-
- final ScrolledForm scrolledForm = managedForm.getForm();
- scrolledForm.setText(coveragePackageBase.getName());
- scrolledForm.setImage(ImageManager.getImage(CoverageUtil.getCoveragePackageBaseImage(coveragePackageBase)));
-
- scrolledForm.getBody().setLayout(ALayout.getZeroMarginLayout());
- createToolBar();
- Composite composite = scrolledForm.getBody();
- composite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
-
- xResultsComp = new XResultsComposite(composite, SWT.NONE);
- xResultsComp.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 500;
- xResultsComp.setLayoutData(gd);
- coverageEditor.getToolkit().adapt(xResultsComp);
-
- refreshHtml();
- }
-
- public void refreshHtml() {
- final XResultData rd = new XResultData(false);
- coveragePackageBase.getOverviewHtmlHeader(rd);
- rd.log("");
- rd.log(AHTML.getLabelValueStr("Total Coverage ",
- CoverageUtil.getPercent(coveragePackageBase.getCoverageItemsCovered().size(),
- coveragePackageBase.getCoverageItems().size(), true).getSecond()));
- rd.log("");
- rd.log(AHTML.getLabelValueStr("Coverage Breakdown", ""));
- rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
-
- // Create headers
- List<String> sortedHeaders = getSortedHeaders(coveragePackageBase);
- rd.addRaw(AHTML.addHeaderRowMultiColumnTable(sortedHeaders));
-
- for (String[] values : getRows(sortedHeaders, coveragePackageBase, true)) {
- rd.addRaw(AHTML.addRowMultiColumnTable(values));
- }
-
- rd.addRaw(AHTML.endMultiColumnTable());
- String branchName = null;
- try {
- branchName = coverageEditor.getBranch().getName();
- } catch (Exception ex) {
- branchName = "Exception: " + ex.getLocalizedMessage();
- }
- rd.addRaw(AHTML.newline());
- rd.addRaw(AHTML.getLabelValueStr("\nEditor Branch", branchName));
- if (coveragePackageBase.getLog() != null) {
- rd.log(AHTML.newline() + AHTML.bold("Log:") + AHTML.newline());
- rd.addRaw(coveragePackageBase.getLog().getReport("").getManipulatedHtml());
- }
-
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- xResultsComp.setHtmlText(rd.getReport(coveragePackageBase.getName()).getManipulatedHtml(),
- coveragePackageBase.getName());
- }
- });
- }
-
- public static List<String[]> getRows(List<String> sortedHeaders, CoveragePackageBase coveragePackageBase, boolean html) {
-
- Map<String, CoverageUnit> headerToCoverageUnit = new HashMap<String, CoverageUnit>();
- for (CoverageUnit coverageUnit : coveragePackageBase.getCoverageUnits()) {
- headerToCoverageUnit.put(coverageUnit.getName(), coverageUnit);
- }
-
- // Create rows
- String rowsSorted[] = getRowNamesSorted(coveragePackageBase);
- Map<String, CoverageOption> rowToCoverageOption = new HashMap<String, CoverageOption>();
- for (CoverageOption option : coveragePackageBase.getCoverageOptionManager().get()) {
- rowToCoverageOption.put(option.getName(), option);
- }
-
- List<String[]> rows = new ArrayList<String[]>();
- for (String rowName : rowsSorted) {
- List<String> values = new ArrayList<String>();
- for (String header : sortedHeaders) {
- if (header.equals("")) {
- if (html) {
- values.add(AHTML.bold(rowName));
- } else
- values.add(rowName);
- }
- // Show totals for ALL and Each CoverageOption
- else if (header.equals(ALL_TOP_FOLDERS)) {
- // Show totals for full coverage package
- if (rowName.equals(ALL_COVERAGE_METHODS)) {
- String percent =
- CoverageUtil.getPercent(coveragePackageBase.getCoverageItemsCovered().size(),
- coveragePackageBase.getCoverageItems().size(), true).getSecond();
- if (html) {
- values.add(AHTML.bold(percent));
- } else
- values.add(percent);
- }
- // Show totals for each coverage method
- else if (!rowName.equals(CoverageOptionManagerDefault.Not_Covered.getName())) {
- int totalCoverageItems = coveragePackageBase.getCoverageItems().size();
- if (totalCoverageItems == 0) {
- values.add("0");
- } else {
- CoverageOption CoverageOption = rowToCoverageOption.get(rowName);
- values.add(CoverageUtil.getPercent(
- coveragePackageBase.getCoverageItemsCovered(CoverageOption).size(), totalCoverageItems,
- false).getSecond());
- }
- }
- }
- // Show totals for ALL by top CoverageUnit and each CoverageOption by top CoverageUnit
- else {
- CoverageUnit coverageUnit = headerToCoverageUnit.get(header);
- if (rowName.equals(ALL_COVERAGE_METHODS)) {
- int totalCoverageItems = coverageUnit.getCoverageItems(true).size();
- if (totalCoverageItems == 0) {
- values.add("0");
- } else {
- values.add(CoverageUtil.getPercent(coverageUnit.getCoverageItemsCovered(true).size(),
- totalCoverageItems, false).getSecond());
- }
- } else if (!rowName.equals(CoverageOptionManagerDefault.Not_Covered.getName())) {
- CoverageOption CoverageOption = rowToCoverageOption.get(rowName);
- int totalCoverageItems = coverageUnit.getCoverageItems(true).size();
- if (totalCoverageItems == 0) {
- values.add("0");
- } else {
- values.add(CoverageUtil.getPercent(
- coverageUnit.getCoverageItemsCovered(true, CoverageOption).size(), totalCoverageItems, false).getSecond());
- }
- }
- }
- }
- rows.add(values.toArray(new String[values.size()]));
- }
- return rows;
- }
-
- public static String[] getRowNamesSorted(CoveragePackageBase coveragePackageBase) {
- List<String> rowNames = new ArrayList<String>();
- rowNames.add(ALL_COVERAGE_METHODS);
- for (CoverageOption option : coveragePackageBase.getCoverageOptionManager().get()) {
- if (!option.getName().equals(CoverageOptionManagerDefault.Not_Covered.getName())) {
- rowNames.add(option.getName());
- }
- }
- String rowsSorted[] = rowNames.toArray(new String[rowNames.size()]);
- Arrays.sort(rowsSorted);
- return rowsSorted;
- }
-
- public static List<String> getSortedHeaders(CoveragePackageBase coveragePackageBase) {
- List<String> headers = new ArrayList<String>();
- headers.add("");
- if (coveragePackageBase.getChildren().size() > 1) {
- headers.add(ALL_TOP_FOLDERS);
- }
- for (CoverageUnit coverageUnit : coveragePackageBase.getCoverageUnits()) {
- headers.add(coverageUnit.getName());
- }
- String headersSorted[] = headers.toArray(new String[headers.size()]);
- Arrays.sort(headersSorted);
- return headers;
- }
-
- public void createToolBar() {
- getManagedForm().getForm().getToolBarManager().add(new GenerateDetailedCoverageReportAction(this));
- getManagedForm().getForm().getToolBarManager().add(new BrowserPrintAction(this));
- getManagedForm().getForm().getToolBarManager().add(new RefreshAction(this));
- CoverageEditor.addToToolBar(getManagedForm().getForm().getToolBarManager(), coverageEditor);
- }
-
- @Override
- public FormEditor getEditor() {
- return super.getEditor();
- }
-
- @Override
- public void refreshActionHandler() {
- refreshHtml();
- }
-
- @Override
- public Browser getBrowser() {
- return xResultsComp.getBrowser();
- }
-
- @Override
- public CoveragePackageBase getCoveragePackageBase() {
- return coveragePackageBase;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageEditorOverviewTab extends FormPage implements IRefreshActionHandler, ICoveragePackageHandler, IBrowserActionHandler {
+
+ private final CoverageEditor coverageEditor;
+ private final CoveragePackageBase coveragePackageBase;
+ XResultsComposite xResultsComp;
+ private static String ALL_COVERAGE_METHODS = " ALL Coverage Methods";
+ private static String ALL_TOP_FOLDERS = " ALL Top Folders";
+
+ public CoverageEditorOverviewTab(String name, CoverageEditor coverageEditor, CoveragePackageBase provider) {
+ super(coverageEditor, name, name);
+ this.coverageEditor = coverageEditor;
+ this.coveragePackageBase = provider;
+ }
+
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+
+ final ScrolledForm scrolledForm = managedForm.getForm();
+ scrolledForm.setText(coveragePackageBase.getName());
+ scrolledForm.setImage(ImageManager.getImage(CoverageUtil.getCoveragePackageBaseImage(coveragePackageBase)));
+
+ scrolledForm.getBody().setLayout(ALayout.getZeroMarginLayout());
+ createToolBar();
+ Composite composite = scrolledForm.getBody();
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ xResultsComp = new XResultsComposite(composite, SWT.NONE);
+ xResultsComp.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 500;
+ xResultsComp.setLayoutData(gd);
+ coverageEditor.getToolkit().adapt(xResultsComp);
+
+ refreshHtml();
+ }
+
+ public void refreshHtml() {
+ final XResultData rd = new XResultData(false);
+ coveragePackageBase.getOverviewHtmlHeader(rd);
+ rd.log("");
+ rd.log(AHTML.getLabelValueStr("Total Coverage ",
+ CoverageUtil.getPercent(coveragePackageBase.getCoverageItemsCovered().size(),
+ coveragePackageBase.getCoverageItems().size(), true).getSecond()));
+ rd.log("");
+ rd.log(AHTML.getLabelValueStr("Coverage Breakdown", ""));
+ rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
+
+ // Create headers
+ List<String> sortedHeaders = getSortedHeaders(coveragePackageBase);
+ rd.addRaw(AHTML.addHeaderRowMultiColumnTable(sortedHeaders));
+
+ for (String[] values : getRows(sortedHeaders, coveragePackageBase, true)) {
+ rd.addRaw(AHTML.addRowMultiColumnTable(values));
+ }
+
+ rd.addRaw(AHTML.endMultiColumnTable());
+ String branchName = null;
+ try {
+ branchName = coverageEditor.getBranch().getName();
+ } catch (Exception ex) {
+ branchName = "Exception: " + ex.getLocalizedMessage();
+ }
+ rd.addRaw(AHTML.newline());
+ rd.addRaw(AHTML.getLabelValueStr("\nEditor Branch", branchName));
+ if (coveragePackageBase.getLog() != null) {
+ rd.log(AHTML.newline() + AHTML.bold("Log:") + AHTML.newline());
+ rd.addRaw(coveragePackageBase.getLog().getReport("").getManipulatedHtml());
+ }
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ xResultsComp.setHtmlText(rd.getReport(coveragePackageBase.getName()).getManipulatedHtml(),
+ coveragePackageBase.getName());
+ }
+ });
+ }
+
+ public static List<String[]> getRows(List<String> sortedHeaders, CoveragePackageBase coveragePackageBase, boolean html) {
+
+ Map<String, CoverageUnit> headerToCoverageUnit = new HashMap<String, CoverageUnit>();
+ for (CoverageUnit coverageUnit : coveragePackageBase.getCoverageUnits()) {
+ headerToCoverageUnit.put(coverageUnit.getName(), coverageUnit);
+ }
+
+ // Create rows
+ String rowsSorted[] = getRowNamesSorted(coveragePackageBase);
+ Map<String, CoverageOption> rowToCoverageOption = new HashMap<String, CoverageOption>();
+ for (CoverageOption option : coveragePackageBase.getCoverageOptionManager().get()) {
+ rowToCoverageOption.put(option.getName(), option);
+ }
+
+ List<String[]> rows = new ArrayList<String[]>();
+ for (String rowName : rowsSorted) {
+ List<String> values = new ArrayList<String>();
+ for (String header : sortedHeaders) {
+ if (header.equals("")) {
+ if (html) {
+ values.add(AHTML.bold(rowName));
+ } else
+ values.add(rowName);
+ }
+ // Show totals for ALL and Each CoverageOption
+ else if (header.equals(ALL_TOP_FOLDERS)) {
+ // Show totals for full coverage package
+ if (rowName.equals(ALL_COVERAGE_METHODS)) {
+ String percent =
+ CoverageUtil.getPercent(coveragePackageBase.getCoverageItemsCovered().size(),
+ coveragePackageBase.getCoverageItems().size(), true).getSecond();
+ if (html) {
+ values.add(AHTML.bold(percent));
+ } else
+ values.add(percent);
+ }
+ // Show totals for each coverage method
+ else if (!rowName.equals(CoverageOptionManagerDefault.Not_Covered.getName())) {
+ int totalCoverageItems = coveragePackageBase.getCoverageItems().size();
+ if (totalCoverageItems == 0) {
+ values.add("0");
+ } else {
+ CoverageOption CoverageOption = rowToCoverageOption.get(rowName);
+ values.add(CoverageUtil.getPercent(
+ coveragePackageBase.getCoverageItemsCovered(CoverageOption).size(), totalCoverageItems,
+ false).getSecond());
+ }
+ }
+ }
+ // Show totals for ALL by top CoverageUnit and each CoverageOption by top CoverageUnit
+ else {
+ CoverageUnit coverageUnit = headerToCoverageUnit.get(header);
+ if (rowName.equals(ALL_COVERAGE_METHODS)) {
+ int totalCoverageItems = coverageUnit.getCoverageItems(true).size();
+ if (totalCoverageItems == 0) {
+ values.add("0");
+ } else {
+ values.add(CoverageUtil.getPercent(coverageUnit.getCoverageItemsCovered(true).size(),
+ totalCoverageItems, false).getSecond());
+ }
+ } else if (!rowName.equals(CoverageOptionManagerDefault.Not_Covered.getName())) {
+ CoverageOption CoverageOption = rowToCoverageOption.get(rowName);
+ int totalCoverageItems = coverageUnit.getCoverageItems(true).size();
+ if (totalCoverageItems == 0) {
+ values.add("0");
+ } else {
+ values.add(CoverageUtil.getPercent(
+ coverageUnit.getCoverageItemsCovered(true, CoverageOption).size(), totalCoverageItems, false).getSecond());
+ }
+ }
+ }
+ }
+ rows.add(values.toArray(new String[values.size()]));
+ }
+ return rows;
+ }
+
+ public static String[] getRowNamesSorted(CoveragePackageBase coveragePackageBase) {
+ List<String> rowNames = new ArrayList<String>();
+ rowNames.add(ALL_COVERAGE_METHODS);
+ for (CoverageOption option : coveragePackageBase.getCoverageOptionManager().get()) {
+ if (!option.getName().equals(CoverageOptionManagerDefault.Not_Covered.getName())) {
+ rowNames.add(option.getName());
+ }
+ }
+ String rowsSorted[] = rowNames.toArray(new String[rowNames.size()]);
+ Arrays.sort(rowsSorted);
+ return rowsSorted;
+ }
+
+ public static List<String> getSortedHeaders(CoveragePackageBase coveragePackageBase) {
+ List<String> headers = new ArrayList<String>();
+ headers.add("");
+ if (coveragePackageBase.getChildren().size() > 1) {
+ headers.add(ALL_TOP_FOLDERS);
+ }
+ for (CoverageUnit coverageUnit : coveragePackageBase.getCoverageUnits()) {
+ headers.add(coverageUnit.getName());
+ }
+ String headersSorted[] = headers.toArray(new String[headers.size()]);
+ Arrays.sort(headersSorted);
+ return headers;
+ }
+
+ public void createToolBar() {
+ getManagedForm().getForm().getToolBarManager().add(new GenerateDetailedCoverageReportAction(this));
+ getManagedForm().getForm().getToolBarManager().add(new BrowserPrintAction(this));
+ getManagedForm().getForm().getToolBarManager().add(new RefreshAction(this));
+ CoverageEditor.addToToolBar(getManagedForm().getForm().getToolBarManager(), coverageEditor);
+ }
+
+ @Override
+ public FormEditor getEditor() {
+ return super.getEditor();
+ }
+
+ @Override
+ public void refreshActionHandler() {
+ refreshHtml();
+ }
+
+ @Override
+ public Browser getBrowser() {
+ return xResultsComp.getBrowser();
+ }
+
+ @Override
+ public CoveragePackageBase getCoveragePackageBase() {
+ return coveragePackageBase;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParameters.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParameters.java
index 84aa2316cb..0788fe5dc5 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParameters.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParameters.java
@@ -1,321 +1,321 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.coverage.editor.params;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.osee.coverage.internal.Activator;
-import org.eclipse.osee.coverage.model.CoverageItem;
-import org.eclipse.osee.coverage.model.CoverageOption;
-import org.eclipse.osee.coverage.model.CoveragePackageBase;
-import org.eclipse.osee.coverage.model.CoverageUnit;
-import org.eclipse.osee.coverage.model.ICoverage;
-import org.eclipse.osee.coverage.store.OseeCoverageUnitStore;
-import org.eclipse.osee.coverage.util.CoverageUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageParameters {
-
- private final CoveragePackageBase coveragePackageBase;
- private List<CoverageOption> coverageMethods = new ArrayList<CoverageOption>();
- private String name;
- private String namespace;
- private String rationale;
- private String notes;
- private User assignee;
- private boolean showAll = true;
-
- public CoverageParameters(CoveragePackageBase coveragePackageBase) {
- this.coveragePackageBase = coveragePackageBase;
- }
-
- /**
- * Returns a collection of ICoverage items that matched and a collection of all top level ICoverage parents
- */
- public Pair<Set<ICoverage>, Set<ICoverage>> performSearchGetResults() throws OseeCoreException {
- Set<ICoverage> items = new HashSet<ICoverage>();
- for (ICoverage coverageItem : coveragePackageBase.getChildren(false)) {
- performSearchGetResults(items, coverageItem);
- }
- Set<ICoverage> parents = new HashSet<ICoverage>();
- for (ICoverage coverage : items) {
- parents.add(CoverageUtil.getTopLevelCoverageUnit(coverage));
- }
- return new Pair<Set<ICoverage>, Set<ICoverage>>(items, parents);
- }
-
- // CoverageUnit - name, namespace, assignees, notes
- // CoverageItem - name, namespace, rationale, coverageMethod
- public void performSearchGetResults(Set<ICoverage> matchItems, ICoverage coverage) throws OseeCoreException {
- if (coverage instanceof CoverageItem) {
- if (isCoverageMethodMatch(coverage) &&
- //
- isRationaleMatch(coverage) &&
- //
- isNameMatch(coverage) &&
- //
- isNamespaceMatch(coverage)) {
- // CoverageItem matches search criteria; validate CoverageUnits up the hierarchy
- if (doesParentMatchCriteria(coverage.getParent())) {
- matchItems.add(coverage);
- }
- }
- } else if (coverage instanceof CoverageUnit) {
- if (Strings.isValid(name) || Strings.isValid(namespace) || Strings.isValid(notes) || assignee != null) {
- if (!((CoverageUnit) coverage).isFolder() && isNameMatch(coverage) && isNamespaceMatch(coverage) && isNotesMatch(coverage) && isAssigneeMatch(coverage)) {
- matchItems.add(coverage);
- // If CoverageUnit matches, include all coverage items in match
- for (CoverageItem coverageItem : ((CoverageUnit) coverage).getCoverageItems(true)) {
- // Don't check name cause name of coverge unit won't match name of item
- // Checking namespace shouldn't matter cause children will have namespace of parent
- if (isCoverageMethodMatch(coverageItem) &&
- //
- isRationaleMatch(coverageItem) &&
- //
- isNamespaceMatch(coverageItem)) {
- matchItems.add(coverageItem);
- }
- }
- }
- }
- }
- for (ICoverage child : coverage.getChildren()) {
- performSearchGetResults(matchItems, child);
- }
- }
-
- /**
- * Recurse up parent tree to ensure all parents match criteria
- */
- private boolean doesParentMatchCriteria(ICoverage coverage) throws OseeCoreException {
- if ((isNameMatch(coverage) || isNamespaceMatch(coverage)) && isNotesMatch(coverage) && isAssigneeMatch(coverage)) {
- return true;
- } else if (coverage.getParent() instanceof CoverageUnit) {
- return doesParentMatchCriteria(coverage.getParent());
- }
- return false;
- }
-
- /**
- * Match if no assignee specified OR<br>
- * coverage isn't CoverageUnit OR<br>
- * CoverageUnit assignee equals search assignee
- *
- * @throws OseeCoreException
- */
- public boolean isAssigneeMatch(ICoverage coverage) throws OseeCoreException {
- if (assignee == null || !(coverage instanceof CoverageUnit)) return true;
- if (OseeCoverageUnitStore.getAssignees((CoverageUnit) coverage).contains(assignee)) {
- return true;
- }
- return false;
- }
-
- /**
- * Match if no notes specified OR<br>
- * coverage isn't CoverageUnit OR<br>
- * CoverageUnit notes contains search string
- */
- public boolean isNotesMatch(ICoverage coverage) {
- if (!Strings.isValid(notes) || !(coverage instanceof CoverageUnit)) return true;
- if (!Strings.isValid(((CoverageUnit) coverage).getNotes())) return false;
- if (((CoverageUnit) coverage).getNotes().contains(notes)) {
- return true;
- }
- return false;
- }
-
- /**
- * Match if no name specified OR<br>
- * item name contains search string
- */
- public boolean isNameMatch(ICoverage coverage) {
- if (!Strings.isValid(name)) return true;
- if (!Strings.isValid(coverage.getName())) return false;
- if (coverage.getName().contains(name)) {
- return true;
- }
- return false;
- }
-
- /**
- * Match if no namespace specified OR<br>
- * item namespace contains search string
- */
- public boolean isNamespaceMatch(ICoverage coverage) {
- if (!Strings.isValid(namespace)) return true;
- if (!Strings.isValid(coverage.getNamespace())) return false;
- if (coverage.getNamespace().contains(namespace)) {
- return true;
- }
- return false;
- }
-
- /**
- * Match if no rationale specified OR<br>
- * coverage isn't CoverageItem OR<br>
- * CoverageItem rationale contains search string
- */
- public boolean isRationaleMatch(ICoverage coverage) {
- if (!Strings.isValid(rationale) || !(coverage instanceof CoverageItem)) return true;
- if (!Strings.isValid(((CoverageItem) coverage).getRationale())) return false;
- if (((CoverageItem) coverage).getRationale().contains(rationale)) {
- return true;
- }
- return false;
- }
-
- /**
- * Match if no coverageMethods specified OR<br>
- * coverage isn't CoverageItem OR<br>
- * CoverageItem is method specified
- */
- public boolean isCoverageMethodMatch(ICoverage coverage) {
- if (coverageMethods.isEmpty() || !(coverage instanceof CoverageItem)) return true;
- if (coverageMethods.contains(((CoverageItem) coverage).getCoverageMethod())) {
- return true;
- }
- return false;
- }
-
- public String getSelectedName(/*SearchType searchType*/) throws OseeCoreException {
- StringBuffer sb = new StringBuffer();
- if (getAssignee() != null) {
- sb.append(" - Assignee: " + getAssignee());
- }
- if (Strings.isValid(getName())) {
- sb.append(" - Name: " + getName());
- }
- if (Strings.isValid(getNamespace())) {
- sb.append(" - Namespace: " + getNamespace());
- }
- if (Strings.isValid(getRationale())) {
- sb.append(" - Rationale: " + getRationale());
- }
- if (Strings.isValid(getNotes())) {
- sb.append(" - Notes: " + getNotes());
- }
- if (getSelectedCoverageMethods().size() > 1) {
- sb.append(" - Coverage Method: " + org.eclipse.osee.framework.jdk.core.util.Collections.toString(", ",
- getSelectedCoverageMethods()));
- }
- return "Coverage Items " + sb.toString();
- }
-
- public String getNotesStr() {
- return notes;
- }
-
- public User getAssignee() {
- return assignee;
- }
-
- public Collection<CoverageOption> getSelectedCoverageMethods() {
- return coverageMethods;
- }
-
- public Result isParameterSelectionValid() throws OseeCoreException {
- try {
- return Result.TrueResult;
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- return new Result("Exception: " + ex.getLocalizedMessage());
- }
- }
-
- public CoveragePackageBase getCoveragePackageBase() {
- return coveragePackageBase;
- }
-
- public Collection<CoverageOption> getCoverageMethods() {
- return coverageMethods;
- }
-
- public void setCoverageMethods(Collection<CoverageOption> coverageMethods) {
- if (coverageMethods == null) {
- this.coverageMethods.clear();
- }
- this.coverageMethods.clear();
- this.coverageMethods.addAll(coverageMethods);
- updateShowAll();
- }
-
- public String getNotes() {
- return notes;
- }
-
- public void setNotes(String notes) {
- this.notes = notes;
- updateShowAll();
- }
-
- public void clearAll() {
- setAssignee(null);
- setNotes(null);
- setNamespace(null);
- setRationale(null);
- setName(null);
- this.coverageMethods.clear();
- }
-
- private void updateShowAll() {
- this.showAll =
- getSelectedCoverageMethods().isEmpty() && getAssignee() == null && !Strings.isValid(getNotesStr()) && !Strings.isValid(getNamespace()) && !Strings.isValid(getRationale()) && !Strings.isValid(getName());
- }
-
- public boolean isShowAll() {
- return this.showAll;
- }
-
- public void setAssignee(User assignee) {
- this.assignee = assignee;
- updateShowAll();
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- updateShowAll();
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- updateShowAll();
- }
-
- public String getRationale() {
- return rationale;
- }
-
- public void setRationale(String rationale) {
- this.rationale = rationale;
- updateShowAll();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.coverage.editor.params;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.osee.coverage.internal.Activator;
+import org.eclipse.osee.coverage.model.CoverageItem;
+import org.eclipse.osee.coverage.model.CoverageOption;
+import org.eclipse.osee.coverage.model.CoveragePackageBase;
+import org.eclipse.osee.coverage.model.CoverageUnit;
+import org.eclipse.osee.coverage.model.ICoverage;
+import org.eclipse.osee.coverage.store.OseeCoverageUnitStore;
+import org.eclipse.osee.coverage.util.CoverageUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageParameters {
+
+ private final CoveragePackageBase coveragePackageBase;
+ private List<CoverageOption> coverageMethods = new ArrayList<CoverageOption>();
+ private String name;
+ private String namespace;
+ private String rationale;
+ private String notes;
+ private User assignee;
+ private boolean showAll = true;
+
+ public CoverageParameters(CoveragePackageBase coveragePackageBase) {
+ this.coveragePackageBase = coveragePackageBase;
+ }
+
+ /**
+ * Returns a collection of ICoverage items that matched and a collection of all top level ICoverage parents
+ */
+ public Pair<Set<ICoverage>, Set<ICoverage>> performSearchGetResults() throws OseeCoreException {
+ Set<ICoverage> items = new HashSet<ICoverage>();
+ for (ICoverage coverageItem : coveragePackageBase.getChildren(false)) {
+ performSearchGetResults(items, coverageItem);
+ }
+ Set<ICoverage> parents = new HashSet<ICoverage>();
+ for (ICoverage coverage : items) {
+ parents.add(CoverageUtil.getTopLevelCoverageUnit(coverage));
+ }
+ return new Pair<Set<ICoverage>, Set<ICoverage>>(items, parents);
+ }
+
+ // CoverageUnit - name, namespace, assignees, notes
+ // CoverageItem - name, namespace, rationale, coverageMethod
+ public void performSearchGetResults(Set<ICoverage> matchItems, ICoverage coverage) throws OseeCoreException {
+ if (coverage instanceof CoverageItem) {
+ if (isCoverageMethodMatch(coverage) &&
+ //
+ isRationaleMatch(coverage) &&
+ //
+ isNameMatch(coverage) &&
+ //
+ isNamespaceMatch(coverage)) {
+ // CoverageItem matches search criteria; validate CoverageUnits up the hierarchy
+ if (doesParentMatchCriteria(coverage.getParent())) {
+ matchItems.add(coverage);
+ }
+ }
+ } else if (coverage instanceof CoverageUnit) {
+ if (Strings.isValid(name) || Strings.isValid(namespace) || Strings.isValid(notes) || assignee != null) {
+ if (!((CoverageUnit) coverage).isFolder() && isNameMatch(coverage) && isNamespaceMatch(coverage) && isNotesMatch(coverage) && isAssigneeMatch(coverage)) {
+ matchItems.add(coverage);
+ // If CoverageUnit matches, include all coverage items in match
+ for (CoverageItem coverageItem : ((CoverageUnit) coverage).getCoverageItems(true)) {
+ // Don't check name cause name of coverge unit won't match name of item
+ // Checking namespace shouldn't matter cause children will have namespace of parent
+ if (isCoverageMethodMatch(coverageItem) &&
+ //
+ isRationaleMatch(coverageItem) &&
+ //
+ isNamespaceMatch(coverageItem)) {
+ matchItems.add(coverageItem);
+ }
+ }
+ }
+ }
+ }
+ for (ICoverage child : coverage.getChildren()) {
+ performSearchGetResults(matchItems, child);
+ }
+ }
+
+ /**
+ * Recurse up parent tree to ensure all parents match criteria
+ */
+ private boolean doesParentMatchCriteria(ICoverage coverage) throws OseeCoreException {
+ if ((isNameMatch(coverage) || isNamespaceMatch(coverage)) && isNotesMatch(coverage) && isAssigneeMatch(coverage)) {
+ return true;
+ } else if (coverage.getParent() instanceof CoverageUnit) {
+ return doesParentMatchCriteria(coverage.getParent());
+ }
+ return false;
+ }
+
+ /**
+ * Match if no assignee specified OR<br>
+ * coverage isn't CoverageUnit OR<br>
+ * CoverageUnit assignee equals search assignee
+ *
+ * @throws OseeCoreException
+ */
+ public boolean isAssigneeMatch(ICoverage coverage) throws OseeCoreException {
+ if (assignee == null || !(coverage instanceof CoverageUnit)) return true;
+ if (OseeCoverageUnitStore.getAssignees((CoverageUnit) coverage).contains(assignee)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Match if no notes specified OR<br>
+ * coverage isn't CoverageUnit OR<br>
+ * CoverageUnit notes contains search string
+ */
+ public boolean isNotesMatch(ICoverage coverage) {
+ if (!Strings.isValid(notes) || !(coverage instanceof CoverageUnit)) return true;
+ if (!Strings.isValid(((CoverageUnit) coverage).getNotes())) return false;
+ if (((CoverageUnit) coverage).getNotes().contains(notes)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Match if no name specified OR<br>
+ * item name contains search string
+ */
+ public boolean isNameMatch(ICoverage coverage) {
+ if (!Strings.isValid(name)) return true;
+ if (!Strings.isValid(coverage.getName())) return false;
+ if (coverage.getName().contains(name)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Match if no namespace specified OR<br>
+ * item namespace contains search string
+ */
+ public boolean isNamespaceMatch(ICoverage coverage) {
+ if (!Strings.isValid(namespace)) return true;
+ if (!Strings.isValid(coverage.getNamespace())) return false;
+ if (coverage.getNamespace().contains(namespace)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Match if no rationale specified OR<br>
+ * coverage isn't CoverageItem OR<br>
+ * CoverageItem rationale contains search string
+ */
+ public boolean isRationaleMatch(ICoverage coverage) {
+ if (!Strings.isValid(rationale) || !(coverage instanceof CoverageItem)) return true;
+ if (!Strings.isValid(((CoverageItem) coverage).getRationale())) return false;
+ if (((CoverageItem) coverage).getRationale().contains(rationale)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Match if no coverageMethods specified OR<br>
+ * coverage isn't CoverageItem OR<br>
+ * CoverageItem is method specified
+ */
+ public boolean isCoverageMethodMatch(ICoverage coverage) {
+ if (coverageMethods.isEmpty() || !(coverage instanceof CoverageItem)) return true;
+ if (coverageMethods.contains(((CoverageItem) coverage).getCoverageMethod())) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getSelectedName(/*SearchType searchType*/) throws OseeCoreException {
+ StringBuffer sb = new StringBuffer();
+ if (getAssignee() != null) {
+ sb.append(" - Assignee: " + getAssignee());
+ }
+ if (Strings.isValid(getName())) {
+ sb.append(" - Name: " + getName());
+ }
+ if (Strings.isValid(getNamespace())) {
+ sb.append(" - Namespace: " + getNamespace());
+ }
+ if (Strings.isValid(getRationale())) {
+ sb.append(" - Rationale: " + getRationale());
+ }
+ if (Strings.isValid(getNotes())) {
+ sb.append(" - Notes: " + getNotes());
+ }
+ if (getSelectedCoverageMethods().size() > 1) {
+ sb.append(" - Coverage Method: " + org.eclipse.osee.framework.jdk.core.util.Collections.toString(", ",
+ getSelectedCoverageMethods()));
+ }
+ return "Coverage Items " + sb.toString();
+ }
+
+ public String getNotesStr() {
+ return notes;
+ }
+
+ public User getAssignee() {
+ return assignee;
+ }
+
+ public Collection<CoverageOption> getSelectedCoverageMethods() {
+ return coverageMethods;
+ }
+
+ public Result isParameterSelectionValid() throws OseeCoreException {
+ try {
+ return Result.TrueResult;
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Result("Exception: " + ex.getLocalizedMessage());
+ }
+ }
+
+ public CoveragePackageBase getCoveragePackageBase() {
+ return coveragePackageBase;
+ }
+
+ public Collection<CoverageOption> getCoverageMethods() {
+ return coverageMethods;
+ }
+
+ public void setCoverageMethods(Collection<CoverageOption> coverageMethods) {
+ if (coverageMethods == null) {
+ this.coverageMethods.clear();
+ }
+ this.coverageMethods.clear();
+ this.coverageMethods.addAll(coverageMethods);
+ updateShowAll();
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ updateShowAll();
+ }
+
+ public void clearAll() {
+ setAssignee(null);
+ setNotes(null);
+ setNamespace(null);
+ setRationale(null);
+ setName(null);
+ this.coverageMethods.clear();
+ }
+
+ private void updateShowAll() {
+ this.showAll =
+ getSelectedCoverageMethods().isEmpty() && getAssignee() == null && !Strings.isValid(getNotesStr()) && !Strings.isValid(getNamespace()) && !Strings.isValid(getRationale()) && !Strings.isValid(getName());
+ }
+
+ public boolean isShowAll() {
+ return this.showAll;
+ }
+
+ public void setAssignee(User assignee) {
+ this.assignee = assignee;
+ updateShowAll();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ updateShowAll();
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ updateShowAll();
+ }
+
+ public String getRationale() {
+ return rationale;
+ }
+
+ public void setRationale(String rationale) {
+ this.rationale = rationale;
+ updateShowAll();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java
index 52f4111d56..de7f7323c2 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java
@@ -1,281 +1,281 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.coverage.editor.params;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.logging.Level;
-import org.eclipse.osee.coverage.editor.CoverageEditor;
-import org.eclipse.osee.coverage.model.CoverageOption;
-import org.eclipse.osee.coverage.util.widget.XHyperlabelCoverageMethodSelection;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
-import org.eclipse.osee.framework.ui.skynet.widgets.XMembersCombo;
-import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
-import org.eclipse.osee.framework.ui.skynet.widgets.XText;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DefaultXWidgetOptionResolver;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPage;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageParametersComposite extends Composite {
-
- private WorkPage page;
- private final CoverageParameters coverageParameters;
-
- public CoverageParametersComposite(Composite mainComp, IManagedForm managedForm, CoverageEditor coverageEditor, final CoverageParameters coverageParameters, final SelectionListener selectionListener) {
- super(mainComp, SWT.None);
- this.coverageParameters = coverageParameters;
- setLayout(new GridLayout(2, false));
- coverageEditor.getToolkit().adapt(this);
- setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
-
- Composite buttonComp = new Composite(this, SWT.NONE);
- buttonComp.setLayout(new GridLayout(1, false));
- buttonComp.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
- coverageEditor.getToolkit().adapt(buttonComp);
-
- Button runButton = new Button(buttonComp, SWT.PUSH);
- runButton.setText("Search");
- runButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- runButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- selectionListener.widgetSelected(e);
- }
- });
- coverageEditor.getToolkit().adapt(runButton, true, true);
-
- Button clearButton = new Button(buttonComp, SWT.PUSH);
- clearButton.setText("Clear");
- clearButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- clearButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- getAssigeeCombo().clear();
- getNotesXText().set("");
- getNameXText().set("");
- getNamespaceXText().set("");
- getRationaleXText().set("");
- getCoverageMethodHyperlinkSelection().clear();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- coverageEditor.getToolkit().adapt(clearButton, true, true);
-
- Composite paramComp = new Composite(this, SWT.NONE);
- paramComp.setLayout(ALayout.getZeroMarginLayout(1, false));
- paramComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
- coverageEditor.getToolkit().adapt(paramComp);
-
- try {
- page = new WorkPage(getWidgetXml(), new DefaultXWidgetOptionResolver());
- page.createBody(managedForm, paramComp, null, null, true);
-
- getAssigeeCombo().addXModifiedListener(new XModifiedListener() {
-
- @Override
- public void widgetModified(XWidget widget) {
- try {
- coverageParameters.setAssignee(getAssignee());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- getNotesXText().addXModifiedListener(new XModifiedListener() {
-
- @Override
- public void widgetModified(XWidget widget) {
- try {
- coverageParameters.setNotes(getNotesStr());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- getNameXText().addXModifiedListener(new XModifiedListener() {
-
- @Override
- public void widgetModified(XWidget widget) {
- try {
- coverageParameters.setName(getNameXText().get());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- getNamespaceXText().addXModifiedListener(new XModifiedListener() {
-
- @Override
- public void widgetModified(XWidget widget) {
- try {
- coverageParameters.setNamespace(getNamespaceStr());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- getRationaleXText().addXModifiedListener(new XModifiedListener() {
-
- @Override
- public void widgetModified(XWidget widget) {
- try {
- coverageParameters.setRationale(getRationaleStr());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- getCoverageMethodHyperlinkSelection().setCoverageOptionManager(
- coverageEditor.getCoveragePackageBase().getCoverageOptionManager());
- getCoverageMethodHyperlinkSelection().addXModifiedListener(new XModifiedListener() {
-
- @Override
- public void widgetModified(XWidget widget) {
- try {
- coverageParameters.setCoverageMethods(getCoverageMethodHyperlinkSelection().getSelectedCoverageMethods());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public boolean isShowAll() throws OseeArgumentException {
- if (getShowAllCheckbox() == null) {
- return false;
- }
- return getShowAllCheckbox().isSelected();
- }
-
- public String getNotesStr() throws OseeArgumentException {
- if (getNotesXText() != null) {
- return getNotesXText().get();
- }
- return "";
- }
-
- public String getNameStr() throws OseeArgumentException {
- if (getNameXText() != null) {
- return getNameXText().get();
- }
- return "";
- }
-
- public String getNamespaceStr() throws OseeArgumentException {
- if (getNamespaceXText() != null) {
- return getNamespaceXText().get();
- }
- return "";
- }
-
- public String getRationaleStr() throws OseeArgumentException {
- if (getRationaleXText() != null) {
- return getRationaleXText().get();
- }
- return "";
- }
-
- public XMembersCombo getAssigeeCombo() throws OseeArgumentException {
- return (XMembersCombo) getXWidget("Coverage Unit Assignee");
- }
-
- public XText getNotesXText() throws OseeArgumentException {
- return (XText) getXWidget("Coverage Unit Notes");
- }
-
- public XText getNameXText() throws OseeArgumentException {
- return (XText) getXWidget("Name");
- }
-
- public XText getNamespaceXText() throws OseeArgumentException {
- return (XText) getXWidget("Namespace");
- }
-
- public XText getRationaleXText() throws OseeArgumentException {
- return (XText) getXWidget("Rationale");
- }
-
- public XCheckBox getShowAllCheckbox() throws OseeArgumentException {
- return (XCheckBox) getXWidget("Show All");
- }
-
- public User getAssignee() throws OseeArgumentException {
- if (getAssigeeCombo() == null) {
- return null;
- }
- return getAssigeeCombo().getUser();
- }
-
- public Collection<CoverageOption> getSelectedCoverageMethods() throws OseeArgumentException {
- if (getCoverageMethodHyperlinkSelection() == null) {
- return Collections.emptyList();
- }
- return getCoverageMethodHyperlinkSelection().getSelectedCoverageMethods();
- }
-
- public XWidget getXWidget(String attrName) throws OseeArgumentException {
- if (page == null) {
- throw new OseeArgumentException("WorkPage == null");
- }
- if (page.getLayoutData(attrName) == null) {
- return null;
- }
- return page.getLayoutData(attrName).getXWidget();
- }
-
- public XHyperlabelCoverageMethodSelection getCoverageMethodHyperlinkSelection() throws OseeArgumentException {
- return (XHyperlabelCoverageMethodSelection) getXWidget("Coverage Method");
- }
-
- public String getWidgetXml() {
- StringBuffer sb = new StringBuffer("<xWidgets>");
- sb.append("<XWidget xwidgetType=\"XHyperlabelCoverageMethodSelection\" displayName=\"Coverage Method\" horizontalLabel=\"true\"/>");
- //
- sb.append("<XWidget xwidgetType=\"XText\" beginComposite=\"6\" displayName=\"Name\" horizontalLabel=\"true\"/>");
- //
- sb.append("<XWidget xwidgetType=\"XText\" displayName=\"Namespace\" horizontalLabel=\"true\"/>");
- //
- sb.append("<XWidget xwidgetType=\"XText\" displayName=\"Rationale\" horizontalLabel=\"true\"/>");
- //
- //
- if (coverageParameters.getCoveragePackageBase().isAssignable()) {
- sb.append("<XWidget xwidgetType=\"XMembersCombo\" beginComposite=\"6\" displayName=\"Coverage Unit Assignee\" horizontalLabel=\"true\"/>");
- }
- //
- sb.append("<XWidget xwidgetType=\"XText\" displayName=\"Coverage Unit Notes\" horizontalLabel=\"true\"/>");
- sb.append("</xWidgets>");
- return sb.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.coverage.editor.params;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.logging.Level;
+import org.eclipse.osee.coverage.editor.CoverageEditor;
+import org.eclipse.osee.coverage.model.CoverageOption;
+import org.eclipse.osee.coverage.util.widget.XHyperlabelCoverageMethodSelection;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
+import org.eclipse.osee.framework.ui.skynet.widgets.XMembersCombo;
+import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.XText;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DefaultXWidgetOptionResolver;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPage;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.IManagedForm;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageParametersComposite extends Composite {
+
+ private WorkPage page;
+ private final CoverageParameters coverageParameters;
+
+ public CoverageParametersComposite(Composite mainComp, IManagedForm managedForm, CoverageEditor coverageEditor, final CoverageParameters coverageParameters, final SelectionListener selectionListener) {
+ super(mainComp, SWT.None);
+ this.coverageParameters = coverageParameters;
+ setLayout(new GridLayout(2, false));
+ coverageEditor.getToolkit().adapt(this);
+ setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ Composite buttonComp = new Composite(this, SWT.NONE);
+ buttonComp.setLayout(new GridLayout(1, false));
+ buttonComp.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
+ coverageEditor.getToolkit().adapt(buttonComp);
+
+ Button runButton = new Button(buttonComp, SWT.PUSH);
+ runButton.setText("Search");
+ runButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ runButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ selectionListener.widgetSelected(e);
+ }
+ });
+ coverageEditor.getToolkit().adapt(runButton, true, true);
+
+ Button clearButton = new Button(buttonComp, SWT.PUSH);
+ clearButton.setText("Clear");
+ clearButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ clearButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ getAssigeeCombo().clear();
+ getNotesXText().set("");
+ getNameXText().set("");
+ getNamespaceXText().set("");
+ getRationaleXText().set("");
+ getCoverageMethodHyperlinkSelection().clear();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ coverageEditor.getToolkit().adapt(clearButton, true, true);
+
+ Composite paramComp = new Composite(this, SWT.NONE);
+ paramComp.setLayout(ALayout.getZeroMarginLayout(1, false));
+ paramComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ coverageEditor.getToolkit().adapt(paramComp);
+
+ try {
+ page = new WorkPage(getWidgetXml(), new DefaultXWidgetOptionResolver());
+ page.createBody(managedForm, paramComp, null, null, true);
+
+ getAssigeeCombo().addXModifiedListener(new XModifiedListener() {
+
+ @Override
+ public void widgetModified(XWidget widget) {
+ try {
+ coverageParameters.setAssignee(getAssignee());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ getNotesXText().addXModifiedListener(new XModifiedListener() {
+
+ @Override
+ public void widgetModified(XWidget widget) {
+ try {
+ coverageParameters.setNotes(getNotesStr());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ getNameXText().addXModifiedListener(new XModifiedListener() {
+
+ @Override
+ public void widgetModified(XWidget widget) {
+ try {
+ coverageParameters.setName(getNameXText().get());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ getNamespaceXText().addXModifiedListener(new XModifiedListener() {
+
+ @Override
+ public void widgetModified(XWidget widget) {
+ try {
+ coverageParameters.setNamespace(getNamespaceStr());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ getRationaleXText().addXModifiedListener(new XModifiedListener() {
+
+ @Override
+ public void widgetModified(XWidget widget) {
+ try {
+ coverageParameters.setRationale(getRationaleStr());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ getCoverageMethodHyperlinkSelection().setCoverageOptionManager(
+ coverageEditor.getCoveragePackageBase().getCoverageOptionManager());
+ getCoverageMethodHyperlinkSelection().addXModifiedListener(new XModifiedListener() {
+
+ @Override
+ public void widgetModified(XWidget widget) {
+ try {
+ coverageParameters.setCoverageMethods(getCoverageMethodHyperlinkSelection().getSelectedCoverageMethods());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public boolean isShowAll() throws OseeArgumentException {
+ if (getShowAllCheckbox() == null) {
+ return false;
+ }
+ return getShowAllCheckbox().isSelected();
+ }
+
+ public String getNotesStr() throws OseeArgumentException {
+ if (getNotesXText() != null) {
+ return getNotesXText().get();
+ }
+ return "";
+ }
+
+ public String getNameStr() throws OseeArgumentException {
+ if (getNameXText() != null) {
+ return getNameXText().get();
+ }
+ return "";
+ }
+
+ public String getNamespaceStr() throws OseeArgumentException {
+ if (getNamespaceXText() != null) {
+ return getNamespaceXText().get();
+ }
+ return "";
+ }
+
+ public String getRationaleStr() throws OseeArgumentException {
+ if (getRationaleXText() != null) {
+ return getRationaleXText().get();
+ }
+ return "";
+ }
+
+ public XMembersCombo getAssigeeCombo() throws OseeArgumentException {
+ return (XMembersCombo) getXWidget("Coverage Unit Assignee");
+ }
+
+ public XText getNotesXText() throws OseeArgumentException {
+ return (XText) getXWidget("Coverage Unit Notes");
+ }
+
+ public XText getNameXText() throws OseeArgumentException {
+ return (XText) getXWidget("Name");
+ }
+
+ public XText getNamespaceXText() throws OseeArgumentException {
+ return (XText) getXWidget("Namespace");
+ }
+
+ public XText getRationaleXText() throws OseeArgumentException {
+ return (XText) getXWidget("Rationale");
+ }
+
+ public XCheckBox getShowAllCheckbox() throws OseeArgumentException {
+ return (XCheckBox) getXWidget("Show All");
+ }
+
+ public User getAssignee() throws OseeArgumentException {
+ if (getAssigeeCombo() == null) {
+ return null;
+ }
+ return getAssigeeCombo().getUser();
+ }
+
+ public Collection<CoverageOption> getSelectedCoverageMethods() throws OseeArgumentException {
+ if (getCoverageMethodHyperlinkSelection() == null) {
+ return Collections.emptyList();
+ }
+ return getCoverageMethodHyperlinkSelection().getSelectedCoverageMethods();
+ }
+
+ public XWidget getXWidget(String attrName) throws OseeArgumentException {
+ if (page == null) {
+ throw new OseeArgumentException("WorkPage == null");
+ }
+ if (page.getLayoutData(attrName) == null) {
+ return null;
+ }
+ return page.getLayoutData(attrName).getXWidget();
+ }
+
+ public XHyperlabelCoverageMethodSelection getCoverageMethodHyperlinkSelection() throws OseeArgumentException {
+ return (XHyperlabelCoverageMethodSelection) getXWidget("Coverage Method");
+ }
+
+ public String getWidgetXml() {
+ StringBuffer sb = new StringBuffer("<xWidgets>");
+ sb.append("<XWidget xwidgetType=\"XHyperlabelCoverageMethodSelection\" displayName=\"Coverage Method\" horizontalLabel=\"true\"/>");
+ //
+ sb.append("<XWidget xwidgetType=\"XText\" beginComposite=\"6\" displayName=\"Name\" horizontalLabel=\"true\"/>");
+ //
+ sb.append("<XWidget xwidgetType=\"XText\" displayName=\"Namespace\" horizontalLabel=\"true\"/>");
+ //
+ sb.append("<XWidget xwidgetType=\"XText\" displayName=\"Rationale\" horizontalLabel=\"true\"/>");
+ //
+ //
+ if (coverageParameters.getCoveragePackageBase().isAssignable()) {
+ sb.append("<XWidget xwidgetType=\"XMembersCombo\" beginComposite=\"6\" displayName=\"Coverage Unit Assignee\" horizontalLabel=\"true\"/>");
+ }
+ //
+ sb.append("<XWidget xwidgetType=\"XText\" displayName=\"Coverage Unit Notes\" horizontalLabel=\"true\"/>");
+ sb.append("</xWidgets>");
+ return sb.toString();
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageXViewerFactory.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageXViewerFactory.java
index bab7c4cd50..9fe30a5a71 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageXViewerFactory.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageXViewerFactory.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.editor.xcover;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageXViewerFactory extends SkynetXViewerFactory {
-
- private static String NAMESPACE = "osee.ats.Coverage";
-
- public static XViewerColumn Name =
- new XViewerColumn(NAMESPACE + ".name", "Name", 180, SWT.LEFT, true, SortDataType.String, false, "");
- public static XViewerColumn Namespace =
- new XViewerColumn(NAMESPACE + ".namespace", "Namespace", 80, SWT.LEFT, true, SortDataType.String, false, "");
- public static XViewerColumn Coverage_Percent =
- new XViewerColumn(NAMESPACE + ".percentCoverage", "Percent Coverage", 80, SWT.LEFT, true,
- SortDataType.Integer, false, "");
- public static XViewerColumn Method_Number =
- new XViewerColumn(NAMESPACE + ".methodNumber", "Method Number", 25, SWT.LEFT, true, SortDataType.Integer,
- false, "");
- public static XViewerColumn Execution_Number =
- new XViewerColumn(NAMESPACE + ".executionNumber", "Execution Line Number", 25, SWT.LEFT, true,
- SortDataType.Integer, false, "");
- public static XViewerColumn Line_Number =
- new XViewerColumn(NAMESPACE + ".lineNumber", "File Line Number", 80, SWT.LEFT, true, SortDataType.String,
- false, "");
- public static XViewerColumn Coverage_Method =
- new XViewerColumn(NAMESPACE + ".coverateMethod", "Coverage Method", 100, SWT.LEFT, true, SortDataType.String,
- false, "");
- public static XViewerColumn Coverage_Rationale =
- new XViewerColumn(NAMESPACE + ".coverageRationale", "Coverage Rationale", 100, SWT.LEFT, true,
- SortDataType.String, false, "");
- public static XViewerColumn Coverage_Test_Units =
- new XViewerColumn(NAMESPACE + ".coverageTestUnits", "Coverage Test Units", 80, SWT.LEFT, true,
- SortDataType.String, false, "");
- public static XViewerColumn Assignees_Col =
- new XViewerColumn(NAMESPACE + ".assignees", "Assignees", 100, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Notes_Col =
- new XViewerColumn(NAMESPACE + ".notes", "Notes", 100, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Location =
- new XViewerColumn(NAMESPACE + ".location", "Location", 80, SWT.LEFT, true, SortDataType.String, false, "");
- public static XViewerColumn Parent_Coverage_Unit =
- new XViewerColumn(NAMESPACE + ".parentCoverageUnit", "Parent Coverage Unit", 80, SWT.LEFT, true,
- SortDataType.String, false, "");
- public static XViewerColumn Full_Path =
- new XViewerColumn(NAMESPACE + ".fullPath", "Full Path", 80, SWT.LEFT, false, SortDataType.String, false, "");
- public static XViewerColumn Guid =
- new XViewerColumn(NAMESPACE + ".guid", "Guid", 80, SWT.LEFT, true, SortDataType.String, false, "");
-
- public CoverageXViewerFactory() {
- super(NAMESPACE);
- registerColumns();
- }
-
- public void registerColumns() {
- registerColumns(Name, Method_Number, Execution_Number, Namespace, Coverage_Percent, Coverage_Method,
- Coverage_Rationale, Coverage_Test_Units, Assignees_Col, Notes_Col, Parent_Coverage_Unit, Line_Number,
- Location, Full_Path, Guid);
- }
-
- @Override
- public boolean isCellGradientOn() {
- return true;
- }
-
- @Override
- public boolean isFilterUiAvailable() {
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.editor.xcover;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageXViewerFactory extends SkynetXViewerFactory {
+
+ private static String NAMESPACE = "osee.ats.Coverage";
+
+ public static XViewerColumn Name =
+ new XViewerColumn(NAMESPACE + ".name", "Name", 180, SWT.LEFT, true, SortDataType.String, false, "");
+ public static XViewerColumn Namespace =
+ new XViewerColumn(NAMESPACE + ".namespace", "Namespace", 80, SWT.LEFT, true, SortDataType.String, false, "");
+ public static XViewerColumn Coverage_Percent =
+ new XViewerColumn(NAMESPACE + ".percentCoverage", "Percent Coverage", 80, SWT.LEFT, true,
+ SortDataType.Integer, false, "");
+ public static XViewerColumn Method_Number =
+ new XViewerColumn(NAMESPACE + ".methodNumber", "Method Number", 25, SWT.LEFT, true, SortDataType.Integer,
+ false, "");
+ public static XViewerColumn Execution_Number =
+ new XViewerColumn(NAMESPACE + ".executionNumber", "Execution Line Number", 25, SWT.LEFT, true,
+ SortDataType.Integer, false, "");
+ public static XViewerColumn Line_Number =
+ new XViewerColumn(NAMESPACE + ".lineNumber", "File Line Number", 80, SWT.LEFT, true, SortDataType.String,
+ false, "");
+ public static XViewerColumn Coverage_Method =
+ new XViewerColumn(NAMESPACE + ".coverateMethod", "Coverage Method", 100, SWT.LEFT, true, SortDataType.String,
+ false, "");
+ public static XViewerColumn Coverage_Rationale =
+ new XViewerColumn(NAMESPACE + ".coverageRationale", "Coverage Rationale", 100, SWT.LEFT, true,
+ SortDataType.String, false, "");
+ public static XViewerColumn Coverage_Test_Units =
+ new XViewerColumn(NAMESPACE + ".coverageTestUnits", "Coverage Test Units", 80, SWT.LEFT, true,
+ SortDataType.String, false, "");
+ public static XViewerColumn Assignees_Col =
+ new XViewerColumn(NAMESPACE + ".assignees", "Assignees", 100, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Notes_Col =
+ new XViewerColumn(NAMESPACE + ".notes", "Notes", 100, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Location =
+ new XViewerColumn(NAMESPACE + ".location", "Location", 80, SWT.LEFT, true, SortDataType.String, false, "");
+ public static XViewerColumn Parent_Coverage_Unit =
+ new XViewerColumn(NAMESPACE + ".parentCoverageUnit", "Parent Coverage Unit", 80, SWT.LEFT, true,
+ SortDataType.String, false, "");
+ public static XViewerColumn Full_Path =
+ new XViewerColumn(NAMESPACE + ".fullPath", "Full Path", 80, SWT.LEFT, false, SortDataType.String, false, "");
+ public static XViewerColumn Guid =
+ new XViewerColumn(NAMESPACE + ".guid", "Guid", 80, SWT.LEFT, true, SortDataType.String, false, "");
+
+ public CoverageXViewerFactory() {
+ super(NAMESPACE);
+ registerColumns();
+ }
+
+ public void registerColumns() {
+ registerColumns(Name, Method_Number, Execution_Number, Namespace, Coverage_Percent, Coverage_Method,
+ Coverage_Rationale, Coverage_Test_Units, Assignees_Col, Notes_Col, Parent_Coverage_Unit, Line_Number,
+ Location, Full_Path, Guid);
+ }
+
+ @Override
+ public boolean isCellGradientOn() {
+ return true;
+ }
+
+ @Override
+ public boolean isFilterUiAvailable() {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewer.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewer.java
index 2b26113f02..1a7e62ae5c 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewer.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewer.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.editor.xmerge;
-
+package org.eclipse.osee.coverage.editor.xmerge;
+
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jface.action.Action;
@@ -29,91 +29,91 @@ import org.eclipse.osee.framework.ui.skynet.results.XResultData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageMergeXViewer extends CoverageXViewer {
-
- // public Map<ICoverage, Boolean> importChecked = new HashMap<ICoverage, Boolean>();
- public Map<ICoverage, XResultData> importError = new HashMap<ICoverage, XResultData>();
- Action toggleImport;
- private final MergeManager mergeManager;
- public static enum ImportType {
- Add, Replace, Folder, Error, None
- };
-
- public CoverageMergeXViewer(MergeManager mergeManager, Composite parent, int style, IXViewerFactory xViewerFactory, XCoverageMergeViewer xCoverageMergeViewer) {
- super(parent, style, xViewerFactory, xCoverageMergeViewer);
- this.mergeManager = mergeManager;
- }
-
- @Override
- public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
- XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
- if (xCol.equals(CoverageMergeXViewerFactoryImport.Import)) {
- try {
- if (treeItem.getData() instanceof IMergeItem && ((IMergeItem) treeItem.getData()).isCheckable()) {
- ((IMergeItem) treeItem.getData()).setChecked(!((IMergeItem) treeItem.getData()).isChecked());
- xCoverageViewer.getXViewer().update(treeItem.getData());
- }
- return true;
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return super.handleLeftClickInIconArea(treeColumn, treeItem);
- }
-
- @Override
- public boolean handleLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
- // XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
- return super.handleLeftClick(treeColumn, treeItem);
- }
-
- @Override
- public void updateEditMenuActions() {
- MenuManager mm = getMenuManager();
- if (xCoverageViewer.isType(TableType.Merge) && xCoverageViewer.isType(TableType.Import)) {
- mm.insertBefore(MENU_GROUP_PRE, toggleImport);
- toggleImport.setEnabled(isToggleImportEnabled());
- }
- super.updateEditMenuActions();
- }
-
- private boolean isToggleImportEnabled() {
- if (xCoverageViewer.getSelectedCoverageItems().isEmpty()) return false;
- for (ICoverage item : xCoverageViewer.getSelectedCoverageItems()) {
- if (item.isEditable().isFalse() || !(item instanceof IMergeItem) || !((IMergeItem) item).isImportAllowed()) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public void createMenuActions() {
- super.createMenuActions();
-
- toggleImport = new Action("Toggle Import", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- for (ICoverage coverageItem : xCoverageViewer.getSelectedCoverageItems()) {
- if (coverageItem instanceof IMergeItem && ((IMergeItem) coverageItem).isCheckable()) {
- ((IMergeItem) coverageItem).setChecked(!((IMergeItem) coverageItem).isChecked());
- xCoverageViewer.getXViewer().update(coverageItem);
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
- }
-
- public MergeManager getMergeManager() {
- return mergeManager;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageMergeXViewer extends CoverageXViewer {
+
+ // public Map<ICoverage, Boolean> importChecked = new HashMap<ICoverage, Boolean>();
+ public Map<ICoverage, XResultData> importError = new HashMap<ICoverage, XResultData>();
+ Action toggleImport;
+ private final MergeManager mergeManager;
+ public static enum ImportType {
+ Add, Replace, Folder, Error, None
+ };
+
+ public CoverageMergeXViewer(MergeManager mergeManager, Composite parent, int style, IXViewerFactory xViewerFactory, XCoverageMergeViewer xCoverageMergeViewer) {
+ super(parent, style, xViewerFactory, xCoverageMergeViewer);
+ this.mergeManager = mergeManager;
+ }
+
+ @Override
+ public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
+ XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
+ if (xCol.equals(CoverageMergeXViewerFactoryImport.Import)) {
+ try {
+ if (treeItem.getData() instanceof IMergeItem && ((IMergeItem) treeItem.getData()).isCheckable()) {
+ ((IMergeItem) treeItem.getData()).setChecked(!((IMergeItem) treeItem.getData()).isChecked());
+ xCoverageViewer.getXViewer().update(treeItem.getData());
+ }
+ return true;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return super.handleLeftClickInIconArea(treeColumn, treeItem);
+ }
+
+ @Override
+ public boolean handleLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
+ // XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
+ return super.handleLeftClick(treeColumn, treeItem);
+ }
+
+ @Override
+ public void updateEditMenuActions() {
+ MenuManager mm = getMenuManager();
+ if (xCoverageViewer.isType(TableType.Merge) && xCoverageViewer.isType(TableType.Import)) {
+ mm.insertBefore(MENU_GROUP_PRE, toggleImport);
+ toggleImport.setEnabled(isToggleImportEnabled());
+ }
+ super.updateEditMenuActions();
+ }
+
+ private boolean isToggleImportEnabled() {
+ if (xCoverageViewer.getSelectedCoverageItems().isEmpty()) return false;
+ for (ICoverage item : xCoverageViewer.getSelectedCoverageItems()) {
+ if (item.isEditable().isFalse() || !(item instanceof IMergeItem) || !((IMergeItem) item).isImportAllowed()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void createMenuActions() {
+ super.createMenuActions();
+
+ toggleImport = new Action("Toggle Import", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ for (ICoverage coverageItem : xCoverageViewer.getSelectedCoverageItems()) {
+ if (coverageItem instanceof IMergeItem && ((IMergeItem) coverageItem).isCheckable()) {
+ ((IMergeItem) coverageItem).setChecked(!((IMergeItem) coverageItem).isChecked());
+ xCoverageViewer.getXViewer().update(coverageItem);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+ }
+
+ public MergeManager getMergeManager() {
+ return mergeManager;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactory.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactory.java
index c4a3216b7e..0e110661d6 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactory.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactory.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.editor.xmerge;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.coverage.editor.xcover.CoverageXViewerFactory;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class CoverageMergeXViewerFactory extends CoverageXViewerFactory {
-
- public CoverageMergeXViewerFactory() {
- super();
- }
-
- public void registerMergeColumns() {
- registerColumns();
- for (XViewerColumn xCol : getColumns()) {
- overrideShowDefault(
- xCol.getId(),
- xCol.equals(CoverageXViewerFactory.Name) || xCol.equals(CoverageXViewerFactory.Notes_Col) || xCol.equals(CoverageXViewerFactory.Namespace) || xCol.equals(CoverageXViewerFactory.Coverage_Method));
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.editor.xmerge;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.coverage.editor.xcover.CoverageXViewerFactory;
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class CoverageMergeXViewerFactory extends CoverageXViewerFactory {
+
+ public CoverageMergeXViewerFactory() {
+ super();
+ }
+
+ public void registerMergeColumns() {
+ registerColumns();
+ for (XViewerColumn xCol : getColumns()) {
+ overrideShowDefault(
+ xCol.getId(),
+ xCol.equals(CoverageXViewerFactory.Name) || xCol.equals(CoverageXViewerFactory.Notes_Col) || xCol.equals(CoverageXViewerFactory.Namespace) || xCol.equals(CoverageXViewerFactory.Coverage_Method));
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryImport.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryImport.java
index b4aff5308c..a742886b61 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryImport.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryImport.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.editor.xmerge;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.osee.coverage.editor.xcover.CoverageXViewerFactory;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageMergeXViewerFactoryImport extends CoverageMergeXViewerFactory {
-
- protected static String NAMESPACE = "osee.ats.CoverageMergeImport";
-
- public static XViewerColumn Import =
- new XViewerColumn(NAMESPACE + ".name", "Import", 65, SWT.LEFT, true, SortDataType.Check, false, "");
-
- public CoverageMergeXViewerFactoryImport() {
- super();
- clearColumnRegistration();
- registerColumns(Name, Method_Number, Execution_Number, Import, Parent_Coverage_Unit, Namespace, Coverage_Percent,
- Coverage_Method, Line_Number, Coverage_Test_Units, Assignees_Col, Location, Full_Path, Guid);
- for (XViewerColumn xCol : getColumns()) {
- overrideShowDefault(xCol.getId(), xCol.equals(CoverageXViewerFactory.Name) ||
- //
- xCol.equals(CoverageXViewerFactory.Method_Number) ||
- //
- xCol.equals(CoverageXViewerFactory.Execution_Number) ||
- //
- xCol.equals(CoverageXViewerFactory.Parent_Coverage_Unit) ||
- //
- xCol.equals(CoverageXViewerFactory.Coverage_Percent) ||
- //
- xCol.equals(CoverageXViewerFactory.Namespace) ||
- //
- xCol.equals(Import) ||
- //
- xCol.equals(CoverageXViewerFactory.Coverage_Method));
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.editor.xmerge;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.osee.coverage.editor.xcover.CoverageXViewerFactory;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageMergeXViewerFactoryImport extends CoverageMergeXViewerFactory {
+
+ protected static String NAMESPACE = "osee.ats.CoverageMergeImport";
+
+ public static XViewerColumn Import =
+ new XViewerColumn(NAMESPACE + ".name", "Import", 65, SWT.LEFT, true, SortDataType.Check, false, "");
+
+ public CoverageMergeXViewerFactoryImport() {
+ super();
+ clearColumnRegistration();
+ registerColumns(Name, Method_Number, Execution_Number, Import, Parent_Coverage_Unit, Namespace, Coverage_Percent,
+ Coverage_Method, Line_Number, Coverage_Test_Units, Assignees_Col, Location, Full_Path, Guid);
+ for (XViewerColumn xCol : getColumns()) {
+ overrideShowDefault(xCol.getId(), xCol.equals(CoverageXViewerFactory.Name) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Method_Number) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Execution_Number) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Parent_Coverage_Unit) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Coverage_Percent) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Namespace) ||
+ //
+ xCol.equals(Import) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Coverage_Method));
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryPackage.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryPackage.java
index d680e46eea..c8b583979c 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryPackage.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/CoverageMergeXViewerFactoryPackage.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.editor.xmerge;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.coverage.editor.xcover.CoverageXViewerFactory;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageMergeXViewerFactoryPackage extends CoverageMergeXViewerFactory {
-
- protected static String NAMESPACE = "osee.ats.CoverageMergePackage";
-
- public CoverageMergeXViewerFactoryPackage() {
- super();
- clearColumnRegistration();
- registerMergeColumns();
- }
-
- @Override
- public void registerMergeColumns() {
- super.registerMergeColumns();
- for (XViewerColumn xCol : getColumns()) {
- if (xCol.equals(CoverageXViewerFactory.Coverage_Rationale) ||
- //
- xCol.equals(CoverageXViewerFactory.Method_Number) ||
- //
- xCol.equals(CoverageXViewerFactory.Execution_Number) ||
- //
- //
- xCol.equals(CoverageXViewerFactory.Coverage_Percent) ||
- //
- xCol.equals(CoverageXViewerFactory.Assignees_Col) ||
- //
- xCol.equals(CoverageXViewerFactory.Notes_Col)) {
- overrideShowDefault(xCol.getId(), true);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.editor.xmerge;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.coverage.editor.xcover.CoverageXViewerFactory;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageMergeXViewerFactoryPackage extends CoverageMergeXViewerFactory {
+
+ protected static String NAMESPACE = "osee.ats.CoverageMergePackage";
+
+ public CoverageMergeXViewerFactoryPackage() {
+ super();
+ clearColumnRegistration();
+ registerMergeColumns();
+ }
+
+ @Override
+ public void registerMergeColumns() {
+ super.registerMergeColumns();
+ for (XViewerColumn xCol : getColumns()) {
+ if (xCol.equals(CoverageXViewerFactory.Coverage_Rationale) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Method_Number) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Execution_Number) ||
+ //
+ //
+ xCol.equals(CoverageXViewerFactory.Coverage_Percent) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Assignees_Col) ||
+ //
+ xCol.equals(CoverageXViewerFactory.Notes_Col)) {
+ overrideShowDefault(xCol.getId(), true);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/XCoverageMergeViewer.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/XCoverageMergeViewer.java
index 3c40c1d984..7df65152f3 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/XCoverageMergeViewer.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xmerge/XCoverageMergeViewer.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.editor.xmerge;
-
+package org.eclipse.osee.coverage.editor.xmerge;
+
import org.eclipse.osee.coverage.editor.xcover.CoverageContentProvider;
import org.eclipse.osee.coverage.editor.xcover.XCoverageViewer;
import org.eclipse.osee.coverage.merge.MergeManager;
@@ -21,58 +21,58 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-
-/**
- * @author Donald G. Dunne
- */
-public class XCoverageMergeViewer extends XCoverageViewer implements IRefreshActionHandler {
-
- CoverageMergeXViewer mergeXViewer;
- private final CoverageMergeXViewerFactory coverageMergeXViewerFactory;
- private final MergeManager mergeManager;
-
- public XCoverageMergeViewer(MergeManager mergeManager, ISaveable saveable, CoverageMergeXViewerFactory coverageMergeXViewerFactory, CoverageOptionManager coverageOptionManager, TableType tableType, TableType... types) {
- super(saveable, coverageOptionManager, tableType, types);
- this.mergeManager = mergeManager;
- this.coverageMergeXViewerFactory = coverageMergeXViewerFactory;
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- Composite mainComp = new Composite(parent, SWT.BORDER);
- mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- if (toolkit != null) toolkit.paintBordersFor(mainComp);
-
- createTaskActionBar(mainComp);
-
- xViewer =
- new CoverageMergeXViewer(mergeManager, mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION,
- coverageMergeXViewerFactory, this);
- mergeXViewer = (CoverageMergeXViewer) xViewer;
- xViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- xViewer.setContentProvider(new CoverageContentProvider(mergeXViewer));
- xViewer.setLabelProvider(new CoverageMergeLabelProvider(mergeXViewer));
-
- if (toolkit != null) toolkit.adapt(xViewer.getStatusLabel(), false, false);
-
- // NOTE: Don't adapt the tree using xToolkit cause will loose xViewer's context menu
- updateExtraLabel();
- }
-
- @Override
- public void refreshActionHandler() {
- refresh();
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XCoverageMergeViewer extends XCoverageViewer implements IRefreshActionHandler {
+
+ CoverageMergeXViewer mergeXViewer;
+ private final CoverageMergeXViewerFactory coverageMergeXViewerFactory;
+ private final MergeManager mergeManager;
+
+ public XCoverageMergeViewer(MergeManager mergeManager, ISaveable saveable, CoverageMergeXViewerFactory coverageMergeXViewerFactory, CoverageOptionManager coverageOptionManager, TableType tableType, TableType... types) {
+ super(saveable, coverageOptionManager, tableType, types);
+ this.mergeManager = mergeManager;
+ this.coverageMergeXViewerFactory = coverageMergeXViewerFactory;
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ Composite mainComp = new Composite(parent, SWT.BORDER);
+ mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ if (toolkit != null) toolkit.paintBordersFor(mainComp);
+
+ createTaskActionBar(mainComp);
+
+ xViewer =
+ new CoverageMergeXViewer(mergeManager, mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION,
+ coverageMergeXViewerFactory, this);
+ mergeXViewer = (CoverageMergeXViewer) xViewer;
+ xViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ xViewer.setContentProvider(new CoverageContentProvider(mergeXViewer));
+ xViewer.setLabelProvider(new CoverageMergeLabelProvider(mergeXViewer));
+
+ if (toolkit != null) toolkit.adapt(xViewer.getStatusLabel(), false, false);
+
+ // NOTE: Don't adapt the tree using xToolkit cause will loose xViewer's context menu
+ updateExtraLabel();
+ }
+
+ @Override
+ public void refreshActionHandler() {
+ refresh();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageMessages.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageMessages.java
index 002187f964..198747ab19 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageMessages.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageMessages.java
@@ -8,48 +8,48 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.event;
-
+package org.eclipse.osee.coverage.event;
+
import org.eclipse.osee.framework.messaging.MessageID;
-
-public enum CoverageMessages implements MessageID {
- CoveragePackageSave(true, "Aylfa1rRxx6NQf4MfNwA", "topic:org.eclipse.osee.coverage.msgs.CoveragePackageSave", org.eclipse.osee.coverage.msgs.CoveragePackageSave.class, false);
-
- private String name;
- private Class<?> clazz;
- boolean isReplyRequired;
- private String guid;
- private boolean isTopic;
-
- CoverageMessages(boolean isTopic, String guid, String name, Class<?> clazz, boolean isReplyRequired) {
- this.guid = guid;
- this.name = name;
- this.clazz = clazz;
- this.isReplyRequired = isReplyRequired;
- this.isTopic = isTopic;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public Class<?> getSerializationClass() {
- return clazz;
- }
-
- @Override
- public boolean isReplyRequired() {
- return isReplyRequired;
- }
-
- @Override
- public String getId() {
- return guid;
- }
-
- public boolean isTopic() {
- return isTopic;
- }
-}
+
+public enum CoverageMessages implements MessageID {
+ CoveragePackageSave(true, "Aylfa1rRxx6NQf4MfNwA", "topic:org.eclipse.osee.coverage.msgs.CoveragePackageSave", org.eclipse.osee.coverage.msgs.CoveragePackageSave.class, false);
+
+ private String name;
+ private Class<?> clazz;
+ boolean isReplyRequired;
+ private String guid;
+ private boolean isTopic;
+
+ CoverageMessages(boolean isTopic, String guid, String name, Class<?> clazz, boolean isReplyRequired) {
+ this.guid = guid;
+ this.name = name;
+ this.clazz = clazz;
+ this.isReplyRequired = isReplyRequired;
+ this.isTopic = isTopic;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public Class<?> getSerializationClass() {
+ return clazz;
+ }
+
+ @Override
+ public boolean isReplyRequired() {
+ return isReplyRequired;
+ }
+
+ @Override
+ public String getId() {
+ return guid;
+ }
+
+ public boolean isTopic() {
+ return isTopic;
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/OseeMessagingTracker.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/OseeMessagingTracker.java
index d1fa484e7d..b76a683025 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/OseeMessagingTracker.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/OseeMessagingTracker.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.event;
-
+package org.eclipse.osee.coverage.event;
+
import java.util.logging.Level;
import org.eclipse.osee.coverage.internal.Activator;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -18,38 +18,38 @@ import org.eclipse.osee.framework.messaging.ConnectionNode;
import org.eclipse.osee.framework.messaging.MessageService;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author Donald G. Dunne
- */
-public class OseeMessagingTracker extends ServiceTracker {
-
- private ConnectionNode connectionNode;
-
- public OseeMessagingTracker() {
- super(Activator.getInstance().getBundle().getBundleContext(), MessageService.class.getName(), null);
- }
-
- @Override
- public Object addingService(ServiceReference reference) {
- MessageService service = (MessageService) super.addingService(reference);
- try {
- connectionNode = service.getDefault();
- CoverageEventManager.getInstance().addingRemoteEventService(connectionNode);
- } catch (OseeCoreException ex) {
- OseeLog.log(OseeMessagingTracker.class, Level.SEVERE, ex);
- }
- return service;
- }
-
- @Override
- public void removedService(ServiceReference reference, Object service) {
- super.removedService(reference, service);
- }
-
- @Override
- public MessageService getService() {
- return (MessageService) super.getService();
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class OseeMessagingTracker extends ServiceTracker {
+
+ private ConnectionNode connectionNode;
+
+ public OseeMessagingTracker() {
+ super(Activator.getInstance().getBundle().getBundleContext(), MessageService.class.getName(), null);
+ }
+
+ @Override
+ public Object addingService(ServiceReference reference) {
+ MessageService service = (MessageService) super.addingService(reference);
+ try {
+ connectionNode = service.getDefault();
+ CoverageEventManager.getInstance().addingRemoteEventService(connectionNode);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(OseeMessagingTracker.class, Level.SEVERE, ex);
+ }
+ return service;
+ }
+
+ @Override
+ public void removedService(ServiceReference reference, Object service) {
+ super.removedService(reference, service);
+ }
+
+ @Override
+ public MessageService getService() {
+ return (MessageService) super.getService();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/CoveragePerspectiveFactory.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/CoveragePerspectiveFactory.java
index 8452d86e95..5a24d6163f 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/CoveragePerspectiveFactory.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/CoveragePerspectiveFactory.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.internal;
-
-import org.eclipse.osee.coverage.navigate.CoverageNavigateView;
-import org.eclipse.osee.coverage.util.CoverageUtil;
-import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
-import org.eclipse.osee.framework.ui.skynet.search.QuickSearchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.ui.IFolderLayout;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-/**
- * Perspective factory for the Coverage perspective.
- *
- * @author Donald G. Dunne
- */
-public class CoveragePerspectiveFactory implements IPerspectiveFactory {
-
- public void createInitialLayout(IPageLayout layout) {
- final String editorArea = layout.getEditorArea();
-
- final IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.2f, editorArea);
- final IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.75f, editorArea);
-
- // Add views to Window -> Show View
- layout.addShowViewShortcut(ArtifactExplorer.VIEW_ID);
- layout.addShowViewShortcut(QuickSearchView.VIEW_ID);
- layout.addShowViewShortcut(BranchView.VIEW_ID);
- layout.addShowViewShortcut(CoverageNavigateView.VIEW_ID);
- layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView");
-
- left.addView(CoverageNavigateView.VIEW_ID);
- left.addView(ArtifactExplorer.VIEW_ID + ":*");
-
- if (CoverageUtil.isAdmin()) {
- bottom.addView("org.eclipse.pde.runtime.LogView");
- }
- bottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
-
- final IFolderLayout bottomLeft =
- layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.6f, CoverageNavigateView.VIEW_ID);
- bottomLeft.addView(QuickSearchView.VIEW_ID);
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.internal;
+
+import org.eclipse.osee.coverage.navigate.CoverageNavigateView;
+import org.eclipse.osee.coverage.util.CoverageUtil;
+import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
+import org.eclipse.osee.framework.ui.skynet.search.QuickSearchView;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+/**
+ * Perspective factory for the Coverage perspective.
+ *
+ * @author Donald G. Dunne
+ */
+public class CoveragePerspectiveFactory implements IPerspectiveFactory {
+
+ public void createInitialLayout(IPageLayout layout) {
+ final String editorArea = layout.getEditorArea();
+
+ final IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.2f, editorArea);
+ final IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.75f, editorArea);
+
+ // Add views to Window -> Show View
+ layout.addShowViewShortcut(ArtifactExplorer.VIEW_ID);
+ layout.addShowViewShortcut(QuickSearchView.VIEW_ID);
+ layout.addShowViewShortcut(BranchView.VIEW_ID);
+ layout.addShowViewShortcut(CoverageNavigateView.VIEW_ID);
+ layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView");
+
+ left.addView(CoverageNavigateView.VIEW_ID);
+ left.addView(ArtifactExplorer.VIEW_ID + ":*");
+
+ if (CoverageUtil.isAdmin()) {
+ bottom.addView("org.eclipse.pde.runtime.LogView");
+ }
+ bottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
+
+ final IFolderLayout bottomLeft =
+ layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.6f, CoverageNavigateView.VIEW_ID);
+ bottomLeft.addView(QuickSearchView.VIEW_ID);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/IMergeItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/IMergeItem.java
index 94ac9fef1c..a0de00a4f1 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/IMergeItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/IMergeItem.java
@@ -8,24 +8,24 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import org.eclipse.osee.coverage.model.ICoverage;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IMergeItem extends ICoverage {
-
- public MergeType getMergeType();
-
- public boolean isChecked();
-
- public boolean isCheckable();
-
- public void setChecked(boolean checked) throws OseeArgumentException;
-
- public boolean isImportAllowed();
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IMergeItem extends ICoverage {
+
+ public MergeType getMergeType();
+
+ public boolean isChecked();
+
+ public boolean isCheckable();
+
+ public void setChecked(boolean checked) throws OseeArgumentException;
+
+ public boolean isImportAllowed();
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchItem.java
index 6759fd00fc..a9ebbeaadd 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchItem.java
@@ -8,64 +8,64 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import java.util.Collection;
import org.eclipse.osee.coverage.model.ICoverage;
-
-/**
- * @author Donald G. Dunne
- */
-public class MatchItem {
-
- private final MatchType matchType;
- private final ICoverage packageItem;
- private final ICoverage importItem;
- public static MatchItem No_Match_Item = new MatchItem(MatchType.No_Match__Name_Or_Order_Num, null, null);
-
- public MatchItem(MatchType matchType, ICoverage packageItem, ICoverage importItem) {
- this.matchType = matchType;
- this.packageItem = packageItem;
- this.importItem = importItem;
- }
-
- public MatchType getMatchType() {
- return matchType;
- }
-
- public ICoverage getPackageItem() {
- return packageItem;
- }
-
- public ICoverage getImportItem() {
- return importItem;
- }
-
- @Override
- public String toString() {
- return "Match Type>> " + matchType.toString() + " - Import Item>>" + importItem.toString() + ") - Package Item>>(" + (packageItem != null ? packageItem.toString() : "[null])");
- }
-
- public static boolean isAllMatchType(Collection<MatchType> matchTypes, Collection<MatchItem> matchItems) {
- for (MatchItem matchItem : matchItems) {
- if (!matchTypes.contains(matchItem.getMatchType())) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isMatch() {
- if (matchType.toString().startsWith("Match__")) {
- return true;
- }
- return false;
- }
-
- public boolean isMatchType(Collection<MatchType> matchTypes) {
- if (!matchTypes.contains(matchType)) {
- return false;
- }
- return true;
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class MatchItem {
+
+ private final MatchType matchType;
+ private final ICoverage packageItem;
+ private final ICoverage importItem;
+ public static MatchItem No_Match_Item = new MatchItem(MatchType.No_Match__Name_Or_Order_Num, null, null);
+
+ public MatchItem(MatchType matchType, ICoverage packageItem, ICoverage importItem) {
+ this.matchType = matchType;
+ this.packageItem = packageItem;
+ this.importItem = importItem;
+ }
+
+ public MatchType getMatchType() {
+ return matchType;
+ }
+
+ public ICoverage getPackageItem() {
+ return packageItem;
+ }
+
+ public ICoverage getImportItem() {
+ return importItem;
+ }
+
+ @Override
+ public String toString() {
+ return "Match Type>> " + matchType.toString() + " - Import Item>>" + importItem.toString() + ") - Package Item>>(" + (packageItem != null ? packageItem.toString() : "[null])");
+ }
+
+ public static boolean isAllMatchType(Collection<MatchType> matchTypes, Collection<MatchItem> matchItems) {
+ for (MatchItem matchItem : matchItems) {
+ if (!matchTypes.contains(matchItem.getMatchType())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isMatch() {
+ if (matchType.toString().startsWith("Match__")) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isMatchType(Collection<MatchType> matchTypes) {
+ if (!matchTypes.contains(matchType)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchType.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchType.java
index 3cb9c53753..f01cf31eb2 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchType.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MatchType.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import java.util.Arrays;
import java.util.Collection;
import org.eclipse.osee.coverage.model.CoverageImport;
@@ -18,97 +18,97 @@ import org.eclipse.osee.coverage.model.CoveragePackage;
import org.eclipse.osee.coverage.model.CoverageUnit;
import org.eclipse.osee.coverage.model.ICoverage;
import org.eclipse.osee.framework.core.exception.OseeStateException;
-
-public enum MatchType {
- // Item matches in name only
- Match__Folder,
- // Item matches in name and order number
- Match__Name_And_Order_Num,
- // Items are CoveragePackageBase types
- Match__Coverage_Base,
-
- // Item has no match; __<reason>
- No_Match__Namespace,
- No_Match__Class,
- No_Match__Name_Or_Order_Num;
-
- public static Collection<MatchType> FullMatches =
- Arrays.asList(Match__Folder, Match__Coverage_Base, Match__Name_And_Order_Num);
-
- public static boolean isNoMatch(MatchType matchType) {
- return matchType.toString().startsWith("No_Match__");
- }
-
- public static boolean isMatch(MatchType matchType) {
- return FullMatches.contains(matchType);
- }
-
- public static MatchType getMatchType(ICoverage packageItem, ICoverage importItem) throws OseeStateException {
- if (packageItem instanceof CoveragePackage && importItem instanceof CoverageImport) {
- return MatchType.Match__Coverage_Base;
- }
- if (packageItem.getClass() != importItem.getClass()) return MatchType.No_Match__Class;
- if (packageItem.getNamespace() == null || importItem.getNamespace() == null) throw new OseeStateException(
- "Namespaces can't be null");
- if (!packageItem.getNamespace().equals(importItem.getNamespace())) return MatchType.No_Match__Namespace;
- if (packageItem instanceof CoverageUnit && importItem instanceof CoverageUnit) {
- if (((CoverageUnit) packageItem).isFolder() && (((CoverageUnit) importItem).isFolder()) && packageItem.getName().equals(
- importItem.getName())) {
- return MatchType.Match__Folder;
- }
- if (((CoverageUnit) packageItem).isFolder() && !(((CoverageUnit) importItem).isFolder())) {
- return MatchType.No_Match__Class;
- }
- if (!((CoverageUnit) packageItem).isFolder() && (((CoverageUnit) importItem).isFolder())) {
- return MatchType.No_Match__Class;
- }
- // If names equal and method numbers equal
- if (packageItem.getName().equals(importItem.getName()) && packageItem.getOrderNumber().equals(
- importItem.getOrderNumber())) {
- // parent's have to match also to be considered equal
- MatchType matchType = getMatchType(packageItem.getParent(), importItem.getParent());
- // if parents match, then this is a full match
- if (MatchType.isMatch(matchType)) {
- return MatchType.Match__Name_And_Order_Num;
- }
- // if parents don't match, then this is a full no-match
- else {
- return No_Match__Name_Or_Order_Num;
- }
- }
- // If neither names or methods match
- else if (!packageItem.getName().equals(importItem.getName()) && !packageItem.getOrderNumber().equals(
- importItem.getOrderNumber())) {
- return MatchType.No_Match__Name_Or_Order_Num;
- }
- } else if (packageItem instanceof CoverageItem && importItem instanceof CoverageItem) {
- // If neither names or order match
- if (!packageItem.getName().equals(importItem.getName()) && !packageItem.getOrderNumber().equals(
- importItem.getOrderNumber())) {
- return MatchType.No_Match__Name_Or_Order_Num;
- }
- // If names equal and order numbers equal
- else if (packageItem.getName().equals(importItem.getName()) && packageItem.getOrderNumber().equals(
- importItem.getOrderNumber())) {
- // parent's have to match also to be considered equal
- MatchType matchType = getMatchType(packageItem.getParent(), importItem.getParent());
- // if parents match, then this is a full match
- if (MatchType.isMatch(matchType)) {
- return MatchType.Match__Name_And_Order_Num;
- }
- }
- } else if (packageItem.getName().equals(importItem.getName())) {
- if (packageItem.getParent() instanceof CoveragePackage && importItem.getParent() instanceof CoverageImport) {
- return MatchType.Match__Name_And_Order_Num;
- } else {
- if (packageItem.getParent() == null && importItem.getParent() == null) {
- return MatchType.Match__Coverage_Base;
- }
- MatchType matchType = getMatchType(packageItem.getParent(), importItem.getParent());
- return matchType;
- }
- }
- return MatchType.No_Match__Name_Or_Order_Num;
- }
-
-};
+
+public enum MatchType {
+ // Item matches in name only
+ Match__Folder,
+ // Item matches in name and order number
+ Match__Name_And_Order_Num,
+ // Items are CoveragePackageBase types
+ Match__Coverage_Base,
+
+ // Item has no match; __<reason>
+ No_Match__Namespace,
+ No_Match__Class,
+ No_Match__Name_Or_Order_Num;
+
+ public static Collection<MatchType> FullMatches =
+ Arrays.asList(Match__Folder, Match__Coverage_Base, Match__Name_And_Order_Num);
+
+ public static boolean isNoMatch(MatchType matchType) {
+ return matchType.toString().startsWith("No_Match__");
+ }
+
+ public static boolean isMatch(MatchType matchType) {
+ return FullMatches.contains(matchType);
+ }
+
+ public static MatchType getMatchType(ICoverage packageItem, ICoverage importItem) throws OseeStateException {
+ if (packageItem instanceof CoveragePackage && importItem instanceof CoverageImport) {
+ return MatchType.Match__Coverage_Base;
+ }
+ if (packageItem.getClass() != importItem.getClass()) return MatchType.No_Match__Class;
+ if (packageItem.getNamespace() == null || importItem.getNamespace() == null) throw new OseeStateException(
+ "Namespaces can't be null");
+ if (!packageItem.getNamespace().equals(importItem.getNamespace())) return MatchType.No_Match__Namespace;
+ if (packageItem instanceof CoverageUnit && importItem instanceof CoverageUnit) {
+ if (((CoverageUnit) packageItem).isFolder() && (((CoverageUnit) importItem).isFolder()) && packageItem.getName().equals(
+ importItem.getName())) {
+ return MatchType.Match__Folder;
+ }
+ if (((CoverageUnit) packageItem).isFolder() && !(((CoverageUnit) importItem).isFolder())) {
+ return MatchType.No_Match__Class;
+ }
+ if (!((CoverageUnit) packageItem).isFolder() && (((CoverageUnit) importItem).isFolder())) {
+ return MatchType.No_Match__Class;
+ }
+ // If names equal and method numbers equal
+ if (packageItem.getName().equals(importItem.getName()) && packageItem.getOrderNumber().equals(
+ importItem.getOrderNumber())) {
+ // parent's have to match also to be considered equal
+ MatchType matchType = getMatchType(packageItem.getParent(), importItem.getParent());
+ // if parents match, then this is a full match
+ if (MatchType.isMatch(matchType)) {
+ return MatchType.Match__Name_And_Order_Num;
+ }
+ // if parents don't match, then this is a full no-match
+ else {
+ return No_Match__Name_Or_Order_Num;
+ }
+ }
+ // If neither names or methods match
+ else if (!packageItem.getName().equals(importItem.getName()) && !packageItem.getOrderNumber().equals(
+ importItem.getOrderNumber())) {
+ return MatchType.No_Match__Name_Or_Order_Num;
+ }
+ } else if (packageItem instanceof CoverageItem && importItem instanceof CoverageItem) {
+ // If neither names or order match
+ if (!packageItem.getName().equals(importItem.getName()) && !packageItem.getOrderNumber().equals(
+ importItem.getOrderNumber())) {
+ return MatchType.No_Match__Name_Or_Order_Num;
+ }
+ // If names equal and order numbers equal
+ else if (packageItem.getName().equals(importItem.getName()) && packageItem.getOrderNumber().equals(
+ importItem.getOrderNumber())) {
+ // parent's have to match also to be considered equal
+ MatchType matchType = getMatchType(packageItem.getParent(), importItem.getParent());
+ // if parents match, then this is a full match
+ if (MatchType.isMatch(matchType)) {
+ return MatchType.Match__Name_And_Order_Num;
+ }
+ }
+ } else if (packageItem.getName().equals(importItem.getName())) {
+ if (packageItem.getParent() instanceof CoveragePackage && importItem.getParent() instanceof CoverageImport) {
+ return MatchType.Match__Name_And_Order_Num;
+ } else {
+ if (packageItem.getParent() == null && importItem.getParent() == null) {
+ return MatchType.Match__Coverage_Base;
+ }
+ MatchType matchType = getMatchType(packageItem.getParent(), importItem.getParent());
+ return matchType;
+ }
+ }
+ return MatchType.No_Match__Name_Or_Order_Num;
+ }
+
+};
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeImportManager.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeImportManager.java
index ac76f7da6a..6f6d8b7d97 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeImportManager.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeImportManager.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import java.util.Collection;
import org.eclipse.osee.coverage.internal.Activator;
import org.eclipse.osee.coverage.model.CoverageImport;
@@ -28,330 +28,330 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-
-/**
- * @author Donald G. Dunne
- */
-public class MergeImportManager {
-
- private final CoveragePackage coveragePackage;
- private final MergeManager mergeManager;
-
- public MergeImportManager(MergeManager mergeManager) {
- this.mergeManager = mergeManager;
- this.coveragePackage = mergeManager.getCoveragePackage();
- }
-
- public XResultData importItems(ISaveable saveable, Collection<IMergeItem> mergeItems) throws OseeCoreException {
- XResultData rd = new XResultData(false);
- if (!validateEditable(rd, saveable)) return rd;
- if (!validateMergeTypes(rd, mergeItems)) return rd;
- if (!validateChildren(rd, mergeItems)) return rd;
-
- for (IMergeItem mergeItem : mergeItems) {
- if (mergeItem.getMergeType() == MergeType.CI_Changes) {
- if (mergeItem instanceof MergeItemGroup) {
- MergeItemGroup group = (MergeItemGroup) mergeItem;
- for (IMergeItem childMergeItem : group.getMergeItems()) {
- if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Add) {
- addCoverageItem(childMergeItem, rd);
- } else if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Renamed) {
- renameCoverageItem(childMergeItem, rd);
- } else if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Moved) {
- updateOrder(mergeItem, childMergeItem, rd);
- } else if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Delete) {
- deleteCoverageItem(mergeItem, childMergeItem, rd);
- } else if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Method_Update) {
- updateCoverageItemMethod(childMergeItem, rd);
- } else {
- rd.logError(String.format("Coverage_Item_Changes Group: Unsupported merge type [%s]",
- childMergeItem.getMergeType()));
- }
- }
- } else {
- rd.logError(String.format("Coverage_Item_Changes: Unsupported mergeItem [%s]", mergeItem));
- }
- } else if (mergeItem.getMergeType() == MergeType.Add) {
- if (mergeItem instanceof MergeItem) {
- CoverageUnit coverageUnit = (CoverageUnit) ((MergeItem) mergeItem).getImportItem();
- importCoverageUnitItem(rd, coverageUnit);
- // add all children items
- for (CoverageUnit childCoverageUnit : coverageUnit.getCoverageUnits(true)) {
- importCoverageUnitItem(rd, childCoverageUnit);
- }
- } else {
- rd.logError(String.format("Add: Unsupported mergeItem [%s]", mergeItem));
- }
- } else if (mergeItem.getMergeType() == MergeType.Add_With_Moves) {
- if (mergeItem instanceof MergeItemGroup) {
- MergeItemGroup group = (MergeItemGroup) mergeItem;
- for (IMergeItem childMergeItem : group.getMergeItems()) {
- if (childMergeItem.getMergeType() == MergeType.Add && childMergeItem instanceof MergeItem) {
- CoverageUnit coverageUnit = (CoverageUnit) ((MergeItem) childMergeItem).getImportItem();
- importCoverageUnitItem(rd, coverageUnit);
- // add all children items
- for (CoverageUnit childCoverageUnit : coverageUnit.getCoverageUnits(true)) {
- importCoverageUnitItem(rd, childCoverageUnit);
- }
- }
- // For moved items, Change order of package item to match import item
- else if (childMergeItem.getMergeType() == MergeType.Moved_Due_To_Add && childMergeItem instanceof MergeItem) {
- updateOrder(mergeItem, childMergeItem, rd);
- } else {
- rd.logError(String.format("Add_With_Moves Group: Unsupported merge type [%s]",
- childMergeItem.getMergeType()));
- }
- }
- } else {
- rd.logError(String.format("Add_With_Moves: Unsupported mergeItem [%s]", mergeItem));
- }
- } else if (mergeItem.getMergeType() == MergeType.Delete_And_Reorder) {
- if (mergeItem instanceof MergeItemGroup) {
- MergeItemGroup group = (MergeItemGroup) mergeItem;
- for (IMergeItem childMergeItem : group.getMergeItems()) {
- if (childMergeItem.getMergeType() == MergeType.Delete && childMergeItem instanceof MergeItem) {
- ICoverage packageCoverage = ((MergeItem) childMergeItem).getPackageItem();
- ICoverage parentPackageCoverage = packageCoverage.getParent();
- ((ICoverageUnitProvider) parentPackageCoverage).removeCoverageUnit((CoverageUnit) packageCoverage);
- }
- // For moved items, Change order of package item to match import item
- else if (childMergeItem.getMergeType() == MergeType.Moved_Due_To_Delete && childMergeItem instanceof MergeItem) {
- updateOrder(mergeItem, childMergeItem, rd);
- } else {
- rd.logError(String.format("Delete_And_Reorder Group: Unsupported merge type [%s]",
- childMergeItem.getMergeType()));
- }
- }
- } else {
- rd.logError(String.format("Delete_And_Reorder: Unsupported mergeItem [%s]", mergeItem));
- }
- } else {
- rd.logError(String.format("Unsupported merge type [%s]", mergeItem.getMergeType()));
- }
- }
-
- if (rd.getNumErrors() > 0) {
- if (!CoverageUtil.isInTest()) {
- AWorkbench.popup(rd.getNumErrors() + " Errors Found; Not Persisting");
- }
- rd.logError(rd.getNumErrors() + " Errors Found; Not Persisting");
- } else {
- Result result = saveable.save();
- if (result.isTrue()) {
- rd.log("\nChanges Persisted");
- } else {
- rd.logError("\n" + result.getText());
- }
- }
- return rd;
- }
-
- private void addCoverageItem(IMergeItem mergeItem, XResultData rd) throws OseeCoreException {
- CoverageItem importItem = (CoverageItem) ((MergeItem) mergeItem).getImportItem();
- MatchItem parentMatchItem = mergeManager.getPackageCoverageItem(importItem.getParent());
- ICoverage parentPackageItem = parentMatchItem == null ? null : parentMatchItem.getPackageItem();
- CoverageUnit parentPackageCoverageUnit = (CoverageUnit) parentPackageItem;
- CoverageItem packageItem = importItem.copy(parentPackageCoverageUnit);
- updateFileContents(packageItem, importItem);
- }
-
- private void deleteCoverageItem(IMergeItem mergeItem, IMergeItem childMergeItem, XResultData rd) throws OseeCoreException {
- CoverageItem packageItem = (CoverageItem) ((MergeItem) childMergeItem).getPackageItem();
- ((CoverageUnit) packageItem.getParent()).removeCoverageItem(packageItem);
- updateFileContents((CoverageUnit) packageItem.getParent(),
- (CoverageUnit) ((MergeItemGroup) mergeItem).getParent());
- }
-
- private void renameCoverageItem(IMergeItem mergeItem, XResultData rd) throws OseeCoreException {
- CoverageItem importItem = (CoverageItem) ((MergeItem) mergeItem).getImportItem();
- CoverageItem packageItem = (CoverageItem) ((MergeItem) mergeItem).getPackageItem();
- packageItem.setName(importItem.getName());
- if (Strings.isValid(packageItem.getRationale())) {
- packageItem.setRationale("");
- }
- packageItem.setCoverageMethod(importItem.getCoverageMethod());
- updateFileContents(packageItem, importItem);
- }
-
- private void updateCoverageItemMethod(IMergeItem mergeItem, XResultData rd) throws OseeCoreException {
- CoverageItem importItem = (CoverageItem) ((MergeItem) mergeItem).getImportItem();
- CoverageItem packageItem = (CoverageItem) ((MergeItem) mergeItem).getPackageItem();
- packageItem.setCoverageMethod(importItem.getCoverageMethod());
- updateFileContents(packageItem, importItem);
- }
-
- private void updateFileContents(CoverageItem packageItem, CoverageItem importItem) throws OseeCoreException {
- // Since items names changed, update parent coverage unit's file contents
- if (packageItem.getParent() != null && packageItem.getParent() instanceof CoverageUnit) {
- updateFileContents((CoverageUnit) packageItem.getParent(), (CoverageUnit) importItem.getParent());
- }
- }
-
- private void updateFileContents(CoverageUnit packageUnit, CoverageUnit importUnit) throws OseeCoreException {
- if (!packageUnit.getFileContents().equals(importUnit.getFileContents())) {
- packageUnit.setFileContents(importUnit.getFileContents());
- }
- if (packageUnit.getParent() != null && packageUnit.getParent() instanceof CoverageUnit) {
- CoverageUnit parentPackageCoverage = (CoverageUnit) packageUnit.getParent();
- CoverageUnit parentImportCoverage = (CoverageUnit) importUnit.getParent();
- if (!parentPackageCoverage.getFileContents().equals(parentImportCoverage.getFileContents())) {
- parentPackageCoverage.setFileContents(parentImportCoverage.getFileContents());
- }
- }
- }
-
- private void updateOrder(IMergeItem mergeItem, IMergeItem childMergeItem, XResultData rd) throws OseeCoreException {
- ICoverage packageCoverage = ((MergeItem) childMergeItem).getPackageItem();
- ICoverage importCoverage = ((MergeItem) childMergeItem).getImportItem();
- if (packageCoverage instanceof CoverageUnit) {
- ((CoverageUnit) packageCoverage).setOrderNumber(((CoverageUnit) importCoverage).getOrderNumber());
- } else if (packageCoverage instanceof CoverageItem) {
- (((CoverageItem) packageCoverage)).setOrderNumber(((CoverageItem) importCoverage).getOrderNumber());
- updateFileContents((CoverageItem) packageCoverage, (CoverageItem) importCoverage);
- } else {
- rd.logError(String.format("[%s] doesn't support merge item [%s] (1)", mergeItem.getClass().getSimpleName(),
- MergeType.Add_With_Moves.toString(), mergeItem));
- }
-
- }
-
- /**
- * Takes import items from coverageImport and applies them to coveragePackage
- */
- private void importCoverageUnitItem(XResultData rd, CoverageUnit importItem) {
- System.out.println("importItemsRecurse => " + importItem + " path " + CoverageUtil.getFullPath(importItem));
- try {
- rd.log("Processing " + importItem.getName());
- // if (!(importItem instanceof CoverageUnit)) {
- // rd.logError(String.format("[%s] invalid for Import; Only import CoverageUnits",
- // importItem.getClass().getSimpleName()));
- // }
- CoverageUnit importCoverageUnit = (CoverageUnit) importItem;
-
- MatchItem matchItem = mergeManager.getPackageCoverageItem(importItem);
- // Determine if item already exists first
- if (MatchType.isMatch(matchItem.getMatchType())) {
- // save assignees and notes and RATIONALE before child overwrites
- // ((CoverageUnit) importItem).updateAssigneesAndNotes((CoverageUnit) packageItem);
- System.out.println("FOUND MATCH type " + matchItem.getMatchType());
- System.out.println("FOUND MATCH pack " + matchItem.getPackageItem() + " path " + CoverageUtil.getFullPath(matchItem.getPackageItem()));
- System.out.println("FOUND MATCH impt " + matchItem.getImportItem() + " path " + CoverageUtil.getFullPath(matchItem.getImportItem()));
- }
- // This is new item
- else if (MatchType.isNoMatch(matchItem.getMatchType())) {
- System.err.println("NEW ITEM " + matchItem.getMatchType());
- // Check if parent item exists
- ICoverage parentImportItem = importItem.getParent();
- // If null, this is top level item, just add to package
- if (parentImportItem instanceof CoverageImport) {
- coveragePackage.addCoverageUnit(((CoverageUnit) importItem).copy(true));
- rd.log(String.format("Added [%s] as top level CoverageUnit", importCoverageUnit));
- rd.log("");
- } else {
- // Else, want to add item to same parent
- CoverageUnit parentCoverageUnit = (CoverageUnit) importItem.getParent();
- MatchItem parentMatchItem = mergeManager.getPackageCoverageItem(parentCoverageUnit);
- CoverageUnit parentPackageItem = (CoverageUnit) parentMatchItem.getPackageItem();
- parentPackageItem.addCoverageUnit(importCoverageUnit.copy(true));
- rd.log(String.format("Added [%s] to parent [%s]", importCoverageUnit, parentCoverageUnit));
- rd.log("");
-
- // Since item was added, update parent coverage unit's file contents if necessary
- parentPackageItem.setFileContents(parentImportItem.getFileContents());
-
- }
- }
- } catch (Exception ex) {
- rd.logError("Exception: " + ex.getLocalizedMessage());
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- private boolean validateEditable(XResultData rd, ISaveable saveable) throws OseeCoreException {
- Result result = saveable.isEditable();
- if (result.isFalse()) {
- rd.logError(result.getText());
- return false;
- }
- return true;
- }
-
- private boolean validateMergeTypes(XResultData rd, Collection<IMergeItem> mergeItems) throws OseeCoreException {
- boolean valid = true;
- for (IMergeItem mergeItem : mergeItems) {
- if (mergeItem.getMergeType().isError()) {
- rd.log(String.format("Can't merge item [%s] with error", mergeItem));
- valid = false;
- }
- }
- return valid;
- }
-
- public boolean validateChildren(XResultData rd, Collection<IMergeItem> mergeItems) throws OseeStateException {
- boolean valid = true;
- for (IMergeItem mergeItem : mergeItems) {
- if (mergeItem instanceof MergeItem && ((MergeItem) mergeItem).getImportItem() != null) {
- boolean isValid = validateChildrenAreUniqueRecurse(rd, ((MergeItem) mergeItem).getImportItem());
- if (!isValid) valid = false;
- isValid = validateChildrenFieldsRecurse(rd, ((MergeItem) mergeItem).getImportItem());
- if (!isValid) valid = false;
-
- } else if (mergeItem instanceof MergeItemGroup) {
- boolean isValid = validateChildren(rd, ((MergeItemGroup) mergeItem).getMergeItems());
- if (!isValid) valid = false;
- }
- }
- return valid;
- }
-
- private boolean validateChildrenAreUniqueRecurse(XResultData rd, ICoverage coverage) throws OseeStateException {
- boolean valid = true;
- for (ICoverage importItem1 : coverage.getChildren()) {
- for (ICoverage importItem2 : coverage.getChildren()) {
-
- MatchType matchType = MatchType.getMatchType(importItem1, importItem2);
- if ((matchType == MatchType.Match__Name_And_Order_Num) && importItem1 != importItem2) {
- rd.logError(String.format("CoverageUnit [%s] has two equal children [%s][%s]; Can't import.", coverage,
- importItem1, importItem2));
- valid = false;
- }
- }
- }
- for (ICoverage childItem : coverage.getChildren()) {
- if (childItem instanceof CoverageUnit) {
- boolean isValid = validateChildrenAreUniqueRecurse(rd, (CoverageUnit) childItem);
- if (!isValid) valid = false;
- }
- }
- return valid;
- }
-
- private boolean validateChildrenFieldsRecurse(XResultData rd, ICoverage coverage) throws OseeStateException {
- boolean valid = true;
- for (ICoverage childCoverage : coverage.getChildren()) {
- if (!Strings.isValid(childCoverage.getName())) {
- rd.logError(String.format("ICoverage [%s] has no valid name. path [%s]; Can't import.", childCoverage,
- CoverageUtil.getFullPath(childCoverage)));
- valid = false;
- }
- if (!Strings.isValid(childCoverage.getNamespace())) {
- rd.logError(String.format("ICoverage [%s] has no valid namespace. path [%s]; Can't import.",
- childCoverage, CoverageUtil.getFullPath(childCoverage)));
- valid = false;
- }
- if (childCoverage instanceof CoverageItem && !Strings.isValid(childCoverage.getOrderNumber())) {
- rd.logError(String.format("ICoverage [%s] has no valid orderNumber. path [%s]; Can't import.",
- childCoverage, CoverageUtil.getFullPath(childCoverage)));
- valid = false;
- }
- }
- for (ICoverage childItem : coverage.getChildren()) {
- if (childItem instanceof CoverageUnit) {
- boolean isValid = validateChildrenFieldsRecurse(rd, (CoverageUnit) childItem);
- if (!isValid) valid = false;
- }
- }
- return valid;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class MergeImportManager {
+
+ private final CoveragePackage coveragePackage;
+ private final MergeManager mergeManager;
+
+ public MergeImportManager(MergeManager mergeManager) {
+ this.mergeManager = mergeManager;
+ this.coveragePackage = mergeManager.getCoveragePackage();
+ }
+
+ public XResultData importItems(ISaveable saveable, Collection<IMergeItem> mergeItems) throws OseeCoreException {
+ XResultData rd = new XResultData(false);
+ if (!validateEditable(rd, saveable)) return rd;
+ if (!validateMergeTypes(rd, mergeItems)) return rd;
+ if (!validateChildren(rd, mergeItems)) return rd;
+
+ for (IMergeItem mergeItem : mergeItems) {
+ if (mergeItem.getMergeType() == MergeType.CI_Changes) {
+ if (mergeItem instanceof MergeItemGroup) {
+ MergeItemGroup group = (MergeItemGroup) mergeItem;
+ for (IMergeItem childMergeItem : group.getMergeItems()) {
+ if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Add) {
+ addCoverageItem(childMergeItem, rd);
+ } else if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Renamed) {
+ renameCoverageItem(childMergeItem, rd);
+ } else if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Moved) {
+ updateOrder(mergeItem, childMergeItem, rd);
+ } else if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Delete) {
+ deleteCoverageItem(mergeItem, childMergeItem, rd);
+ } else if (childMergeItem instanceof MergeItem && ((MergeItem) childMergeItem).getMergeType() == MergeType.CI_Method_Update) {
+ updateCoverageItemMethod(childMergeItem, rd);
+ } else {
+ rd.logError(String.format("Coverage_Item_Changes Group: Unsupported merge type [%s]",
+ childMergeItem.getMergeType()));
+ }
+ }
+ } else {
+ rd.logError(String.format("Coverage_Item_Changes: Unsupported mergeItem [%s]", mergeItem));
+ }
+ } else if (mergeItem.getMergeType() == MergeType.Add) {
+ if (mergeItem instanceof MergeItem) {
+ CoverageUnit coverageUnit = (CoverageUnit) ((MergeItem) mergeItem).getImportItem();
+ importCoverageUnitItem(rd, coverageUnit);
+ // add all children items
+ for (CoverageUnit childCoverageUnit : coverageUnit.getCoverageUnits(true)) {
+ importCoverageUnitItem(rd, childCoverageUnit);
+ }
+ } else {
+ rd.logError(String.format("Add: Unsupported mergeItem [%s]", mergeItem));
+ }
+ } else if (mergeItem.getMergeType() == MergeType.Add_With_Moves) {
+ if (mergeItem instanceof MergeItemGroup) {
+ MergeItemGroup group = (MergeItemGroup) mergeItem;
+ for (IMergeItem childMergeItem : group.getMergeItems()) {
+ if (childMergeItem.getMergeType() == MergeType.Add && childMergeItem instanceof MergeItem) {
+ CoverageUnit coverageUnit = (CoverageUnit) ((MergeItem) childMergeItem).getImportItem();
+ importCoverageUnitItem(rd, coverageUnit);
+ // add all children items
+ for (CoverageUnit childCoverageUnit : coverageUnit.getCoverageUnits(true)) {
+ importCoverageUnitItem(rd, childCoverageUnit);
+ }
+ }
+ // For moved items, Change order of package item to match import item
+ else if (childMergeItem.getMergeType() == MergeType.Moved_Due_To_Add && childMergeItem instanceof MergeItem) {
+ updateOrder(mergeItem, childMergeItem, rd);
+ } else {
+ rd.logError(String.format("Add_With_Moves Group: Unsupported merge type [%s]",
+ childMergeItem.getMergeType()));
+ }
+ }
+ } else {
+ rd.logError(String.format("Add_With_Moves: Unsupported mergeItem [%s]", mergeItem));
+ }
+ } else if (mergeItem.getMergeType() == MergeType.Delete_And_Reorder) {
+ if (mergeItem instanceof MergeItemGroup) {
+ MergeItemGroup group = (MergeItemGroup) mergeItem;
+ for (IMergeItem childMergeItem : group.getMergeItems()) {
+ if (childMergeItem.getMergeType() == MergeType.Delete && childMergeItem instanceof MergeItem) {
+ ICoverage packageCoverage = ((MergeItem) childMergeItem).getPackageItem();
+ ICoverage parentPackageCoverage = packageCoverage.getParent();
+ ((ICoverageUnitProvider) parentPackageCoverage).removeCoverageUnit((CoverageUnit) packageCoverage);
+ }
+ // For moved items, Change order of package item to match import item
+ else if (childMergeItem.getMergeType() == MergeType.Moved_Due_To_Delete && childMergeItem instanceof MergeItem) {
+ updateOrder(mergeItem, childMergeItem, rd);
+ } else {
+ rd.logError(String.format("Delete_And_Reorder Group: Unsupported merge type [%s]",
+ childMergeItem.getMergeType()));
+ }
+ }
+ } else {
+ rd.logError(String.format("Delete_And_Reorder: Unsupported mergeItem [%s]", mergeItem));
+ }
+ } else {
+ rd.logError(String.format("Unsupported merge type [%s]", mergeItem.getMergeType()));
+ }
+ }
+
+ if (rd.getNumErrors() > 0) {
+ if (!CoverageUtil.isInTest()) {
+ AWorkbench.popup(rd.getNumErrors() + " Errors Found; Not Persisting");
+ }
+ rd.logError(rd.getNumErrors() + " Errors Found; Not Persisting");
+ } else {
+ Result result = saveable.save();
+ if (result.isTrue()) {
+ rd.log("\nChanges Persisted");
+ } else {
+ rd.logError("\n" + result.getText());
+ }
+ }
+ return rd;
+ }
+
+ private void addCoverageItem(IMergeItem mergeItem, XResultData rd) throws OseeCoreException {
+ CoverageItem importItem = (CoverageItem) ((MergeItem) mergeItem).getImportItem();
+ MatchItem parentMatchItem = mergeManager.getPackageCoverageItem(importItem.getParent());
+ ICoverage parentPackageItem = parentMatchItem == null ? null : parentMatchItem.getPackageItem();
+ CoverageUnit parentPackageCoverageUnit = (CoverageUnit) parentPackageItem;
+ CoverageItem packageItem = importItem.copy(parentPackageCoverageUnit);
+ updateFileContents(packageItem, importItem);
+ }
+
+ private void deleteCoverageItem(IMergeItem mergeItem, IMergeItem childMergeItem, XResultData rd) throws OseeCoreException {
+ CoverageItem packageItem = (CoverageItem) ((MergeItem) childMergeItem).getPackageItem();
+ ((CoverageUnit) packageItem.getParent()).removeCoverageItem(packageItem);
+ updateFileContents((CoverageUnit) packageItem.getParent(),
+ (CoverageUnit) ((MergeItemGroup) mergeItem).getParent());
+ }
+
+ private void renameCoverageItem(IMergeItem mergeItem, XResultData rd) throws OseeCoreException {
+ CoverageItem importItem = (CoverageItem) ((MergeItem) mergeItem).getImportItem();
+ CoverageItem packageItem = (CoverageItem) ((MergeItem) mergeItem).getPackageItem();
+ packageItem.setName(importItem.getName());
+ if (Strings.isValid(packageItem.getRationale())) {
+ packageItem.setRationale("");
+ }
+ packageItem.setCoverageMethod(importItem.getCoverageMethod());
+ updateFileContents(packageItem, importItem);
+ }
+
+ private void updateCoverageItemMethod(IMergeItem mergeItem, XResultData rd) throws OseeCoreException {
+ CoverageItem importItem = (CoverageItem) ((MergeItem) mergeItem).getImportItem();
+ CoverageItem packageItem = (CoverageItem) ((MergeItem) mergeItem).getPackageItem();
+ packageItem.setCoverageMethod(importItem.getCoverageMethod());
+ updateFileContents(packageItem, importItem);
+ }
+
+ private void updateFileContents(CoverageItem packageItem, CoverageItem importItem) throws OseeCoreException {
+ // Since items names changed, update parent coverage unit's file contents
+ if (packageItem.getParent() != null && packageItem.getParent() instanceof CoverageUnit) {
+ updateFileContents((CoverageUnit) packageItem.getParent(), (CoverageUnit) importItem.getParent());
+ }
+ }
+
+ private void updateFileContents(CoverageUnit packageUnit, CoverageUnit importUnit) throws OseeCoreException {
+ if (!packageUnit.getFileContents().equals(importUnit.getFileContents())) {
+ packageUnit.setFileContents(importUnit.getFileContents());
+ }
+ if (packageUnit.getParent() != null && packageUnit.getParent() instanceof CoverageUnit) {
+ CoverageUnit parentPackageCoverage = (CoverageUnit) packageUnit.getParent();
+ CoverageUnit parentImportCoverage = (CoverageUnit) importUnit.getParent();
+ if (!parentPackageCoverage.getFileContents().equals(parentImportCoverage.getFileContents())) {
+ parentPackageCoverage.setFileContents(parentImportCoverage.getFileContents());
+ }
+ }
+ }
+
+ private void updateOrder(IMergeItem mergeItem, IMergeItem childMergeItem, XResultData rd) throws OseeCoreException {
+ ICoverage packageCoverage = ((MergeItem) childMergeItem).getPackageItem();
+ ICoverage importCoverage = ((MergeItem) childMergeItem).getImportItem();
+ if (packageCoverage instanceof CoverageUnit) {
+ ((CoverageUnit) packageCoverage).setOrderNumber(((CoverageUnit) importCoverage).getOrderNumber());
+ } else if (packageCoverage instanceof CoverageItem) {
+ (((CoverageItem) packageCoverage)).setOrderNumber(((CoverageItem) importCoverage).getOrderNumber());
+ updateFileContents((CoverageItem) packageCoverage, (CoverageItem) importCoverage);
+ } else {
+ rd.logError(String.format("[%s] doesn't support merge item [%s] (1)", mergeItem.getClass().getSimpleName(),
+ MergeType.Add_With_Moves.toString(), mergeItem));
+ }
+
+ }
+
+ /**
+ * Takes import items from coverageImport and applies them to coveragePackage
+ */
+ private void importCoverageUnitItem(XResultData rd, CoverageUnit importItem) {
+ System.out.println("importItemsRecurse => " + importItem + " path " + CoverageUtil.getFullPath(importItem));
+ try {
+ rd.log("Processing " + importItem.getName());
+ // if (!(importItem instanceof CoverageUnit)) {
+ // rd.logError(String.format("[%s] invalid for Import; Only import CoverageUnits",
+ // importItem.getClass().getSimpleName()));
+ // }
+ CoverageUnit importCoverageUnit = (CoverageUnit) importItem;
+
+ MatchItem matchItem = mergeManager.getPackageCoverageItem(importItem);
+ // Determine if item already exists first
+ if (MatchType.isMatch(matchItem.getMatchType())) {
+ // save assignees and notes and RATIONALE before child overwrites
+ // ((CoverageUnit) importItem).updateAssigneesAndNotes((CoverageUnit) packageItem);
+ System.out.println("FOUND MATCH type " + matchItem.getMatchType());
+ System.out.println("FOUND MATCH pack " + matchItem.getPackageItem() + " path " + CoverageUtil.getFullPath(matchItem.getPackageItem()));
+ System.out.println("FOUND MATCH impt " + matchItem.getImportItem() + " path " + CoverageUtil.getFullPath(matchItem.getImportItem()));
+ }
+ // This is new item
+ else if (MatchType.isNoMatch(matchItem.getMatchType())) {
+ System.err.println("NEW ITEM " + matchItem.getMatchType());
+ // Check if parent item exists
+ ICoverage parentImportItem = importItem.getParent();
+ // If null, this is top level item, just add to package
+ if (parentImportItem instanceof CoverageImport) {
+ coveragePackage.addCoverageUnit(((CoverageUnit) importItem).copy(true));
+ rd.log(String.format("Added [%s] as top level CoverageUnit", importCoverageUnit));
+ rd.log("");
+ } else {
+ // Else, want to add item to same parent
+ CoverageUnit parentCoverageUnit = (CoverageUnit) importItem.getParent();
+ MatchItem parentMatchItem = mergeManager.getPackageCoverageItem(parentCoverageUnit);
+ CoverageUnit parentPackageItem = (CoverageUnit) parentMatchItem.getPackageItem();
+ parentPackageItem.addCoverageUnit(importCoverageUnit.copy(true));
+ rd.log(String.format("Added [%s] to parent [%s]", importCoverageUnit, parentCoverageUnit));
+ rd.log("");
+
+ // Since item was added, update parent coverage unit's file contents if necessary
+ parentPackageItem.setFileContents(parentImportItem.getFileContents());
+
+ }
+ }
+ } catch (Exception ex) {
+ rd.logError("Exception: " + ex.getLocalizedMessage());
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ private boolean validateEditable(XResultData rd, ISaveable saveable) throws OseeCoreException {
+ Result result = saveable.isEditable();
+ if (result.isFalse()) {
+ rd.logError(result.getText());
+ return false;
+ }
+ return true;
+ }
+
+ private boolean validateMergeTypes(XResultData rd, Collection<IMergeItem> mergeItems) throws OseeCoreException {
+ boolean valid = true;
+ for (IMergeItem mergeItem : mergeItems) {
+ if (mergeItem.getMergeType().isError()) {
+ rd.log(String.format("Can't merge item [%s] with error", mergeItem));
+ valid = false;
+ }
+ }
+ return valid;
+ }
+
+ public boolean validateChildren(XResultData rd, Collection<IMergeItem> mergeItems) throws OseeStateException {
+ boolean valid = true;
+ for (IMergeItem mergeItem : mergeItems) {
+ if (mergeItem instanceof MergeItem && ((MergeItem) mergeItem).getImportItem() != null) {
+ boolean isValid = validateChildrenAreUniqueRecurse(rd, ((MergeItem) mergeItem).getImportItem());
+ if (!isValid) valid = false;
+ isValid = validateChildrenFieldsRecurse(rd, ((MergeItem) mergeItem).getImportItem());
+ if (!isValid) valid = false;
+
+ } else if (mergeItem instanceof MergeItemGroup) {
+ boolean isValid = validateChildren(rd, ((MergeItemGroup) mergeItem).getMergeItems());
+ if (!isValid) valid = false;
+ }
+ }
+ return valid;
+ }
+
+ private boolean validateChildrenAreUniqueRecurse(XResultData rd, ICoverage coverage) throws OseeStateException {
+ boolean valid = true;
+ for (ICoverage importItem1 : coverage.getChildren()) {
+ for (ICoverage importItem2 : coverage.getChildren()) {
+
+ MatchType matchType = MatchType.getMatchType(importItem1, importItem2);
+ if ((matchType == MatchType.Match__Name_And_Order_Num) && importItem1 != importItem2) {
+ rd.logError(String.format("CoverageUnit [%s] has two equal children [%s][%s]; Can't import.", coverage,
+ importItem1, importItem2));
+ valid = false;
+ }
+ }
+ }
+ for (ICoverage childItem : coverage.getChildren()) {
+ if (childItem instanceof CoverageUnit) {
+ boolean isValid = validateChildrenAreUniqueRecurse(rd, (CoverageUnit) childItem);
+ if (!isValid) valid = false;
+ }
+ }
+ return valid;
+ }
+
+ private boolean validateChildrenFieldsRecurse(XResultData rd, ICoverage coverage) throws OseeStateException {
+ boolean valid = true;
+ for (ICoverage childCoverage : coverage.getChildren()) {
+ if (!Strings.isValid(childCoverage.getName())) {
+ rd.logError(String.format("ICoverage [%s] has no valid name. path [%s]; Can't import.", childCoverage,
+ CoverageUtil.getFullPath(childCoverage)));
+ valid = false;
+ }
+ if (!Strings.isValid(childCoverage.getNamespace())) {
+ rd.logError(String.format("ICoverage [%s] has no valid namespace. path [%s]; Can't import.",
+ childCoverage, CoverageUtil.getFullPath(childCoverage)));
+ valid = false;
+ }
+ if (childCoverage instanceof CoverageItem && !Strings.isValid(childCoverage.getOrderNumber())) {
+ rd.logError(String.format("ICoverage [%s] has no valid orderNumber. path [%s]; Can't import.",
+ childCoverage, CoverageUtil.getFullPath(childCoverage)));
+ valid = false;
+ }
+ }
+ for (ICoverage childItem : coverage.getChildren()) {
+ if (childItem instanceof CoverageUnit) {
+ boolean isValid = validateChildrenFieldsRecurse(rd, (CoverageUnit) childItem);
+ if (!isValid) valid = false;
+ }
+ }
+ return valid;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItem.java
index 1f5f5dcc53..7cf5345198 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItem.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import java.util.Collection;
import java.util.Collections;
import org.eclipse.osee.coverage.model.ICoverage;
@@ -17,147 +17,147 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class MergeItem extends MergeItemBase {
-
- private final ICoverage packageItem;
- private final ICoverage importItem;
-
- public MergeItem(MergeType mergeType, ICoverage packageItem, ICoverage importItem, boolean isCheckable) {
- super(mergeType, isCheckable);
- this.packageItem = packageItem;
- this.importItem = importItem;
- }
-
- public ICoverage getPackageItem() {
- return packageItem;
- }
-
- public ICoverage getImportItem() {
- return importItem;
- }
-
- @Override
- public String getAssignees() throws OseeCoreException {
- if (importItem != null) return importItem.getAssignees();
- return "";
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren() {
- if (importItem != null) return importItem.getChildren();
- return Collections.emptyList();
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren(boolean recurse) {
- if (importItem != null) return importItem.getChildren(recurse);
- return Collections.emptyList();
- }
-
- @Override
- public Double getCoveragePercent() {
- if (importItem != null) return importItem.getCoveragePercent();
- return 0.0;
- }
-
- @Override
- public String getCoveragePercentStr() {
- if (importItem != null) return importItem.getCoveragePercentStr();
- return "0";
- }
-
- @Override
- public String getGuid() {
- if (importItem != null) return importItem.getGuid();
- return "";
- }
-
- @Override
- public String getLocation() {
- if (importItem != null) return importItem.getLocation();
- return packageItem.getLocation();
- }
-
- @Override
- public String getName() {
- if (importItem != null)
- return importItem.getName();
- else
- return String.format("Package [%s]", packageItem.getName());
- }
-
- @Override
- public String getNamespace() {
- if (importItem != null) return importItem.getNamespace();
- return packageItem.getNamespace();
- }
-
- @Override
- public String getNotes() {
- if (importItem != null) return importItem.getNotes();
- return String.format("Package [%s]", packageItem.getNotes());
- }
-
- @Override
- public KeyedImage getOseeImage() {
- if (importItem != null) return importItem.getOseeImage();
- return packageItem.getOseeImage();
- }
-
- @Override
- public ICoverage getParent() {
- if (importItem != null) return importItem.getParent();
- return packageItem.getParent();
- }
-
- @Override
- public String getFileContents() throws OseeCoreException {
- if (importItem != null) return importItem.getFileContents();
- return packageItem.getFileContents();
- }
-
- @Override
- public boolean isAssignable() {
- if (importItem != null) return importItem.isAssignable();
- return packageItem.isAssignable();
- }
-
- @Override
- public boolean isCovered() {
- if (importItem != null) return importItem.isCovered();
- return packageItem.isCovered();
- }
-
- @Override
- public Result isEditable() {
- if (importItem != null) return importItem.isEditable();
- return packageItem.isEditable();
- }
-
- @Override
- public boolean isFolder() {
- if (importItem != null) return importItem.isFolder();
- return packageItem.isFolder();
- }
-
- @Override
- public String toString() {
- if (importItem != null) return getMergeType().toString() + " - " + importItem.toString();
- return getMergeType().toString() + " - " + packageItem.toString();
- }
-
- @Override
- public String getOrderNumber() {
- if (Strings.isValid(importItem.getOrderNumber())) {
- return importItem.getOrderNumber();
- } else if (Strings.isValid(packageItem.getOrderNumber())) {
- return packageItem.getOrderNumber();
- }
- return "";
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class MergeItem extends MergeItemBase {
+
+ private final ICoverage packageItem;
+ private final ICoverage importItem;
+
+ public MergeItem(MergeType mergeType, ICoverage packageItem, ICoverage importItem, boolean isCheckable) {
+ super(mergeType, isCheckable);
+ this.packageItem = packageItem;
+ this.importItem = importItem;
+ }
+
+ public ICoverage getPackageItem() {
+ return packageItem;
+ }
+
+ public ICoverage getImportItem() {
+ return importItem;
+ }
+
+ @Override
+ public String getAssignees() throws OseeCoreException {
+ if (importItem != null) return importItem.getAssignees();
+ return "";
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren() {
+ if (importItem != null) return importItem.getChildren();
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren(boolean recurse) {
+ if (importItem != null) return importItem.getChildren(recurse);
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Double getCoveragePercent() {
+ if (importItem != null) return importItem.getCoveragePercent();
+ return 0.0;
+ }
+
+ @Override
+ public String getCoveragePercentStr() {
+ if (importItem != null) return importItem.getCoveragePercentStr();
+ return "0";
+ }
+
+ @Override
+ public String getGuid() {
+ if (importItem != null) return importItem.getGuid();
+ return "";
+ }
+
+ @Override
+ public String getLocation() {
+ if (importItem != null) return importItem.getLocation();
+ return packageItem.getLocation();
+ }
+
+ @Override
+ public String getName() {
+ if (importItem != null)
+ return importItem.getName();
+ else
+ return String.format("Package [%s]", packageItem.getName());
+ }
+
+ @Override
+ public String getNamespace() {
+ if (importItem != null) return importItem.getNamespace();
+ return packageItem.getNamespace();
+ }
+
+ @Override
+ public String getNotes() {
+ if (importItem != null) return importItem.getNotes();
+ return String.format("Package [%s]", packageItem.getNotes());
+ }
+
+ @Override
+ public KeyedImage getOseeImage() {
+ if (importItem != null) return importItem.getOseeImage();
+ return packageItem.getOseeImage();
+ }
+
+ @Override
+ public ICoverage getParent() {
+ if (importItem != null) return importItem.getParent();
+ return packageItem.getParent();
+ }
+
+ @Override
+ public String getFileContents() throws OseeCoreException {
+ if (importItem != null) return importItem.getFileContents();
+ return packageItem.getFileContents();
+ }
+
+ @Override
+ public boolean isAssignable() {
+ if (importItem != null) return importItem.isAssignable();
+ return packageItem.isAssignable();
+ }
+
+ @Override
+ public boolean isCovered() {
+ if (importItem != null) return importItem.isCovered();
+ return packageItem.isCovered();
+ }
+
+ @Override
+ public Result isEditable() {
+ if (importItem != null) return importItem.isEditable();
+ return packageItem.isEditable();
+ }
+
+ @Override
+ public boolean isFolder() {
+ if (importItem != null) return importItem.isFolder();
+ return packageItem.isFolder();
+ }
+
+ @Override
+ public String toString() {
+ if (importItem != null) return getMergeType().toString() + " - " + importItem.toString();
+ return getMergeType().toString() + " - " + packageItem.toString();
+ }
+
+ @Override
+ public String getOrderNumber() {
+ if (Strings.isValid(importItem.getOrderNumber())) {
+ return importItem.getOrderNumber();
+ } else if (Strings.isValid(packageItem.getOrderNumber())) {
+ return packageItem.getOrderNumber();
+ }
+ return "";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java
index c7dbca0f2a..e3aee65718 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java
@@ -8,50 +8,50 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class MergeItemBase implements IMergeItem {
-
- private final MergeType mergeType;
- private boolean checked = false;
- private boolean isCheckable = true;
- private boolean importAllowed = true;
-
- public MergeItemBase(MergeType mergeType, boolean isCheckable) {
- this.mergeType = mergeType;
- this.isCheckable = isCheckable;
- }
-
- public MergeType getMergeType() {
- return mergeType;
- }
-
- public boolean isChecked() {
- return checked;
- }
-
- public void setChecked(boolean checked) throws OseeArgumentException {
- if (!isCheckable) {
- throw new OseeArgumentException(String.format("Merge Item is not checkable [%s]", this));
- }
- this.checked = checked;
- }
-
- public boolean isImportAllowed() {
- return importAllowed;
- }
-
- public void setImportAllowed(boolean importAllowed) {
- this.importAllowed = importAllowed;
- }
-
- public boolean isCheckable() {
- return isCheckable;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class MergeItemBase implements IMergeItem {
+
+ private final MergeType mergeType;
+ private boolean checked = false;
+ private boolean isCheckable = true;
+ private boolean importAllowed = true;
+
+ public MergeItemBase(MergeType mergeType, boolean isCheckable) {
+ this.mergeType = mergeType;
+ this.isCheckable = isCheckable;
+ }
+
+ public MergeType getMergeType() {
+ return mergeType;
+ }
+
+ public boolean isChecked() {
+ return checked;
+ }
+
+ public void setChecked(boolean checked) throws OseeArgumentException {
+ if (!isCheckable) {
+ throw new OseeArgumentException(String.format("Merge Item is not checkable [%s]", this));
+ }
+ this.checked = checked;
+ }
+
+ public boolean isImportAllowed() {
+ return importAllowed;
+ }
+
+ public void setImportAllowed(boolean importAllowed) {
+ this.importAllowed = importAllowed;
+ }
+
+ public boolean isCheckable() {
+ return isCheckable;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemGroup.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemGroup.java
index 7afb640819..69b36e4104 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemGroup.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemGroup.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -19,140 +19,140 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class MergeItemGroup extends MergeItemBase {
-
- private final Collection<IMergeItem> mergeItems;
- private final ICoverage parentCoverage;
-
- public MergeItemGroup(MergeType mergeType, ICoverage parentCoverage, Collection<IMergeItem> mergeItems, boolean isCheckable) {
- super(mergeType, isCheckable);
- this.parentCoverage = parentCoverage;
- this.mergeItems = mergeItems;
- }
-
- @Override
- public String toString() {
- return getMergeType().toString() + " - " + mergeItems.toString();
- }
-
- @Override
- public String getAssignees() throws OseeCoreException {
- return "";
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren() {
- return mergeItems;
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren(boolean recurse) {
- Set<ICoverage> children = new HashSet<ICoverage>();
- for (IMergeItem mergeItem : mergeItems) {
- if (mergeItem instanceof MergeItem && ((MergeItem) mergeItem).getImportItem() != null) {
- children.addAll(((MergeItem) mergeItem).getImportItem().getChildren(recurse));
- }
- }
- return children;
- }
-
- @Override
- public Double getCoveragePercent() {
- Collection<? extends ICoverage> children = getChildren(true);
- Set<ICoverage> covered = new HashSet<ICoverage>();
- for (ICoverage coverage : children) {
- if (coverage.isCovered()) covered.add(coverage);
- }
- return CoverageUtil.getPercent(covered.size(), children.size(), true).getFirst();
- }
-
- @Override
- public String getCoveragePercentStr() {
- Collection<? extends ICoverage> children = getChildren(true);
- Set<ICoverage> covered = new HashSet<ICoverage>();
- for (ICoverage coverage : children) {
- if (coverage.isCovered()) covered.add(coverage);
- }
- return CoverageUtil.getPercent(covered.size(), children.size(), true).getSecond();
- }
-
- @Override
- public String getGuid() {
- return "";
- }
-
- @Override
- public String getLocation() {
- return "";
- }
-
- @Override
- public String getName() {
- return getMergeType().toString() + " - " + CoverageUtil.getFullPath(parentCoverage) + "[" + parentCoverage.getName() + "]";
- }
-
- @Override
- public String getNamespace() {
- return parentCoverage.getNamespace();
- }
-
- @Override
- public String getNotes() {
- return "";
- }
-
- @Override
- public KeyedImage getOseeImage() {
- return mergeItems.iterator().next().getOseeImage();
- }
-
- @Override
- public ICoverage getParent() {
- return parentCoverage;
- }
-
- @Override
- public String getFileContents() throws OseeCoreException {
- String str = parentCoverage.getFileContents();
- if (Strings.isValid(str)) {
- return str;
- }
- if (parentCoverage.getParent() != null) {
- return parentCoverage.getParent().getFileContents();
- }
- return "";
- }
-
- @Override
- public boolean isAssignable() {
- return false;
- }
-
- @Override
- public boolean isCovered() {
- return false;
- }
-
- @Override
- public Result isEditable() {
- return parentCoverage.isEditable();
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- public Collection<IMergeItem> getMergeItems() {
- return mergeItems;
- }
-
- @Override
- public String getOrderNumber() {
- return "";
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class MergeItemGroup extends MergeItemBase {
+
+ private final Collection<IMergeItem> mergeItems;
+ private final ICoverage parentCoverage;
+
+ public MergeItemGroup(MergeType mergeType, ICoverage parentCoverage, Collection<IMergeItem> mergeItems, boolean isCheckable) {
+ super(mergeType, isCheckable);
+ this.parentCoverage = parentCoverage;
+ this.mergeItems = mergeItems;
+ }
+
+ @Override
+ public String toString() {
+ return getMergeType().toString() + " - " + mergeItems.toString();
+ }
+
+ @Override
+ public String getAssignees() throws OseeCoreException {
+ return "";
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren() {
+ return mergeItems;
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren(boolean recurse) {
+ Set<ICoverage> children = new HashSet<ICoverage>();
+ for (IMergeItem mergeItem : mergeItems) {
+ if (mergeItem instanceof MergeItem && ((MergeItem) mergeItem).getImportItem() != null) {
+ children.addAll(((MergeItem) mergeItem).getImportItem().getChildren(recurse));
+ }
+ }
+ return children;
+ }
+
+ @Override
+ public Double getCoveragePercent() {
+ Collection<? extends ICoverage> children = getChildren(true);
+ Set<ICoverage> covered = new HashSet<ICoverage>();
+ for (ICoverage coverage : children) {
+ if (coverage.isCovered()) covered.add(coverage);
+ }
+ return CoverageUtil.getPercent(covered.size(), children.size(), true).getFirst();
+ }
+
+ @Override
+ public String getCoveragePercentStr() {
+ Collection<? extends ICoverage> children = getChildren(true);
+ Set<ICoverage> covered = new HashSet<ICoverage>();
+ for (ICoverage coverage : children) {
+ if (coverage.isCovered()) covered.add(coverage);
+ }
+ return CoverageUtil.getPercent(covered.size(), children.size(), true).getSecond();
+ }
+
+ @Override
+ public String getGuid() {
+ return "";
+ }
+
+ @Override
+ public String getLocation() {
+ return "";
+ }
+
+ @Override
+ public String getName() {
+ return getMergeType().toString() + " - " + CoverageUtil.getFullPath(parentCoverage) + "[" + parentCoverage.getName() + "]";
+ }
+
+ @Override
+ public String getNamespace() {
+ return parentCoverage.getNamespace();
+ }
+
+ @Override
+ public String getNotes() {
+ return "";
+ }
+
+ @Override
+ public KeyedImage getOseeImage() {
+ return mergeItems.iterator().next().getOseeImage();
+ }
+
+ @Override
+ public ICoverage getParent() {
+ return parentCoverage;
+ }
+
+ @Override
+ public String getFileContents() throws OseeCoreException {
+ String str = parentCoverage.getFileContents();
+ if (Strings.isValid(str)) {
+ return str;
+ }
+ if (parentCoverage.getParent() != null) {
+ return parentCoverage.getParent().getFileContents();
+ }
+ return "";
+ }
+
+ @Override
+ public boolean isAssignable() {
+ return false;
+ }
+
+ @Override
+ public boolean isCovered() {
+ return false;
+ }
+
+ @Override
+ public Result isEditable() {
+ return parentCoverage.isEditable();
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ public Collection<IMergeItem> getMergeItems() {
+ return mergeItems;
+ }
+
+ @Override
+ public String getOrderNumber() {
+ return "";
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java
index 5b6f60611f..f8db2bd782 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Arrays;
@@ -32,508 +32,508 @@ import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.AHTML;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-
-/**
- * @author Donald G. Dunne
- */
-public class MergeManager {
- private final CoveragePackage coveragePackage;
- private final CoverageImport coverageImport;
- private Set<ICoverage> processedImportCoverages = new HashSet<ICoverage>(1000);
-
- public MergeManager(CoveragePackage coveragePackage, CoverageImport coverageImport) {
- this.coveragePackage = coveragePackage;
- this.coverageImport = coverageImport;
- }
-
- public List<IMergeItem> getMergeItems() throws OseeCoreException {
- List<IMergeItem> mergeItems = new ArrayList<IMergeItem>();
- processedImportCoverages.clear();
- for (ICoverage importCoverage : coverageImport.getChildren()) {
- processImportCoverage(importCoverage, mergeItems, null);
- }
- if (mergeItems.isEmpty()) {
- mergeItems.add(new MessageMergeItem("Nothing to Import"));
- }
- return mergeItems;
- }
-
- public XResultData getMergeDetails(ICoverage importCoverageItem, XResultData resultData) throws OseeCoreException {
- List<IMergeItem> mergeItems = new ArrayList<IMergeItem>();
- processImportCoverage(importCoverageItem, mergeItems, resultData);
- return resultData;
- }
-
- private void processImportCoverage(ICoverage importCoverage, List<IMergeItem> mergeItems, XResultData resultData) throws OseeCoreException {
- boolean debug = false;
- if (debug) {
- System.err.println("Merging check " + importCoverage);
- }
- if (resultData != null) {
- resultData.log("\n\nMerging check " + importCoverage);
- }
-
- MatchItem matchItem = getPackageCoverageItem(importCoverage);
- // No matching coverage package item, Add this and all children
- if (MatchType.isNoMatch(matchItem.getMatchType())) {
- if (!processedImportCoverages.contains(importCoverage)) {
- mergeItems.add(new MergeItem(MergeType.Add, null, importCoverage, true));
- }
- }
- // Import item matched Package item, check children
- else {
- ICoverage packageICoverage = matchItem.getPackageItem();
- ICoverage importICoverage = matchItem.getImportItem();
-
- Collection<? extends ICoverage> packageItemChildren = packageICoverage.getChildren();
- Collection<? extends ICoverage> importItemChildren = importICoverage.getChildren();
- Map<ICoverage, MatchItem> importItemToMatchItem = new HashMap<ICoverage, MatchItem>(10);
- boolean moreImportChildrenThanPackageChildren = importItemChildren.size() > packageItemChildren.size();
- boolean morePackageChildrenThanImportChildren = packageItemChildren.size() > importItemChildren.size();
- boolean sameNumberChildren = importItemChildren.size() == packageItemChildren.size();
- if (resultData != null) {
- resultData.log(String.format("Num Import Items: %d - Num Package Items: %d", importItemChildren.size(),
- packageItemChildren.size()));
- resultData.log(AHTML.getLabelValueStr("moreImportChildrenThanPackageChildren",
- String.valueOf(moreImportChildrenThanPackageChildren)));
- resultData.log(AHTML.getLabelValueStr("morePackageChildrenThanImportChildren",
- String.valueOf(morePackageChildrenThanImportChildren)));
- resultData.log(AHTML.getLabelValueStr("sameNumberChildren", String.valueOf(sameNumberChildren)));
-
- resultData.log(AHTML.bold("Package Children:"));
- for (ICoverage coverage : packageItemChildren) {
- resultData.addRaw(AHTML.blockQuote(String.valueOf(coverage).replaceAll(" ", "&nbsp")));
- }
- resultData.log(AHTML.bold("Import Children:"));
- for (ICoverage coverage : importItemChildren) {
- resultData.addRaw(AHTML.blockQuote(String.valueOf(coverage).replaceAll(" ", "&nbsp")));
- }
- }
-
- if (debug) {
- if (importCoverage.getGuid().equals("AAte3i2bH3L1MvsFMqAA")) {
- System.out.println("here");
- }
- if (importCoverage.getName().equals("NavigationButton2.java")) {
- System.out.println("here");
- }
- if (importCoverage.getName().equals("getImage")) {
- System.out.println("here");
- }
- }
-
- // Determine match for all import item children
- for (ICoverage childCoverage : importItemChildren) {
- MatchItem childMatchItem = getPackageCoverageItemRecurse(packageICoverage, childCoverage);
- importItemToMatchItem.put(childCoverage, childMatchItem);
- }
-
- if (resultData != null) {
- resultData.log(AHTML.bold("Match Items:"));
- for (Entry<ICoverage, MatchItem> entry : importItemToMatchItem.entrySet()) {
- resultData.addRaw(AHTML.blockQuote(String.valueOf(entry.getValue()).replaceAll(" ", "&nbsp")));
- }
- }
- if (debug) {
- for (Entry<ICoverage, MatchItem> entry : importItemToMatchItem.entrySet()) {
- System.out.println(String.format("MatchItem[%s]", entry.getValue()));
- }
- }
-
- // Case: All children all CoverageItems
- // Action: process them separately
- if (CoverageUtil.isAllCoverageItems(importItemChildren)) {
- handleChildrenCoverageItems(mergeItems, packageItemChildren, importCoverage, importItemChildren,
- importItemToMatchItem, resultData);
- }
-
- // Case: All match and package # children == import # children
- // Action: continue and check children's children
- else if (isAllMatchCase(sameNumberChildren, importItemToMatchItem)) {
- handleAllMatchCase(mergeItems, importItemChildren, resultData);
- }
-
- // Case: All same except package item has more; possible deletion, attempt to handle
- // Action: Attempt to determine deleted package item
- else if (isPackageItemDeleted(morePackageChildrenThanImportChildren)) {
- handlePackageItemDeleted(mergeItems, importCoverage, packageItemChildren, importItemChildren, resultData);
- }
-
- // Case: Import children all full match except Import has more that don't match, items added and moved
- // Action: Process as Add / Move
- else if (isImportItemsAddedOrMoved(moreImportChildrenThanPackageChildren, importItemToMatchItem)) {
-
- // Determine number of No_Match items that are name-only match
- Map<ICoverage, ICoverage> nameOnlyImportToPackageCoverage = new HashMap<ICoverage, ICoverage>();
- for (Entry<ICoverage, MatchItem> pair : importItemToMatchItem.entrySet()) {
- ICoverage importChild = pair.getKey();
- if (pair.getValue().getMatchType() == MatchType.No_Match__Name_Or_Order_Num) {
- // Try to find child that matches name
- for (ICoverage packageChild : packageItemChildren) {
- if (packageChild.getName().equals(importChild.getName())) {
- nameOnlyImportToPackageCoverage.put(importChild, packageChild);
- }
- }
- }
- }
-
- // Case: All match, some added, and none moved (name-only)
- // Action: just add new ones and process all children
- if (isOnlyAddNewOnes(nameOnlyImportToPackageCoverage, packageItemChildren, importItemToMatchItem)) {
- handleOnlyAddNewOnes(mergeItems, importCoverage, importItemChildren, importItemToMatchItem, resultData);
- }
-
- // Case: All match, some added, and some moved
- // Action: Process children of Matches; Add ones that were not Name-Only; Move ones that were
- else {
- handleSomeAddedSomeMoved(mergeItems, nameOnlyImportToPackageCoverage, packageItemChildren,
- importCoverage, importItemChildren, importItemToMatchItem, resultData);
- }
-
- }
- // Case: Unhandled
- // Action: Mark as UnMergeable
- else {
- mergeItems.add(new MergeItem(MergeType.Error__UnMergable, null, importCoverage, false));
- }
- }
- return;
- }
-
- private Entry<List<ICoverage>, List<ICoverage>> getMatchedAndUnMatchedImportCoverageItems(Map<ICoverage, MatchItem> importItemToMatchItem) throws OseeCoreException {
- List<ICoverage> unMatchedCoverageItems = new ArrayList<ICoverage>();
- List<ICoverage> matchedCoverageItems = new ArrayList<ICoverage>();
- for (Entry<ICoverage, MatchItem> coverageToMatchItem : importItemToMatchItem.entrySet()) {
- MatchItem childMatchItem = coverageToMatchItem.getValue();
- ICoverage childICoverage = coverageToMatchItem.getKey();
- if (!childMatchItem.isMatch()) {
- unMatchedCoverageItems.add(childICoverage);
- } else {
- matchedCoverageItems.add(childICoverage);
- }
- }
- return new SimpleEntry<List<ICoverage>, List<ICoverage>>(matchedCoverageItems, unMatchedCoverageItems);
- }
-
- private List<ICoverage> getMatchedPackageCoverageItems(Map<ICoverage, MatchItem> importItemToMatchItem) throws OseeCoreException {
- List<ICoverage> matchedPackageCoverageItems = new ArrayList<ICoverage>();
- for (Entry<ICoverage, MatchItem> coverageToMatchItem : importItemToMatchItem.entrySet()) {
- MatchItem childMatchItem = coverageToMatchItem.getValue();
- if (childMatchItem.isMatch()) {
- matchedPackageCoverageItems.add(childMatchItem.getPackageItem());
- }
- }
- return matchedPackageCoverageItems;
- }
-
- private void handleChildrenCoverageItems(List<IMergeItem> mergeItems, Collection<? extends ICoverage> packageItemChildren, ICoverage importCoverage, Collection<? extends ICoverage> importItemChildren, Map<ICoverage, MatchItem> importItemToMatchItem, XResultData resultData) throws OseeCoreException {
- List<IMergeItem> groupMergeItems = new ArrayList<IMergeItem>();
- boolean unMergeableExists = false;
- Entry<List<ICoverage>, List<ICoverage>> matchedUnMatchedEntry =
- getMatchedAndUnMatchedImportCoverageItems(importItemToMatchItem);
- // Get all Import CoverageItems that do not match package CoverageItems
- List<ICoverage> unMatchedImportCoverageItems = matchedUnMatchedEntry.getValue();
- // Get all Import CoverageItems that DO match package CoverageItems
- List<ICoverage> matchedImportCoverageItems = matchedUnMatchedEntry.getKey();
- // List package coverageItems that have been processed; list should be empty at end
- List<ICoverage> packageItemsProcessed = getMatchedPackageCoverageItems(importItemToMatchItem);
-
- for (ICoverage childICoverage : new CopyOnWriteArrayList<ICoverage>(unMatchedImportCoverageItems)) {
- MatchItem childMatchItem = importItemToMatchItem.get(childICoverage);
- if (childMatchItem.isMatch()) {
- throw new OseeStateException("unMatchedCoverageItems shouldn't contain matched items");
- }
-
- // Check for rename
- ICoverage packageMatch = isCoverageItemRenamed(packageItemChildren, childICoverage);
- if (packageMatch != null) {
- groupMergeItems.add(new MergeItem(MergeType.CI_Renamed, packageMatch, childICoverage, false));
- packageItemsProcessed.add(packageMatch);
- unMatchedImportCoverageItems.remove(childICoverage);
- }
-
- // Check for an add
- else if (isCoverageItemAdded(packageItemChildren, childICoverage)) {
- groupMergeItems.add(new MergeItem(MergeType.CI_Add, null, childICoverage, false));
- unMatchedImportCoverageItems.remove(childICoverage);
- }
- }
- for (ICoverage childICoverage : new CopyOnWriteArrayList<ICoverage>(matchedImportCoverageItems)) {
- MatchItem childMatchItem = importItemToMatchItem.get(childICoverage);
-
- // Check for method change
- if (childMatchItem != null && isCoverageItemMethodUpdate(childMatchItem)) {
- groupMergeItems.add(new MergeItem(MergeType.CI_Method_Update, childMatchItem.getPackageItem(),
- childICoverage, false));
- unMatchedImportCoverageItems.remove(childICoverage);
- }
- }
-
- // Check for moves in any items left unhandled by above renames and adds
- for (ICoverage childICoverage : new CopyOnWriteArrayList<ICoverage>(unMatchedImportCoverageItems)) {
- for (ICoverage packageItemChild : packageItemChildren) {
- // name equals package item not yet processed
- if (!packageItemsProcessed.contains(packageItemChild) && packageItemChild.getName().equals(
- childICoverage.getName())) {
- groupMergeItems.add(new MergeItem(MergeType.CI_Moved, packageItemChild, childICoverage, false));
- packageItemsProcessed.add(packageItemChild);
- unMatchedImportCoverageItems.add(childICoverage);
- }
- }
- }
-
- // Check for deletions
- for (ICoverage packageItemChild : packageItemChildren) {
- if (!packageItemsProcessed.contains(packageItemChild)) {
- groupMergeItems.add(new MergeItem(MergeType.CI_Delete, packageItemChild, null, false));
- packageItemsProcessed.add(packageItemChild);
- }
- }
-
- // Error on any remaining import CoverageItems
- for (ICoverage coverage : unMatchedImportCoverageItems) {
- groupMergeItems.add(new MergeItem(MergeType.Error__UnMergable, null, coverage, false));
- }
- // Error on any un-handled package CoverageItems
- for (ICoverage packageItemChild : packageItemChildren) {
- if (!packageItemsProcessed.contains(packageItemChild)) {
- groupMergeItems.add(new MergeItem(MergeType.Error__UnMergable, packageItemChild, null, false));
- }
- }
-
- if (groupMergeItems.size() > 0) {
- mergeItems.add(new MergeItemGroup(MergeType.CI_Changes, importCoverage, groupMergeItems, !unMergeableExists));
- }
-
- }
-
- private boolean isCoverageItemMethodUpdate(MatchItem childMatchItem) {
- ICoverage importItem = childMatchItem.getImportItem();
- ICoverage packageItem = childMatchItem.getPackageItem();
- // Only valid for coverage items
- if (!(importItem instanceof CoverageItem)) return false;
- if (!((CoverageItem) importItem).getCoverageMethod().equals(((CoverageItem) packageItem).getCoverageMethod())) {
- return true;
- }
- return false;
- }
-
- private boolean isCoverageItemAdded(Collection<? extends ICoverage> packageItemChildren, ICoverage importItemChild) {
- // Only valid for coverage items
- if (!(importItemChild instanceof CoverageItem)) return false;
- // Make sure there is no package item with same order number
- for (ICoverage packageItemChild : packageItemChildren) {
- if (packageItemChild.getOrderNumber().equals(importItemChild.getOrderNumber())) {
- return false;
- }
- }
- return true;
- }
-
- private ICoverage isCoverageItemRenamed(Collection<? extends ICoverage> packageItemChildren, ICoverage importItemChild) {
- // Only valid for coverage items
- if (!(importItemChild instanceof CoverageItem)) return null;
- // Make sure there is a package item with same order number
- ICoverage packageItemChild =
- CoverageUtil.getCoverageItemMatchingOrder(packageItemChildren, (CoverageItem) importItemChild);
- return packageItemChild;
- }
-
- private void handleSomeAddedSomeMoved(List<IMergeItem> mergeItems, Map<ICoverage, ICoverage> nameOnlyImportToPackageCoverage, Collection<? extends ICoverage> packageItemChildren, ICoverage importCoverage, Collection<? extends ICoverage> importItemChildren, Map<ICoverage, MatchItem> importItemToMatchItem, XResultData resultData) throws OseeCoreException {
- List<IMergeItem> groupMergeItems = new ArrayList<IMergeItem>();
- List<ICoverage> processChildrenItems = new ArrayList<ICoverage>();
- for (ICoverage childCoverage : importItemChildren) {
- MatchItem childMatchItem = importItemToMatchItem.get(childCoverage);
- // This child matches fully, just process children
- if (childMatchItem.getMatchType() == MatchType.Match__Name_And_Order_Num) {
- processChildrenItems.add(childCoverage);
- }
- // This child is moved, mark as modified; process children cause they existed before
- else if (nameOnlyImportToPackageCoverage.keySet().contains(childCoverage)) {
- groupMergeItems.add(new MergeItem(MergeType.Moved_Due_To_Add,
- nameOnlyImportToPackageCoverage.get(childMatchItem.getImportItem()), childMatchItem.getImportItem(),
- false));
- processedImportCoverages.add(childMatchItem.getImportItem());
- processChildrenItems.add(childCoverage);
- }
- // This child is new, mark as added; no need to process children cause their new
- else {
- groupMergeItems.add(new MergeItem(MergeType.Add, null, childMatchItem.getImportItem(), false));
- processedImportCoverages.add(childMatchItem.getImportItem());
- }
- }
- mergeItems.add(new MergeItemGroup(MergeType.Add_With_Moves, importCoverage, groupMergeItems, true));
- // Process children that should be processed
- for (ICoverage childCoverage : processChildrenItems) {
- processImportCoverage(childCoverage, mergeItems, resultData);
- }
-
- }
-
- private boolean isOnlyAddNewOnes(Map<ICoverage, ICoverage> nameOnlyImportToPackageCoverage, Collection<? extends ICoverage> packageItemChildren, Map<ICoverage, MatchItem> importItemToMatchItem) {
- // If no items match name-only then potential add
- if (nameOnlyImportToPackageCoverage.size() != 0) return false;
- // If any of the No_Match import order number match package number, than not an addOnly
- for (Entry<ICoverage, MatchItem> pair : importItemToMatchItem.entrySet()) {
- ICoverage importChild = pair.getKey();
- if (!Strings.isValid(importChild.getOrderNumber())) continue;
- if (pair.getValue().getMatchType() == MatchType.No_Match__Name_Or_Order_Num) {
- for (ICoverage packageItem : packageItemChildren) {
- if (packageItem.getOrderNumber().equals(importChild.getOrderNumber())) {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Only add new ones to end and process all children
- */
- private void handleOnlyAddNewOnes(List<IMergeItem> mergeItems, ICoverage importCoverage, Collection<? extends ICoverage> importItemChildren, Map<ICoverage, MatchItem> importItemToMatchItem, XResultData resultData) throws OseeCoreException {
- List<IMergeItem> groupMergeItems = new ArrayList<IMergeItem>();
- for (ICoverage childCoverage : importItemChildren) {
- MatchItem childMatchItem = importItemToMatchItem.get(childCoverage);
- // This child matches, just process children
- if (childMatchItem.getMatchType() == MatchType.Match__Name_And_Order_Num) {
- processImportCoverage(childCoverage, mergeItems, resultData);
- }
- // This child is new, mark as added; no need to process children cause their new
- if (childMatchItem.getMatchType() == MatchType.No_Match__Name_Or_Order_Num) {
- if (childMatchItem.getImportItem() instanceof CoverageItem) {
- groupMergeItems.add(new MergeItem(MergeType.Add, null, childMatchItem.getImportItem(), false));
- } else {
- mergeItems.add(new MergeItem(MergeType.Add, null, childMatchItem.getImportItem(), true));
- }
- processedImportCoverages.add(childMatchItem.getImportItem());
- }
- }
- if (groupMergeItems.size() > 0) {
- mergeItems.add(new MergeItemGroup(MergeType.Add, importCoverage, groupMergeItems, true));
- }
-
- }
-
- /**
- * If import has more all existing match and all new ones don't have same method number
- */
- private boolean isImportItemsAddedOrMoved(boolean moreImportChildrenThanPackageChildren, Map<ICoverage, MatchItem> importItemToMatchItem) {
- boolean result =
- moreImportChildrenThanPackageChildren && MatchItem.isAllMatchType(Arrays.asList(
- MatchType.Match__Name_And_Order_Num, MatchType.No_Match__Name_Or_Order_Num, MatchType.Match__Folder),
- importItemToMatchItem.values());
- return result;
- }
-
- /**
- * All same except package item has more; possible deletion, attempt to handle
- */
- private boolean isPackageItemDeleted(boolean morePackageChildrenThanImportChildren) {
- return morePackageChildrenThanImportChildren;
- }
-
- /**
- * Attempt to determine deleted package item
- */
- private void handlePackageItemDeleted(List<IMergeItem> mergeItems, ICoverage importCoverage, Collection<? extends ICoverage> packageItemChildren, Collection<? extends ICoverage> importItemChildren, XResultData resultData) {
- // If all import match package items, but there are more package items, delete package items
- List<IMergeItem> groupMergeItems = new ArrayList<IMergeItem>();
- boolean unmergeable = false;
- // Discover which packageItems don't have matches
- for (ICoverage packageItem : packageItemChildren) {
- Collection<ICoverage> matches = getNameMatchItems(packageItem, importItemChildren);
- // If matches > 1 can't perform merge
- if (matches.size() > 1) {
- // Case Else - unhandled cases
- unmergeable = true;
- mergeItems.add(new MergeItem(MergeType.Error__UnMergable, null, importCoverage, false));
- break;
- }
- // If matches == 0, this is a deletion
- else if (matches.isEmpty()) {
- groupMergeItems.add(new MergeItem(MergeType.Delete, packageItem, null, false));
- }
- // Else matches == 1, check the order; if different order, this is a Move_Due_To_Delete
- else {
- if (!packageItem.getOrderNumber().equals(matches.iterator().next().getOrderNumber())) {
- groupMergeItems.add(new MergeItem(MergeType.Moved_Due_To_Delete, packageItem, matches.iterator().next(),
- false));
- }
- }
- }
- if (!unmergeable) {
- mergeItems.add(new MergeItemGroup(MergeType.Delete_And_Reorder, importCoverage, groupMergeItems, true));
- }
- }
-
- /**
- * All match and package # children == import # children<br>
- * continue and check children's children
- */
- private boolean isAllMatchCase(boolean sameNumberChildren, Map<ICoverage, MatchItem> importItemToMatchItem) {
- return (sameNumberChildren && MatchItem.isAllMatchType(MatchType.FullMatches, importItemToMatchItem.values()));
- }
-
- /**
- * Continue and check children's children
- */
- private void handleAllMatchCase(List<IMergeItem> mergeItems, Collection<? extends ICoverage> importItemChildren, XResultData resultData) throws OseeCoreException {
- // process all children
- for (ICoverage childCoverage : importItemChildren) {
- processImportCoverage(childCoverage, mergeItems, resultData);
- }
- }
-
- private List<ICoverage> getNameMatchItems(ICoverage coverage, Collection<? extends ICoverage> toMatch) {
- List<ICoverage> matches = new ArrayList<ICoverage>();
- for (ICoverage item : toMatch) {
- if (item.getName().equals(coverage.getName())) {
- matches.add(item);
- }
- }
- return matches;
- }
-
- public MatchItem getPackageCoverageItem(ICoverage importItem) throws OseeStateException {
- return getPackageCoverageItem(coveragePackage, importItem);
- }
-
- /**
- * Recurse through coverage package to find importItem equivalent
- */
- public static MatchItem getPackageCoverageItem(CoveragePackageBase coveragePackageBase, ICoverage importItem) throws OseeStateException {
- for (ICoverage childCoverage : coveragePackageBase.getChildren(false)) {
- MatchItem matchItem = getPackageCoverageItemRecurse(childCoverage, importItem);
- if (matchItem.isMatch()) {
- return matchItem;
- }
- }
- return new MatchItem(MatchType.No_Match__Name_Or_Order_Num, null, importItem);
- }
-
- /**
- * Recurse through package item and children to find importItem equivalent
- */
- public static MatchItem getPackageCoverageItemRecurse(ICoverage packageItem, ICoverage importItem) throws OseeStateException {
- MatchType matchType = MatchType.getMatchType(packageItem, importItem);
- if (MatchType.isMatch(matchType)) {
- return new MatchItem(matchType, packageItem, importItem);
- }
- // Only check children if importItem should be child of packageItem by namespace
- if (importItem.getNamespace().startsWith(packageItem.getNamespace())) {
- for (ICoverage childPackageItem : packageItem.getChildren(false)) {
- MatchItem childMatchItem = getPackageCoverageItemRecurse(childPackageItem, importItem);
- if (childMatchItem != null && (MatchType.isMatch(childMatchItem.getMatchType()))) {
- return childMatchItem;
- }
- }
- }
- return new MatchItem(MatchType.No_Match__Name_Or_Order_Num, null, importItem);
- }
-
- public CoveragePackage getCoveragePackage() {
- return coveragePackage;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class MergeManager {
+ private final CoveragePackage coveragePackage;
+ private final CoverageImport coverageImport;
+ private Set<ICoverage> processedImportCoverages = new HashSet<ICoverage>(1000);
+
+ public MergeManager(CoveragePackage coveragePackage, CoverageImport coverageImport) {
+ this.coveragePackage = coveragePackage;
+ this.coverageImport = coverageImport;
+ }
+
+ public List<IMergeItem> getMergeItems() throws OseeCoreException {
+ List<IMergeItem> mergeItems = new ArrayList<IMergeItem>();
+ processedImportCoverages.clear();
+ for (ICoverage importCoverage : coverageImport.getChildren()) {
+ processImportCoverage(importCoverage, mergeItems, null);
+ }
+ if (mergeItems.isEmpty()) {
+ mergeItems.add(new MessageMergeItem("Nothing to Import"));
+ }
+ return mergeItems;
+ }
+
+ public XResultData getMergeDetails(ICoverage importCoverageItem, XResultData resultData) throws OseeCoreException {
+ List<IMergeItem> mergeItems = new ArrayList<IMergeItem>();
+ processImportCoverage(importCoverageItem, mergeItems, resultData);
+ return resultData;
+ }
+
+ private void processImportCoverage(ICoverage importCoverage, List<IMergeItem> mergeItems, XResultData resultData) throws OseeCoreException {
+ boolean debug = false;
+ if (debug) {
+ System.err.println("Merging check " + importCoverage);
+ }
+ if (resultData != null) {
+ resultData.log("\n\nMerging check " + importCoverage);
+ }
+
+ MatchItem matchItem = getPackageCoverageItem(importCoverage);
+ // No matching coverage package item, Add this and all children
+ if (MatchType.isNoMatch(matchItem.getMatchType())) {
+ if (!processedImportCoverages.contains(importCoverage)) {
+ mergeItems.add(new MergeItem(MergeType.Add, null, importCoverage, true));
+ }
+ }
+ // Import item matched Package item, check children
+ else {
+ ICoverage packageICoverage = matchItem.getPackageItem();
+ ICoverage importICoverage = matchItem.getImportItem();
+
+ Collection<? extends ICoverage> packageItemChildren = packageICoverage.getChildren();
+ Collection<? extends ICoverage> importItemChildren = importICoverage.getChildren();
+ Map<ICoverage, MatchItem> importItemToMatchItem = new HashMap<ICoverage, MatchItem>(10);
+ boolean moreImportChildrenThanPackageChildren = importItemChildren.size() > packageItemChildren.size();
+ boolean morePackageChildrenThanImportChildren = packageItemChildren.size() > importItemChildren.size();
+ boolean sameNumberChildren = importItemChildren.size() == packageItemChildren.size();
+ if (resultData != null) {
+ resultData.log(String.format("Num Import Items: %d - Num Package Items: %d", importItemChildren.size(),
+ packageItemChildren.size()));
+ resultData.log(AHTML.getLabelValueStr("moreImportChildrenThanPackageChildren",
+ String.valueOf(moreImportChildrenThanPackageChildren)));
+ resultData.log(AHTML.getLabelValueStr("morePackageChildrenThanImportChildren",
+ String.valueOf(morePackageChildrenThanImportChildren)));
+ resultData.log(AHTML.getLabelValueStr("sameNumberChildren", String.valueOf(sameNumberChildren)));
+
+ resultData.log(AHTML.bold("Package Children:"));
+ for (ICoverage coverage : packageItemChildren) {
+ resultData.addRaw(AHTML.blockQuote(String.valueOf(coverage).replaceAll(" ", "&nbsp")));
+ }
+ resultData.log(AHTML.bold("Import Children:"));
+ for (ICoverage coverage : importItemChildren) {
+ resultData.addRaw(AHTML.blockQuote(String.valueOf(coverage).replaceAll(" ", "&nbsp")));
+ }
+ }
+
+ if (debug) {
+ if (importCoverage.getGuid().equals("AAte3i2bH3L1MvsFMqAA")) {
+ System.out.println("here");
+ }
+ if (importCoverage.getName().equals("NavigationButton2.java")) {
+ System.out.println("here");
+ }
+ if (importCoverage.getName().equals("getImage")) {
+ System.out.println("here");
+ }
+ }
+
+ // Determine match for all import item children
+ for (ICoverage childCoverage : importItemChildren) {
+ MatchItem childMatchItem = getPackageCoverageItemRecurse(packageICoverage, childCoverage);
+ importItemToMatchItem.put(childCoverage, childMatchItem);
+ }
+
+ if (resultData != null) {
+ resultData.log(AHTML.bold("Match Items:"));
+ for (Entry<ICoverage, MatchItem> entry : importItemToMatchItem.entrySet()) {
+ resultData.addRaw(AHTML.blockQuote(String.valueOf(entry.getValue()).replaceAll(" ", "&nbsp")));
+ }
+ }
+ if (debug) {
+ for (Entry<ICoverage, MatchItem> entry : importItemToMatchItem.entrySet()) {
+ System.out.println(String.format("MatchItem[%s]", entry.getValue()));
+ }
+ }
+
+ // Case: All children all CoverageItems
+ // Action: process them separately
+ if (CoverageUtil.isAllCoverageItems(importItemChildren)) {
+ handleChildrenCoverageItems(mergeItems, packageItemChildren, importCoverage, importItemChildren,
+ importItemToMatchItem, resultData);
+ }
+
+ // Case: All match and package # children == import # children
+ // Action: continue and check children's children
+ else if (isAllMatchCase(sameNumberChildren, importItemToMatchItem)) {
+ handleAllMatchCase(mergeItems, importItemChildren, resultData);
+ }
+
+ // Case: All same except package item has more; possible deletion, attempt to handle
+ // Action: Attempt to determine deleted package item
+ else if (isPackageItemDeleted(morePackageChildrenThanImportChildren)) {
+ handlePackageItemDeleted(mergeItems, importCoverage, packageItemChildren, importItemChildren, resultData);
+ }
+
+ // Case: Import children all full match except Import has more that don't match, items added and moved
+ // Action: Process as Add / Move
+ else if (isImportItemsAddedOrMoved(moreImportChildrenThanPackageChildren, importItemToMatchItem)) {
+
+ // Determine number of No_Match items that are name-only match
+ Map<ICoverage, ICoverage> nameOnlyImportToPackageCoverage = new HashMap<ICoverage, ICoverage>();
+ for (Entry<ICoverage, MatchItem> pair : importItemToMatchItem.entrySet()) {
+ ICoverage importChild = pair.getKey();
+ if (pair.getValue().getMatchType() == MatchType.No_Match__Name_Or_Order_Num) {
+ // Try to find child that matches name
+ for (ICoverage packageChild : packageItemChildren) {
+ if (packageChild.getName().equals(importChild.getName())) {
+ nameOnlyImportToPackageCoverage.put(importChild, packageChild);
+ }
+ }
+ }
+ }
+
+ // Case: All match, some added, and none moved (name-only)
+ // Action: just add new ones and process all children
+ if (isOnlyAddNewOnes(nameOnlyImportToPackageCoverage, packageItemChildren, importItemToMatchItem)) {
+ handleOnlyAddNewOnes(mergeItems, importCoverage, importItemChildren, importItemToMatchItem, resultData);
+ }
+
+ // Case: All match, some added, and some moved
+ // Action: Process children of Matches; Add ones that were not Name-Only; Move ones that were
+ else {
+ handleSomeAddedSomeMoved(mergeItems, nameOnlyImportToPackageCoverage, packageItemChildren,
+ importCoverage, importItemChildren, importItemToMatchItem, resultData);
+ }
+
+ }
+ // Case: Unhandled
+ // Action: Mark as UnMergeable
+ else {
+ mergeItems.add(new MergeItem(MergeType.Error__UnMergable, null, importCoverage, false));
+ }
+ }
+ return;
+ }
+
+ private Entry<List<ICoverage>, List<ICoverage>> getMatchedAndUnMatchedImportCoverageItems(Map<ICoverage, MatchItem> importItemToMatchItem) throws OseeCoreException {
+ List<ICoverage> unMatchedCoverageItems = new ArrayList<ICoverage>();
+ List<ICoverage> matchedCoverageItems = new ArrayList<ICoverage>();
+ for (Entry<ICoverage, MatchItem> coverageToMatchItem : importItemToMatchItem.entrySet()) {
+ MatchItem childMatchItem = coverageToMatchItem.getValue();
+ ICoverage childICoverage = coverageToMatchItem.getKey();
+ if (!childMatchItem.isMatch()) {
+ unMatchedCoverageItems.add(childICoverage);
+ } else {
+ matchedCoverageItems.add(childICoverage);
+ }
+ }
+ return new SimpleEntry<List<ICoverage>, List<ICoverage>>(matchedCoverageItems, unMatchedCoverageItems);
+ }
+
+ private List<ICoverage> getMatchedPackageCoverageItems(Map<ICoverage, MatchItem> importItemToMatchItem) throws OseeCoreException {
+ List<ICoverage> matchedPackageCoverageItems = new ArrayList<ICoverage>();
+ for (Entry<ICoverage, MatchItem> coverageToMatchItem : importItemToMatchItem.entrySet()) {
+ MatchItem childMatchItem = coverageToMatchItem.getValue();
+ if (childMatchItem.isMatch()) {
+ matchedPackageCoverageItems.add(childMatchItem.getPackageItem());
+ }
+ }
+ return matchedPackageCoverageItems;
+ }
+
+ private void handleChildrenCoverageItems(List<IMergeItem> mergeItems, Collection<? extends ICoverage> packageItemChildren, ICoverage importCoverage, Collection<? extends ICoverage> importItemChildren, Map<ICoverage, MatchItem> importItemToMatchItem, XResultData resultData) throws OseeCoreException {
+ List<IMergeItem> groupMergeItems = new ArrayList<IMergeItem>();
+ boolean unMergeableExists = false;
+ Entry<List<ICoverage>, List<ICoverage>> matchedUnMatchedEntry =
+ getMatchedAndUnMatchedImportCoverageItems(importItemToMatchItem);
+ // Get all Import CoverageItems that do not match package CoverageItems
+ List<ICoverage> unMatchedImportCoverageItems = matchedUnMatchedEntry.getValue();
+ // Get all Import CoverageItems that DO match package CoverageItems
+ List<ICoverage> matchedImportCoverageItems = matchedUnMatchedEntry.getKey();
+ // List package coverageItems that have been processed; list should be empty at end
+ List<ICoverage> packageItemsProcessed = getMatchedPackageCoverageItems(importItemToMatchItem);
+
+ for (ICoverage childICoverage : new CopyOnWriteArrayList<ICoverage>(unMatchedImportCoverageItems)) {
+ MatchItem childMatchItem = importItemToMatchItem.get(childICoverage);
+ if (childMatchItem.isMatch()) {
+ throw new OseeStateException("unMatchedCoverageItems shouldn't contain matched items");
+ }
+
+ // Check for rename
+ ICoverage packageMatch = isCoverageItemRenamed(packageItemChildren, childICoverage);
+ if (packageMatch != null) {
+ groupMergeItems.add(new MergeItem(MergeType.CI_Renamed, packageMatch, childICoverage, false));
+ packageItemsProcessed.add(packageMatch);
+ unMatchedImportCoverageItems.remove(childICoverage);
+ }
+
+ // Check for an add
+ else if (isCoverageItemAdded(packageItemChildren, childICoverage)) {
+ groupMergeItems.add(new MergeItem(MergeType.CI_Add, null, childICoverage, false));
+ unMatchedImportCoverageItems.remove(childICoverage);
+ }
+ }
+ for (ICoverage childICoverage : new CopyOnWriteArrayList<ICoverage>(matchedImportCoverageItems)) {
+ MatchItem childMatchItem = importItemToMatchItem.get(childICoverage);
+
+ // Check for method change
+ if (childMatchItem != null && isCoverageItemMethodUpdate(childMatchItem)) {
+ groupMergeItems.add(new MergeItem(MergeType.CI_Method_Update, childMatchItem.getPackageItem(),
+ childICoverage, false));
+ unMatchedImportCoverageItems.remove(childICoverage);
+ }
+ }
+
+ // Check for moves in any items left unhandled by above renames and adds
+ for (ICoverage childICoverage : new CopyOnWriteArrayList<ICoverage>(unMatchedImportCoverageItems)) {
+ for (ICoverage packageItemChild : packageItemChildren) {
+ // name equals package item not yet processed
+ if (!packageItemsProcessed.contains(packageItemChild) && packageItemChild.getName().equals(
+ childICoverage.getName())) {
+ groupMergeItems.add(new MergeItem(MergeType.CI_Moved, packageItemChild, childICoverage, false));
+ packageItemsProcessed.add(packageItemChild);
+ unMatchedImportCoverageItems.add(childICoverage);
+ }
+ }
+ }
+
+ // Check for deletions
+ for (ICoverage packageItemChild : packageItemChildren) {
+ if (!packageItemsProcessed.contains(packageItemChild)) {
+ groupMergeItems.add(new MergeItem(MergeType.CI_Delete, packageItemChild, null, false));
+ packageItemsProcessed.add(packageItemChild);
+ }
+ }
+
+ // Error on any remaining import CoverageItems
+ for (ICoverage coverage : unMatchedImportCoverageItems) {
+ groupMergeItems.add(new MergeItem(MergeType.Error__UnMergable, null, coverage, false));
+ }
+ // Error on any un-handled package CoverageItems
+ for (ICoverage packageItemChild : packageItemChildren) {
+ if (!packageItemsProcessed.contains(packageItemChild)) {
+ groupMergeItems.add(new MergeItem(MergeType.Error__UnMergable, packageItemChild, null, false));
+ }
+ }
+
+ if (groupMergeItems.size() > 0) {
+ mergeItems.add(new MergeItemGroup(MergeType.CI_Changes, importCoverage, groupMergeItems, !unMergeableExists));
+ }
+
+ }
+
+ private boolean isCoverageItemMethodUpdate(MatchItem childMatchItem) {
+ ICoverage importItem = childMatchItem.getImportItem();
+ ICoverage packageItem = childMatchItem.getPackageItem();
+ // Only valid for coverage items
+ if (!(importItem instanceof CoverageItem)) return false;
+ if (!((CoverageItem) importItem).getCoverageMethod().equals(((CoverageItem) packageItem).getCoverageMethod())) {
+ return true;
+ }
+ return false;
+ }
+
+ private boolean isCoverageItemAdded(Collection<? extends ICoverage> packageItemChildren, ICoverage importItemChild) {
+ // Only valid for coverage items
+ if (!(importItemChild instanceof CoverageItem)) return false;
+ // Make sure there is no package item with same order number
+ for (ICoverage packageItemChild : packageItemChildren) {
+ if (packageItemChild.getOrderNumber().equals(importItemChild.getOrderNumber())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private ICoverage isCoverageItemRenamed(Collection<? extends ICoverage> packageItemChildren, ICoverage importItemChild) {
+ // Only valid for coverage items
+ if (!(importItemChild instanceof CoverageItem)) return null;
+ // Make sure there is a package item with same order number
+ ICoverage packageItemChild =
+ CoverageUtil.getCoverageItemMatchingOrder(packageItemChildren, (CoverageItem) importItemChild);
+ return packageItemChild;
+ }
+
+ private void handleSomeAddedSomeMoved(List<IMergeItem> mergeItems, Map<ICoverage, ICoverage> nameOnlyImportToPackageCoverage, Collection<? extends ICoverage> packageItemChildren, ICoverage importCoverage, Collection<? extends ICoverage> importItemChildren, Map<ICoverage, MatchItem> importItemToMatchItem, XResultData resultData) throws OseeCoreException {
+ List<IMergeItem> groupMergeItems = new ArrayList<IMergeItem>();
+ List<ICoverage> processChildrenItems = new ArrayList<ICoverage>();
+ for (ICoverage childCoverage : importItemChildren) {
+ MatchItem childMatchItem = importItemToMatchItem.get(childCoverage);
+ // This child matches fully, just process children
+ if (childMatchItem.getMatchType() == MatchType.Match__Name_And_Order_Num) {
+ processChildrenItems.add(childCoverage);
+ }
+ // This child is moved, mark as modified; process children cause they existed before
+ else if (nameOnlyImportToPackageCoverage.keySet().contains(childCoverage)) {
+ groupMergeItems.add(new MergeItem(MergeType.Moved_Due_To_Add,
+ nameOnlyImportToPackageCoverage.get(childMatchItem.getImportItem()), childMatchItem.getImportItem(),
+ false));
+ processedImportCoverages.add(childMatchItem.getImportItem());
+ processChildrenItems.add(childCoverage);
+ }
+ // This child is new, mark as added; no need to process children cause their new
+ else {
+ groupMergeItems.add(new MergeItem(MergeType.Add, null, childMatchItem.getImportItem(), false));
+ processedImportCoverages.add(childMatchItem.getImportItem());
+ }
+ }
+ mergeItems.add(new MergeItemGroup(MergeType.Add_With_Moves, importCoverage, groupMergeItems, true));
+ // Process children that should be processed
+ for (ICoverage childCoverage : processChildrenItems) {
+ processImportCoverage(childCoverage, mergeItems, resultData);
+ }
+
+ }
+
+ private boolean isOnlyAddNewOnes(Map<ICoverage, ICoverage> nameOnlyImportToPackageCoverage, Collection<? extends ICoverage> packageItemChildren, Map<ICoverage, MatchItem> importItemToMatchItem) {
+ // If no items match name-only then potential add
+ if (nameOnlyImportToPackageCoverage.size() != 0) return false;
+ // If any of the No_Match import order number match package number, than not an addOnly
+ for (Entry<ICoverage, MatchItem> pair : importItemToMatchItem.entrySet()) {
+ ICoverage importChild = pair.getKey();
+ if (!Strings.isValid(importChild.getOrderNumber())) continue;
+ if (pair.getValue().getMatchType() == MatchType.No_Match__Name_Or_Order_Num) {
+ for (ICoverage packageItem : packageItemChildren) {
+ if (packageItem.getOrderNumber().equals(importChild.getOrderNumber())) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Only add new ones to end and process all children
+ */
+ private void handleOnlyAddNewOnes(List<IMergeItem> mergeItems, ICoverage importCoverage, Collection<? extends ICoverage> importItemChildren, Map<ICoverage, MatchItem> importItemToMatchItem, XResultData resultData) throws OseeCoreException {
+ List<IMergeItem> groupMergeItems = new ArrayList<IMergeItem>();
+ for (ICoverage childCoverage : importItemChildren) {
+ MatchItem childMatchItem = importItemToMatchItem.get(childCoverage);
+ // This child matches, just process children
+ if (childMatchItem.getMatchType() == MatchType.Match__Name_And_Order_Num) {
+ processImportCoverage(childCoverage, mergeItems, resultData);
+ }
+ // This child is new, mark as added; no need to process children cause their new
+ if (childMatchItem.getMatchType() == MatchType.No_Match__Name_Or_Order_Num) {
+ if (childMatchItem.getImportItem() instanceof CoverageItem) {
+ groupMergeItems.add(new MergeItem(MergeType.Add, null, childMatchItem.getImportItem(), false));
+ } else {
+ mergeItems.add(new MergeItem(MergeType.Add, null, childMatchItem.getImportItem(), true));
+ }
+ processedImportCoverages.add(childMatchItem.getImportItem());
+ }
+ }
+ if (groupMergeItems.size() > 0) {
+ mergeItems.add(new MergeItemGroup(MergeType.Add, importCoverage, groupMergeItems, true));
+ }
+
+ }
+
+ /**
+ * If import has more all existing match and all new ones don't have same method number
+ */
+ private boolean isImportItemsAddedOrMoved(boolean moreImportChildrenThanPackageChildren, Map<ICoverage, MatchItem> importItemToMatchItem) {
+ boolean result =
+ moreImportChildrenThanPackageChildren && MatchItem.isAllMatchType(Arrays.asList(
+ MatchType.Match__Name_And_Order_Num, MatchType.No_Match__Name_Or_Order_Num, MatchType.Match__Folder),
+ importItemToMatchItem.values());
+ return result;
+ }
+
+ /**
+ * All same except package item has more; possible deletion, attempt to handle
+ */
+ private boolean isPackageItemDeleted(boolean morePackageChildrenThanImportChildren) {
+ return morePackageChildrenThanImportChildren;
+ }
+
+ /**
+ * Attempt to determine deleted package item
+ */
+ private void handlePackageItemDeleted(List<IMergeItem> mergeItems, ICoverage importCoverage, Collection<? extends ICoverage> packageItemChildren, Collection<? extends ICoverage> importItemChildren, XResultData resultData) {
+ // If all import match package items, but there are more package items, delete package items
+ List<IMergeItem> groupMergeItems = new ArrayList<IMergeItem>();
+ boolean unmergeable = false;
+ // Discover which packageItems don't have matches
+ for (ICoverage packageItem : packageItemChildren) {
+ Collection<ICoverage> matches = getNameMatchItems(packageItem, importItemChildren);
+ // If matches > 1 can't perform merge
+ if (matches.size() > 1) {
+ // Case Else - unhandled cases
+ unmergeable = true;
+ mergeItems.add(new MergeItem(MergeType.Error__UnMergable, null, importCoverage, false));
+ break;
+ }
+ // If matches == 0, this is a deletion
+ else if (matches.isEmpty()) {
+ groupMergeItems.add(new MergeItem(MergeType.Delete, packageItem, null, false));
+ }
+ // Else matches == 1, check the order; if different order, this is a Move_Due_To_Delete
+ else {
+ if (!packageItem.getOrderNumber().equals(matches.iterator().next().getOrderNumber())) {
+ groupMergeItems.add(new MergeItem(MergeType.Moved_Due_To_Delete, packageItem, matches.iterator().next(),
+ false));
+ }
+ }
+ }
+ if (!unmergeable) {
+ mergeItems.add(new MergeItemGroup(MergeType.Delete_And_Reorder, importCoverage, groupMergeItems, true));
+ }
+ }
+
+ /**
+ * All match and package # children == import # children<br>
+ * continue and check children's children
+ */
+ private boolean isAllMatchCase(boolean sameNumberChildren, Map<ICoverage, MatchItem> importItemToMatchItem) {
+ return (sameNumberChildren && MatchItem.isAllMatchType(MatchType.FullMatches, importItemToMatchItem.values()));
+ }
+
+ /**
+ * Continue and check children's children
+ */
+ private void handleAllMatchCase(List<IMergeItem> mergeItems, Collection<? extends ICoverage> importItemChildren, XResultData resultData) throws OseeCoreException {
+ // process all children
+ for (ICoverage childCoverage : importItemChildren) {
+ processImportCoverage(childCoverage, mergeItems, resultData);
+ }
+ }
+
+ private List<ICoverage> getNameMatchItems(ICoverage coverage, Collection<? extends ICoverage> toMatch) {
+ List<ICoverage> matches = new ArrayList<ICoverage>();
+ for (ICoverage item : toMatch) {
+ if (item.getName().equals(coverage.getName())) {
+ matches.add(item);
+ }
+ }
+ return matches;
+ }
+
+ public MatchItem getPackageCoverageItem(ICoverage importItem) throws OseeStateException {
+ return getPackageCoverageItem(coveragePackage, importItem);
+ }
+
+ /**
+ * Recurse through coverage package to find importItem equivalent
+ */
+ public static MatchItem getPackageCoverageItem(CoveragePackageBase coveragePackageBase, ICoverage importItem) throws OseeStateException {
+ for (ICoverage childCoverage : coveragePackageBase.getChildren(false)) {
+ MatchItem matchItem = getPackageCoverageItemRecurse(childCoverage, importItem);
+ if (matchItem.isMatch()) {
+ return matchItem;
+ }
+ }
+ return new MatchItem(MatchType.No_Match__Name_Or_Order_Num, null, importItem);
+ }
+
+ /**
+ * Recurse through package item and children to find importItem equivalent
+ */
+ public static MatchItem getPackageCoverageItemRecurse(ICoverage packageItem, ICoverage importItem) throws OseeStateException {
+ MatchType matchType = MatchType.getMatchType(packageItem, importItem);
+ if (MatchType.isMatch(matchType)) {
+ return new MatchItem(matchType, packageItem, importItem);
+ }
+ // Only check children if importItem should be child of packageItem by namespace
+ if (importItem.getNamespace().startsWith(packageItem.getNamespace())) {
+ for (ICoverage childPackageItem : packageItem.getChildren(false)) {
+ MatchItem childMatchItem = getPackageCoverageItemRecurse(childPackageItem, importItem);
+ if (childMatchItem != null && (MatchType.isMatch(childMatchItem.getMatchType()))) {
+ return childMatchItem;
+ }
+ }
+ }
+ return new MatchItem(MatchType.No_Match__Name_Or_Order_Num, null, importItem);
+ }
+
+ public CoveragePackage getCoveragePackage() {
+ return coveragePackage;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeType.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeType.java
index 04def7f0f3..bc2eb8a9e2 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeType.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeType.java
@@ -8,43 +8,43 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
-/**
- * @author Donald G. Dunne
- */
-public enum MergeType {
-
- // This will result in adding this and all children with all attributes
- Add,
- // This will result in adding this and all children with all attributes
- Add_With_Moves,
- // This will result in deleting this child and re-ordering
- Delete,
- // This will result in adding this and all children with all attributes
- CI_Add,
- // This will result in changing existing coverage method to new one imported
- CI_Method_Update,
- // This will result in deleting this child and re-ordering
- CI_Delete,
- // This will result in changing name of package to match import, clearing rationale and setting coverage method
- CI_Renamed,
- // This will result in changing name of package to match import, clearing rationale and setting coverage method
- CI_Moved,
- // Group option containing Add, Rename of coverage items
- CI_Changes,
- // Group option that contains deletions and re-order items
- Delete_And_Reorder,
- // Just update package item's order with import item's order
- Moved_Due_To_Delete,
- // This will result in updating the package item method number of the imported method number
- Moved_Due_To_Add,
- // Used to display "Nothing to Import" message
- Error__Message,
- // Shows that a item is un-mergeable and needs to be handled manually or have the merge case added
- Error__UnMergable;
-
- public boolean isError() {
- return toString().startsWith("Error__");
- }
-}
+package org.eclipse.osee.coverage.merge;
+
+/**
+ * @author Donald G. Dunne
+ */
+public enum MergeType {
+
+ // This will result in adding this and all children with all attributes
+ Add,
+ // This will result in adding this and all children with all attributes
+ Add_With_Moves,
+ // This will result in deleting this child and re-ordering
+ Delete,
+ // This will result in adding this and all children with all attributes
+ CI_Add,
+ // This will result in changing existing coverage method to new one imported
+ CI_Method_Update,
+ // This will result in deleting this child and re-ordering
+ CI_Delete,
+ // This will result in changing name of package to match import, clearing rationale and setting coverage method
+ CI_Renamed,
+ // This will result in changing name of package to match import, clearing rationale and setting coverage method
+ CI_Moved,
+ // Group option containing Add, Rename of coverage items
+ CI_Changes,
+ // Group option that contains deletions and re-order items
+ Delete_And_Reorder,
+ // Just update package item's order with import item's order
+ Moved_Due_To_Delete,
+ // This will result in updating the package item method number of the imported method number
+ Moved_Due_To_Add,
+ // Used to display "Nothing to Import" message
+ Error__Message,
+ // Shows that a item is un-mergeable and needs to be handled manually or have the merge case added
+ Error__UnMergable;
+
+ public boolean isError() {
+ return toString().startsWith("Error__");
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MessageMergeItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MessageMergeItem.java
index fee966541c..638dec7af3 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MessageMergeItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MessageMergeItem.java
@@ -8,37 +8,37 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.merge;
-
+package org.eclipse.osee.coverage.merge;
+
import java.util.Collection;
import java.util.Collections;
import org.eclipse.osee.coverage.model.ICoverage;
-
-/**
- * @author Donald G. Dunne
- */
-public class MessageMergeItem extends MergeItem {
-
- private final String message;
-
- public MessageMergeItem(String message) {
- super(MergeType.Error__Message, null, null, false);
- this.message = message;
- }
-
- @Override
- public String getName() {
- return message;
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren() {
- return Collections.emptyList();
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren(boolean recurse) {
- return Collections.emptyList();
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class MessageMergeItem extends MergeItem {
+
+ private final String message;
+
+ public MessageMergeItem(String message) {
+ super(MergeType.Error__Message, null, null, false);
+ this.message = message;
+ }
+
+ @Override
+ public String getName() {
+ return message;
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren(boolean recurse) {
+ return Collections.emptyList();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageImport.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageImport.java
index 2ee2d9b4fc..e07054a306 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageImport.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageImport.java
@@ -1,122 +1,122 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.artifact.KeyValueArtifact;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-
-/**
- * Single import of coverage information that includes
- *
- * @author Donald G. Dunne
- */
-public class CoverageImport extends CoveragePackageBase implements ICoverage {
-
- private Date runDate;
- private String location = "";
- private String blamName = "";
- private List<File> importRecordFiles = new ArrayList<File>();
- private String importDirectory = null;
-
- public CoverageImport(String name) {
- this(name, new Date());
- }
-
- public CoverageImport(String name, Date runDate) {
- super(name, CoverageOptionManagerDefault.instance());
- this.runDate = runDate;
- }
-
- public Date getRunDate() {
- return runDate;
- }
-
- public String getName() {
- return super.getName() + " - " + XDate.getDateStr(runDate, XDate.MMDDYYHHMM) + " - " + getCoverageItems().size() + " Coverage Items";
- }
-
- @Override
- public void getOverviewHtmlHeader(XResultData xResultData) {
- xResultData.log(AHTML.bold("Coverage Import for " + XDate.getDateStr(getRunDate(), XDate.HHMMSSSS)) + AHTML.newline());
- xResultData.log(AHTML.getLabelValueStr("Location", location));
- if (Strings.isValid(getBlamName())) {
- xResultData.log(AHTML.getLabelValueStr("Blam Name", getBlamName()));
- }
- xResultData.log(AHTML.getLabelValueStr("Run Date", XDate.getDateStr(getRunDate(), XDate.MMDDYYHHMM)));
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getBlamName() {
- return blamName;
- }
-
- public void setBlamName(String blamName) {
- this.blamName = blamName;
- }
-
- @Override
- public void loadKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException {
- if (Strings.isValid(keyValueArtifact.getValue("location"))) {
- setLocation(keyValueArtifact.getValue("location"));
- }
- if (Strings.isValid(keyValueArtifact.getValue("blamName"))) {
- setBlamName(keyValueArtifact.getValue("blamName"));
- }
- }
-
- @Override
- public void saveKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException {
- keyValueArtifact.setValue("location", location);
- keyValueArtifact.setValue("blamName", blamName);
- }
-
- public void setRunDate(Date runDate) {
- this.runDate = runDate;
- }
-
- @Override
- public Date getDate() {
- return getRunDate();
- }
-
- public void addImportRecordFile(File file) throws OseeArgumentException {
- if (!file.exists()) throw new OseeArgumentException(String.format("Import Record file [%s] doesn't exist.", file));
- importRecordFiles.add(file);
- }
-
- public List<File> getImportRecordFiles() {
- return importRecordFiles;
- }
-
- public String getImportDirectory() {
- return importDirectory;
- }
-
- public void setImportDirectory(String importDirectory) {
- this.importDirectory = importDirectory;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.model;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.artifact.KeyValueArtifact;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+
+/**
+ * Single import of coverage information that includes
+ *
+ * @author Donald G. Dunne
+ */
+public class CoverageImport extends CoveragePackageBase implements ICoverage {
+
+ private Date runDate;
+ private String location = "";
+ private String blamName = "";
+ private List<File> importRecordFiles = new ArrayList<File>();
+ private String importDirectory = null;
+
+ public CoverageImport(String name) {
+ this(name, new Date());
+ }
+
+ public CoverageImport(String name, Date runDate) {
+ super(name, CoverageOptionManagerDefault.instance());
+ this.runDate = runDate;
+ }
+
+ public Date getRunDate() {
+ return runDate;
+ }
+
+ public String getName() {
+ return super.getName() + " - " + XDate.getDateStr(runDate, XDate.MMDDYYHHMM) + " - " + getCoverageItems().size() + " Coverage Items";
+ }
+
+ @Override
+ public void getOverviewHtmlHeader(XResultData xResultData) {
+ xResultData.log(AHTML.bold("Coverage Import for " + XDate.getDateStr(getRunDate(), XDate.HHMMSSSS)) + AHTML.newline());
+ xResultData.log(AHTML.getLabelValueStr("Location", location));
+ if (Strings.isValid(getBlamName())) {
+ xResultData.log(AHTML.getLabelValueStr("Blam Name", getBlamName()));
+ }
+ xResultData.log(AHTML.getLabelValueStr("Run Date", XDate.getDateStr(getRunDate(), XDate.MMDDYYHHMM)));
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getBlamName() {
+ return blamName;
+ }
+
+ public void setBlamName(String blamName) {
+ this.blamName = blamName;
+ }
+
+ @Override
+ public void loadKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException {
+ if (Strings.isValid(keyValueArtifact.getValue("location"))) {
+ setLocation(keyValueArtifact.getValue("location"));
+ }
+ if (Strings.isValid(keyValueArtifact.getValue("blamName"))) {
+ setBlamName(keyValueArtifact.getValue("blamName"));
+ }
+ }
+
+ @Override
+ public void saveKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException {
+ keyValueArtifact.setValue("location", location);
+ keyValueArtifact.setValue("blamName", blamName);
+ }
+
+ public void setRunDate(Date runDate) {
+ this.runDate = runDate;
+ }
+
+ @Override
+ public Date getDate() {
+ return getRunDate();
+ }
+
+ public void addImportRecordFile(File file) throws OseeArgumentException {
+ if (!file.exists()) throw new OseeArgumentException(String.format("Import Record file [%s] doesn't exist.", file));
+ importRecordFiles.add(file);
+ }
+
+ public List<File> getImportRecordFiles() {
+ return importRecordFiles;
+ }
+
+ public String getImportDirectory() {
+ return importDirectory;
+ }
+
+ public void setImportDirectory(String importDirectory) {
+ this.importDirectory = importDirectory;
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
index 5d132315a8..61a119be20 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
@@ -1,338 +1,338 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.coverage.util.CoverageImage;
-import org.eclipse.osee.coverage.util.CoverageUtil;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageItem implements ICoverage {
-
- CoverageOption coverageMethod = CoverageOptionManager.Not_Covered;
- String rationale;
- String orderNumber;
- String name;
- private final CoverageUnit coverageUnit;
- String guid = GUID.create();
- private static String PROPERTY_STORE_ID = "coverage.item";
- private ITestUnitProvider testUnitProvider;
-
- public CoverageItem(CoverageUnit coverageUnit, CoverageOption coverageMethod, String orderNumber) {
- super();
- this.coverageUnit = coverageUnit;
- this.coverageMethod = coverageMethod;
- this.orderNumber = orderNumber;
- if (coverageUnit != null) {
- ((ICoverageItemProvider) coverageUnit).addCoverageItem(this);
- }
- }
-
- public CoverageItem(CoverageUnit parentCoverageUnit, String xml, CoverageOptionManager coverageOptionManager, ITestUnitProvider testUnitProvider) throws OseeCoreException {
- this(parentCoverageUnit, CoverageOptionManager.Not_Covered, "0");
- this.testUnitProvider = testUnitProvider;
- fromXml(xml, coverageOptionManager);
- }
-
- /**
- * Copies the coverage unit. Does not copy test units.
- */
- public CoverageItem copy(CoverageUnit parent) throws OseeCoreException {
- CoverageItem coverageitem = new CoverageItem(parent, coverageMethod, orderNumber);
- coverageitem.setGuid(guid);
- coverageitem.setName(name);
- coverageitem.setOrderNumber(orderNumber);
- coverageitem.setRationale(rationale);
- coverageitem.setTestUnitProvider(testUnitProvider);
- return coverageitem;
- }
-
- public Collection<String> getTestUnits() throws OseeCoreException {
- if (testUnitProvider == null) {
- return java.util.Collections.emptyList();
- }
- return testUnitProvider.getTestUnits(this);
- }
-
- public void addTestUnitName(String testUnitName) throws OseeCoreException {
- if (testUnitProvider == null) {
- testUnitProvider = new SimpleTestUnitProvider();
- }
- testUnitProvider.addTestUnit(this, testUnitName);
- }
-
- public void setTestUnits(Collection<String> testUnitNames) throws OseeCoreException {
- if (testUnitProvider == null) {
- return;
- }
- testUnitProvider.setTestUnits(this, testUnitNames);
- }
-
- public CoverageOption getCoverageMethod() {
- return coverageMethod;
- }
-
- public void setCoverageMethod(CoverageOption coverageMethod) {
- this.coverageMethod = coverageMethod;
- }
-
- public CoverageUnit getCoverageUnit() {
- return coverageUnit;
- }
-
- @Override
- public String toString() {
- return String.format("[Item : [%s][M: %s][E: %s][%s][Name: %s][Path: %s]]", getCoverageMethod(),
- getCoverageUnit().getOrderNumber(), getOrderNumber(), getGuid(), getName(), CoverageUtil.getFullPath(this));
- }
-
- @Override
- public Result isEditable() {
- return Result.FalseResult;
- }
-
- public String getNameFull() {
- return String.format("%s:%s [%s]", getCoverageUnit().getOrderNumber(), orderNumber, name);
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public KeyedImage getOseeImage() {
- if (isCovered()) {
- return CoverageImage.ITEM_GREEN;
- }
- return CoverageImage.ITEM_RED;
- }
-
- @Override
- public boolean isCovered() {
- return !getCoverageMethod().getName().equals(CoverageOptionManager.Not_Covered.getName());
- }
-
- public String getGuid() {
- return guid;
- }
-
- @Override
- public ICoverage getParent() {
- return coverageUnit;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getTestUnitNames(Collection<CoverageTestUnit> testUnits) {
- List<String> guids = new ArrayList<String>();
- for (CoverageTestUnit testUnit : testUnits) {
- guids.add(testUnit.getGuid());
- }
- return Collections.toString(guids, ",");
- }
-
- public String getRationale() {
- return rationale;
- }
-
- public void setRationale(String rationale) {
- this.rationale = rationale;
- }
-
- public String getFileContents() throws OseeCoreException {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String getLocation() {
- return "";
- }
-
- @Override
- public String getNamespace() {
- if (getParent() != null && Strings.isValid(getParent().getNamespace())) {
- return getParent().getNamespace();
- }
- return "";
- }
-
- @Override
- public boolean isAssignable() {
- return false;
- }
-
- @Override
- public String getAssignees() throws OseeCoreException {
- return "";
- }
-
- @Override
- public String getNotes() {
- return null;
- }
-
- @Override
- public Double getCoveragePercent() {
- return isCovered() ? 100.0 : 0.0;
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren() {
- return java.util.Collections.emptyList();
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren(boolean recurse) {
- return java.util.Collections.emptyList();
- }
-
- @Override
- public String getCoveragePercentStr() {
- return isCovered() ? "100" : "0";
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public String getOrderNumber() {
- return orderNumber;
- }
-
- public void setOrderNumber(String orderNumber) {
- this.orderNumber = Strings.intern(orderNumber);
- }
-
- /**
- * Provide test unit provider. SimpleTestUnitProvider will be used by default.
- */
- public void setTestUnitProvider(ITestUnitProvider testUnitProvider) {
- this.testUnitProvider = testUnitProvider;
- }
-
- public void fromXml(String xml, CoverageOptionManager coverageOptionManager) throws OseeCoreException {
- PropertyStore store = new PropertyStore();
- // PropertyStoreRegEx store = new PropertyStoreRegEx();
- try {
- store.load(xml);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- if (!store.getId().equals(PROPERTY_STORE_ID)) {
- throw new OseeArgumentException(String.format("Invalid store id [%s] for CoverageItem", store.getId()));
- }
- setCoverageMethod(coverageOptionManager.get(store.get("methodType")));
- if (Strings.isValid(store.get("order"))) {
- setOrderNumber(store.get("order"));
- }
- setGuid(store.get("guid"));
- if (Strings.isValid(store.get("name"))) {
- setName(store.get("name"));
- }
- if (Strings.isValid(store.get("rationale"))) {
- setRationale(store.get("rationale"));
- }
- if (testUnitProvider == null) {
- testUnitProvider = new SimpleTestUnitProvider();
- }
- String testUnitsStr = store.get("testUnits");
- if (Strings.isValid(testUnitsStr)) {
- testUnitProvider.fromXml(this, testUnitsStr);
- }
- }
-
- public String toXml() throws OseeCoreException {
- return toXml(testUnitProvider);
- }
-
- public String toXml(ITestUnitProvider testUnitProvider) throws OseeCoreException {
- PropertyStore store = new PropertyStore(PROPERTY_STORE_ID);
- store.put("guid", guid);
- if (Strings.isValid(getRationale())) {
- store.put("rationale", rationale);
- }
- if (Strings.isValid(orderNumber)) {
- store.put("order", orderNumber);
- }
- store.put("methodType", coverageMethod.getName());
- if (testUnitProvider != null) {
- if (Strings.isValid(testUnitProvider.toXml(this))) {
- store.put("testUnits", testUnitProvider.toXml(this));
- }
- }
- if (Strings.isValid(name)) {
- store.put("name", name);
- }
- String toReturn = null;
- try {
- toReturn = store.save();
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return toReturn;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (guid == null ? 0 : guid.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- CoverageItem other = (CoverageItem) obj;
- if (guid == null) {
- if (other.guid != null) {
- return false;
- }
- } else if (!guid.equals(other.guid)) {
- return false;
- }
- return true;
- }
-
- public ITestUnitProvider getTestUnitProvider() {
- return testUnitProvider;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.coverage.util.CoverageImage;
+import org.eclipse.osee.coverage.util.CoverageUtil;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageItem implements ICoverage {
+
+ CoverageOption coverageMethod = CoverageOptionManager.Not_Covered;
+ String rationale;
+ String orderNumber;
+ String name;
+ private final CoverageUnit coverageUnit;
+ String guid = GUID.create();
+ private static String PROPERTY_STORE_ID = "coverage.item";
+ private ITestUnitProvider testUnitProvider;
+
+ public CoverageItem(CoverageUnit coverageUnit, CoverageOption coverageMethod, String orderNumber) {
+ super();
+ this.coverageUnit = coverageUnit;
+ this.coverageMethod = coverageMethod;
+ this.orderNumber = orderNumber;
+ if (coverageUnit != null) {
+ ((ICoverageItemProvider) coverageUnit).addCoverageItem(this);
+ }
+ }
+
+ public CoverageItem(CoverageUnit parentCoverageUnit, String xml, CoverageOptionManager coverageOptionManager, ITestUnitProvider testUnitProvider) throws OseeCoreException {
+ this(parentCoverageUnit, CoverageOptionManager.Not_Covered, "0");
+ this.testUnitProvider = testUnitProvider;
+ fromXml(xml, coverageOptionManager);
+ }
+
+ /**
+ * Copies the coverage unit. Does not copy test units.
+ */
+ public CoverageItem copy(CoverageUnit parent) throws OseeCoreException {
+ CoverageItem coverageitem = new CoverageItem(parent, coverageMethod, orderNumber);
+ coverageitem.setGuid(guid);
+ coverageitem.setName(name);
+ coverageitem.setOrderNumber(orderNumber);
+ coverageitem.setRationale(rationale);
+ coverageitem.setTestUnitProvider(testUnitProvider);
+ return coverageitem;
+ }
+
+ public Collection<String> getTestUnits() throws OseeCoreException {
+ if (testUnitProvider == null) {
+ return java.util.Collections.emptyList();
+ }
+ return testUnitProvider.getTestUnits(this);
+ }
+
+ public void addTestUnitName(String testUnitName) throws OseeCoreException {
+ if (testUnitProvider == null) {
+ testUnitProvider = new SimpleTestUnitProvider();
+ }
+ testUnitProvider.addTestUnit(this, testUnitName);
+ }
+
+ public void setTestUnits(Collection<String> testUnitNames) throws OseeCoreException {
+ if (testUnitProvider == null) {
+ return;
+ }
+ testUnitProvider.setTestUnits(this, testUnitNames);
+ }
+
+ public CoverageOption getCoverageMethod() {
+ return coverageMethod;
+ }
+
+ public void setCoverageMethod(CoverageOption coverageMethod) {
+ this.coverageMethod = coverageMethod;
+ }
+
+ public CoverageUnit getCoverageUnit() {
+ return coverageUnit;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("[Item : [%s][M: %s][E: %s][%s][Name: %s][Path: %s]]", getCoverageMethod(),
+ getCoverageUnit().getOrderNumber(), getOrderNumber(), getGuid(), getName(), CoverageUtil.getFullPath(this));
+ }
+
+ @Override
+ public Result isEditable() {
+ return Result.FalseResult;
+ }
+
+ public String getNameFull() {
+ return String.format("%s:%s [%s]", getCoverageUnit().getOrderNumber(), orderNumber, name);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public KeyedImage getOseeImage() {
+ if (isCovered()) {
+ return CoverageImage.ITEM_GREEN;
+ }
+ return CoverageImage.ITEM_RED;
+ }
+
+ @Override
+ public boolean isCovered() {
+ return !getCoverageMethod().getName().equals(CoverageOptionManager.Not_Covered.getName());
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ @Override
+ public ICoverage getParent() {
+ return coverageUnit;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public String getTestUnitNames(Collection<CoverageTestUnit> testUnits) {
+ List<String> guids = new ArrayList<String>();
+ for (CoverageTestUnit testUnit : testUnits) {
+ guids.add(testUnit.getGuid());
+ }
+ return Collections.toString(guids, ",");
+ }
+
+ public String getRationale() {
+ return rationale;
+ }
+
+ public void setRationale(String rationale) {
+ this.rationale = rationale;
+ }
+
+ public String getFileContents() throws OseeCoreException {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getLocation() {
+ return "";
+ }
+
+ @Override
+ public String getNamespace() {
+ if (getParent() != null && Strings.isValid(getParent().getNamespace())) {
+ return getParent().getNamespace();
+ }
+ return "";
+ }
+
+ @Override
+ public boolean isAssignable() {
+ return false;
+ }
+
+ @Override
+ public String getAssignees() throws OseeCoreException {
+ return "";
+ }
+
+ @Override
+ public String getNotes() {
+ return null;
+ }
+
+ @Override
+ public Double getCoveragePercent() {
+ return isCovered() ? 100.0 : 0.0;
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren() {
+ return java.util.Collections.emptyList();
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren(boolean recurse) {
+ return java.util.Collections.emptyList();
+ }
+
+ @Override
+ public String getCoveragePercentStr() {
+ return isCovered() ? "100" : "0";
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public String getOrderNumber() {
+ return orderNumber;
+ }
+
+ public void setOrderNumber(String orderNumber) {
+ this.orderNumber = Strings.intern(orderNumber);
+ }
+
+ /**
+ * Provide test unit provider. SimpleTestUnitProvider will be used by default.
+ */
+ public void setTestUnitProvider(ITestUnitProvider testUnitProvider) {
+ this.testUnitProvider = testUnitProvider;
+ }
+
+ public void fromXml(String xml, CoverageOptionManager coverageOptionManager) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ // PropertyStoreRegEx store = new PropertyStoreRegEx();
+ try {
+ store.load(xml);
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ if (!store.getId().equals(PROPERTY_STORE_ID)) {
+ throw new OseeArgumentException(String.format("Invalid store id [%s] for CoverageItem", store.getId()));
+ }
+ setCoverageMethod(coverageOptionManager.get(store.get("methodType")));
+ if (Strings.isValid(store.get("order"))) {
+ setOrderNumber(store.get("order"));
+ }
+ setGuid(store.get("guid"));
+ if (Strings.isValid(store.get("name"))) {
+ setName(store.get("name"));
+ }
+ if (Strings.isValid(store.get("rationale"))) {
+ setRationale(store.get("rationale"));
+ }
+ if (testUnitProvider == null) {
+ testUnitProvider = new SimpleTestUnitProvider();
+ }
+ String testUnitsStr = store.get("testUnits");
+ if (Strings.isValid(testUnitsStr)) {
+ testUnitProvider.fromXml(this, testUnitsStr);
+ }
+ }
+
+ public String toXml() throws OseeCoreException {
+ return toXml(testUnitProvider);
+ }
+
+ public String toXml(ITestUnitProvider testUnitProvider) throws OseeCoreException {
+ PropertyStore store = new PropertyStore(PROPERTY_STORE_ID);
+ store.put("guid", guid);
+ if (Strings.isValid(getRationale())) {
+ store.put("rationale", rationale);
+ }
+ if (Strings.isValid(orderNumber)) {
+ store.put("order", orderNumber);
+ }
+ store.put("methodType", coverageMethod.getName());
+ if (testUnitProvider != null) {
+ if (Strings.isValid(testUnitProvider.toXml(this))) {
+ store.put("testUnits", testUnitProvider.toXml(this));
+ }
+ }
+ if (Strings.isValid(name)) {
+ store.put("name", name);
+ }
+ String toReturn = null;
+ try {
+ toReturn = store.save();
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return toReturn;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (guid == null ? 0 : guid.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CoverageItem other = (CoverageItem) obj;
+ if (guid == null) {
+ if (other.guid != null) {
+ return false;
+ }
+ } else if (!guid.equals(other.guid)) {
+ return false;
+ }
+ return true;
+ }
+
+ public ITestUnitProvider getTestUnitProvider() {
+ return testUnitProvider;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOption.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOption.java
index 4d7c65bb79..dcb5b720e3 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOption.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOption.java
@@ -8,87 +8,87 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageOption {
-
- public String name;
- public String description;
- public boolean enabled;
- public static String TAG = "CvgOpt";
-
- public CoverageOption(String name, String description, boolean enabled) {
- this.name = name;
- this.description = description;
- this.enabled = enabled;
- }
-
- public CoverageOption(String name, String description) {
- this(name, description, true);
- }
-
- public CoverageOption(String name) {
- this(name, "", true);
- }
-
- public String getName() {
- return name;
- }
-
- public String getNameDesc() {
- if (Strings.isValid(description)) {
- return String.format("%s - %s", name, description);
- }
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public String toString() {
- return String.format("[%s-%s]", name, enabled);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
- CoverageOption other = (CoverageOption) obj;
- if (name == null) {
- if (other.name != null) return false;
- } else if (!name.equals(other.name)) return false;
- return true;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageOption {
+
+ public String name;
+ public String description;
+ public boolean enabled;
+ public static String TAG = "CvgOpt";
+
+ public CoverageOption(String name, String description, boolean enabled) {
+ this.name = name;
+ this.description = description;
+ this.enabled = enabled;
+ }
+
+ public CoverageOption(String name, String description) {
+ this(name, description, true);
+ }
+
+ public CoverageOption(String name) {
+ this(name, "", true);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getNameDesc() {
+ if (Strings.isValid(description)) {
+ return String.format("%s - %s", name, description);
+ }
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String toString() {
+ return String.format("[%s-%s]", name, enabled);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ CoverageOption other = (CoverageOption) obj;
+ if (name == null) {
+ if (other.name != null) return false;
+ } else if (!name.equals(other.name)) return false;
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManager.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManager.java
index 549660c3e9..4b3503b5ec 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManager.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManager.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -23,99 +23,99 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageOptionManager {
- private static String MGR_TAG = "options";
- private static String ITEM_TAG = "option";
-
- public List<CoverageOption> options;
- public static CoverageOption Deactivated_Code = new CoverageOption("Deactivated_Code");
- public static CoverageOption Dead_Code = new CoverageOption("Dead_Code");
- public static CoverageOption Exception_Handling = new CoverageOption("Exception_Handling");
- public static CoverageOption Test_Unit = new CoverageOption("Test_Unit");
- public static CoverageOption Not_Covered = new CoverageOption("Not_Covered");
-
- public CoverageOptionManager(List<CoverageOption> options) {
- this.options = options;
- }
-
- public CoverageOptionManager() {
- this.options = new ArrayList<CoverageOption>();
- }
-
- public CoverageOptionManager(String xml) {
- fromXml(xml);
- }
-
- public Collection<CoverageOption> getEnabled() {
- List<CoverageOption> enabled = new ArrayList<CoverageOption>();
- for (CoverageOption option : options) {
- if (option.isEnabled()) {
- enabled.add(option);
- }
- }
- return enabled;
- }
-
- public void add(CoverageOption coverageOption) throws OseeArgumentException {
- if (get(coverageOption.getName()) != null) throw new OseeArgumentException(String.format(
- "Option with name [%s] already exists", coverageOption.getName()));
- options.add(coverageOption);
- }
-
- public CoverageOption get(String name) {
- for (CoverageOption option : options) {
- if (option.getName().equals(name)) {
- return option;
- }
- }
- return null;
- }
-
- public void fromXml(String xml) {
- if (options == null) {
- options = new ArrayList<CoverageOption>();
- } else {
- options.clear();
- }
- if (Strings.isValid(xml)) {
- NodeList nodes;
- try {
- nodes = Jaxp.readXmlDocument(xml).getElementsByTagName(ITEM_TAG);
- for (int i = 0; i < nodes.getLength(); i++) {
- Element element = (Element) nodes.item(i);
- options.add(new CoverageOption(element.getAttribute("name"), element.getAttribute("desc"),
- element.getAttribute("enabled").equals("true")));
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex);
- }
- }
- }
-
- public String toXml() {
- try {
- Document doc = Jaxp.newDocument();
- Element rootElement = doc.createElement(MGR_TAG);
- doc.appendChild(rootElement);
- for (CoverageOption item : options) {
- Element element = doc.createElement(ITEM_TAG);
- element.setAttribute("name", item.getName());
- element.setAttribute("enabled", String.valueOf(item.isEnabled()));
- element.setAttribute("desc", item.getDescription());
- rootElement.appendChild(element);
- }
- return Jaxp.getDocumentXml(doc);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Can't create coverage options document", ex);
- }
- return null;
- }
-
- public List<CoverageOption> get() {
- return options;
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageOptionManager {
+ private static String MGR_TAG = "options";
+ private static String ITEM_TAG = "option";
+
+ public List<CoverageOption> options;
+ public static CoverageOption Deactivated_Code = new CoverageOption("Deactivated_Code");
+ public static CoverageOption Dead_Code = new CoverageOption("Dead_Code");
+ public static CoverageOption Exception_Handling = new CoverageOption("Exception_Handling");
+ public static CoverageOption Test_Unit = new CoverageOption("Test_Unit");
+ public static CoverageOption Not_Covered = new CoverageOption("Not_Covered");
+
+ public CoverageOptionManager(List<CoverageOption> options) {
+ this.options = options;
+ }
+
+ public CoverageOptionManager() {
+ this.options = new ArrayList<CoverageOption>();
+ }
+
+ public CoverageOptionManager(String xml) {
+ fromXml(xml);
+ }
+
+ public Collection<CoverageOption> getEnabled() {
+ List<CoverageOption> enabled = new ArrayList<CoverageOption>();
+ for (CoverageOption option : options) {
+ if (option.isEnabled()) {
+ enabled.add(option);
+ }
+ }
+ return enabled;
+ }
+
+ public void add(CoverageOption coverageOption) throws OseeArgumentException {
+ if (get(coverageOption.getName()) != null) throw new OseeArgumentException(String.format(
+ "Option with name [%s] already exists", coverageOption.getName()));
+ options.add(coverageOption);
+ }
+
+ public CoverageOption get(String name) {
+ for (CoverageOption option : options) {
+ if (option.getName().equals(name)) {
+ return option;
+ }
+ }
+ return null;
+ }
+
+ public void fromXml(String xml) {
+ if (options == null) {
+ options = new ArrayList<CoverageOption>();
+ } else {
+ options.clear();
+ }
+ if (Strings.isValid(xml)) {
+ NodeList nodes;
+ try {
+ nodes = Jaxp.readXmlDocument(xml).getElementsByTagName(ITEM_TAG);
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Element element = (Element) nodes.item(i);
+ options.add(new CoverageOption(element.getAttribute("name"), element.getAttribute("desc"),
+ element.getAttribute("enabled").equals("true")));
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex);
+ }
+ }
+ }
+
+ public String toXml() {
+ try {
+ Document doc = Jaxp.newDocument();
+ Element rootElement = doc.createElement(MGR_TAG);
+ doc.appendChild(rootElement);
+ for (CoverageOption item : options) {
+ Element element = doc.createElement(ITEM_TAG);
+ element.setAttribute("name", item.getName());
+ element.setAttribute("enabled", String.valueOf(item.isEnabled()));
+ element.setAttribute("desc", item.getDescription());
+ rootElement.appendChild(element);
+ }
+ return Jaxp.getDocumentXml(doc);
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Can't create coverage options document", ex);
+ }
+ return null;
+ }
+
+ public List<CoverageOption> get() {
+ return options;
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManagerDefault.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManagerDefault.java
index e7ce20f09a..99a393ec24 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManagerDefault.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageOptionManagerDefault.java
@@ -8,32 +8,32 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.Arrays;
import java.util.List;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageOptionManagerDefault extends CoverageOptionManager {
-
- public static List<CoverageOption> defaultOptions =
- Arrays.asList(Deactivated_Code, Dead_Code, Exception_Handling, Test_Unit, Not_Covered);
- private static CoverageOptionManagerDefault instance = new CoverageOptionManagerDefault();
-
- private CoverageOptionManagerDefault() {
- super(defaultOptions);
- }
-
- public static CoverageOptionManagerDefault instance() {
- return instance;
- }
-
- @Override
- public void add(CoverageOption coverageOption) throws OseeArgumentException {
- throw new OseeArgumentException("Not supported for CoverageOptionManagerDefault");
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageOptionManagerDefault extends CoverageOptionManager {
+
+ public static List<CoverageOption> defaultOptions =
+ Arrays.asList(Deactivated_Code, Dead_Code, Exception_Handling, Test_Unit, Not_Covered);
+ private static CoverageOptionManagerDefault instance = new CoverageOptionManagerDefault();
+
+ private CoverageOptionManagerDefault() {
+ super(defaultOptions);
+ }
+
+ public static CoverageOptionManagerDefault instance() {
+ return instance;
+ }
+
+ @Override
+ public void add(CoverageOption coverageOption) throws OseeArgumentException {
+ throw new OseeArgumentException("Not supported for CoverageOptionManagerDefault");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackage.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackage.java
index eda4a3d1f8..b4d617badd 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackage.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackage.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
-import java.util.Date;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.artifact.KeyValueArtifact;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-
-public class CoveragePackage extends CoveragePackageBase implements ICoverage {
-
- Date creationDate;
-
- public CoveragePackage(String name, CoverageOptionManager coverageOptionManager) {
- this(name, new Date(), coverageOptionManager);
- }
-
- public CoveragePackage(String name, Date runDate, CoverageOptionManager coverageOptionManager) {
- super(name, coverageOptionManager);
- this.creationDate = runDate;
- }
-
- public void clearCoverageUnits() {
- coverageUnits.clear();
- }
-
- public Date getRunDate() {
- return creationDate;
- }
-
- @Override
- public void getOverviewHtmlHeader(XResultData xResultData) {
- xResultData.log(AHTML.bold("Coverage Package " + getName() + " as of " + XDate.getDateStr(new Date(),
- XDate.MMDDYYHHMM)) + AHTML.newline());
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- @Override
- public void saveKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException {
- keyValueArtifact.setValue("date", String.valueOf(creationDate.getTime()));
- }
-
- @Override
- public void loadKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException {
- if (Strings.isValid(keyValueArtifact.getValue("date"))) {
- Date date = new Date();
- date.setTime(new Long(keyValueArtifact.getValue("date")).longValue());
- setCreationDate(date);
- }
- }
-
- @Override
- public Date getDate() {
- return getRunDate();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.model;
+
+import java.util.Date;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.artifact.KeyValueArtifact;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+
+public class CoveragePackage extends CoveragePackageBase implements ICoverage {
+
+ Date creationDate;
+
+ public CoveragePackage(String name, CoverageOptionManager coverageOptionManager) {
+ this(name, new Date(), coverageOptionManager);
+ }
+
+ public CoveragePackage(String name, Date runDate, CoverageOptionManager coverageOptionManager) {
+ super(name, coverageOptionManager);
+ this.creationDate = runDate;
+ }
+
+ public void clearCoverageUnits() {
+ coverageUnits.clear();
+ }
+
+ public Date getRunDate() {
+ return creationDate;
+ }
+
+ @Override
+ public void getOverviewHtmlHeader(XResultData xResultData) {
+ xResultData.log(AHTML.bold("Coverage Package " + getName() + " as of " + XDate.getDateStr(new Date(),
+ XDate.MMDDYYHHMM)) + AHTML.newline());
+ }
+
+ public void setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ @Override
+ public void saveKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException {
+ keyValueArtifact.setValue("date", String.valueOf(creationDate.getTime()));
+ }
+
+ @Override
+ public void loadKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException {
+ if (Strings.isValid(keyValueArtifact.getValue("date"))) {
+ Date date = new Date();
+ date.setTime(new Long(keyValueArtifact.getValue("date")).longValue());
+ setCreationDate(date);
+ }
+ }
+
+ @Override
+ public Date getDate() {
+ return getRunDate();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java
index d62d41900c..85f404533c 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -24,285 +24,285 @@ import org.eclipse.osee.framework.skynet.core.artifact.KeyValueArtifact;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.results.XResultData;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class CoveragePackageBase implements ICoverage, ICoverageUnitProvider {
- List<CoverageUnit> coverageUnits = new ArrayList<CoverageUnit>();
- final XResultData logResultData = new XResultData(false);
- String guid = GUID.create();
- String name;
- boolean editable = true;
- protected final CoverageOptionManager coverageOptionManager;
- protected ICoverageUnitFileContentsProvider coverageUnitFileContentsProvider;
-
- public CoveragePackageBase(String name, CoverageOptionManager coverageOptionManager) {
- this.name = name;
- this.coverageOptionManager = coverageOptionManager;
- }
-
- public abstract Date getDate();
-
- public void addCoverageUnit(CoverageUnit coverageUnit) {
- coverageUnit.setParent(this);
- if (!coverageUnits.contains(coverageUnit)) {
- coverageUnits.add(coverageUnit);
- }
- }
-
- public List<CoverageUnit> getCoverageUnits() {
- return coverageUnits;
- }
-
- public abstract void getOverviewHtmlHeader(XResultData xResultData);
-
- public List<CoverageItem> getCoverageItems() {
- List<CoverageItem> items = new ArrayList<CoverageItem>();
- for (CoverageUnit coverageUnit : coverageUnits) {
- items.addAll(coverageUnit.getCoverageItems(true));
- }
- return items;
- }
-
- @Override
- public String getCoveragePercentStr() {
- return CoverageUtil.getPercent(getCoverageItemsCovered().size(), getCoverageItems().size(), true).getSecond();
- }
-
- public Double getCoveragePercent() {
- return CoverageUtil.getPercent(getCoverageItemsCovered().size(), getCoverageItems().size(), true).getFirst();
- }
-
- public List<CoverageItem> getCoverageItemsCovered() {
- List<CoverageItem> items = new ArrayList<CoverageItem>();
- for (CoverageItem coverageItem : getCoverageItems()) {
- if (!coverageItem.getCoverageMethod().getName().equals(CoverageOptionManager.Not_Covered.name)) {
- items.add(coverageItem);
- }
- }
- return items;
- }
-
- public List<CoverageItem> getCoverageItemsCovered(CoverageOption... CoverageOption) {
- return CoverageUtil.getCoverageItemsCovered(getCoverageItems(), CoverageOption);
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren(boolean recurse) {
- Set<ICoverage> items = new HashSet<ICoverage>();
- for (CoverageUnit coverageUnit : getCoverageUnits()) {
- items.add(coverageUnit);
- if (recurse) {
- items.addAll(coverageUnit.getChildren(recurse));
- }
- }
- return items;
- }
-
- public CoverageUnit getOrCreateParent(String namespace) {
- // Look for already existing CU
- for (ICoverage item : new CopyOnWriteArrayList<ICoverage>(getChildren(true))) {
- if (!(item instanceof CoverageUnit)) continue;
- CoverageUnit coverageUnit = (CoverageUnit) item;
- if (coverageUnit.getName().equals(namespace)) {
- return coverageUnit;
- }
- }
- // Create
- String[] names = namespace.split("\\.");
- String nameStr = "";
- for (String name : names) {
- if (nameStr.equals("")) {
- nameStr = name;
- } else {
- nameStr = nameStr + "." + name;
- }
- if (getCoverageUnits().isEmpty()) {
- CoverageUnit newCoverageUnit = new CoverageUnit(this, nameStr, "", coverageUnitFileContentsProvider);
- newCoverageUnit.setFolder(true);
- newCoverageUnit.setNamespace(nameStr);
- addCoverageUnit(newCoverageUnit);
- if (nameStr.equals(namespace)) return newCoverageUnit;
- continue;
- }
-
- // Look for already existing CU
- boolean found = false;
- for (ICoverage item : new CopyOnWriteArrayList<ICoverage>(getChildren(true))) {
- if (!(item instanceof CoverageUnit)) continue;
- if (item.getName().equals(nameStr)) {
- found = true;
- break;
- }
- }
- if (found) continue;
-
- // Create one if not exists
-
- // Find parent
- ICoverage parent = null;
- if (nameStr.equals(name)) {
- parent = this;
- } else {
- String parentNamespace = nameStr.replaceFirst("\\." + name + ".*$", "");
- parent = getOrCreateParent(parentNamespace);
- }
- // Create new coverage unit
- CoverageUnit newCoverageUnit = new CoverageUnit(parent, nameStr, "", coverageUnitFileContentsProvider);
- newCoverageUnit.setNamespace(nameStr);
- newCoverageUnit.setFolder(true);
- // Add to parent
- ((ICoverageUnitProvider) parent).addCoverageUnit(newCoverageUnit);
- // Return if this is our coverage unit
- if (nameStr.equals(namespace)) return newCoverageUnit;
- }
- return null;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setCoverageUnits(List<CoverageUnit> coverageUnits) {
- this.coverageUnits = coverageUnits;
- }
-
- public String getName() {
- return name;
- }
-
- public XResultData getLog() {
- return logResultData;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isImportAllowed() {
- return isEditable().isTrue();
- }
-
- @Override
- public boolean isAssignable() {
- return isEditable().isTrue();
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren() {
- return getChildren(false);
- }
-
- @Override
- public boolean isCovered() {
- for (CoverageUnit coverageUnit : coverageUnits) {
- if (!coverageUnit.isCovered()) return false;
- }
- return true;
- }
-
- @Override
- public Result isEditable() {
- if (!editable) return new Result("CoveragePackage locked for edits.");
- return Result.TrueResult;
- }
-
- public void setEditable(boolean editable) {
- this.editable = editable;
- }
-
- public void removeCoverageUnit(CoverageUnit coverageUnit) {
- coverageUnits.remove(coverageUnit);
- }
-
- @Override
- public KeyedImage getOseeImage() {
- return null;
- }
-
- @Override
- public String getLocation() {
- return "";
- }
-
- @Override
- public String getFileContents() throws OseeCoreException {
- return "";
- }
-
- @Override
- public String getNamespace() {
- return "";
- }
-
- @Override
- public String getNotes() {
- return null;
- }
-
- @Override
- public ICoverage getParent() {
- return null;
- }
-
- @Override
- public String getAssignees() throws OseeCoreException {
- return "";
- }
-
- public abstract void saveKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException;
-
- public abstract void loadKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException;
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((getGuid() == null) ? 0 : getGuid().hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
- CoveragePackageBase other = (CoveragePackageBase) obj;
- if (getGuid() == null) {
- if (other.getGuid() != null) return false;
- } else if (!getGuid().equals(other.getGuid())) return false;
- return true;
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public String getOrderNumber() {
- return "";
- }
-
- public CoverageOptionManager getCoverageOptionManager() {
- return coverageOptionManager;
- }
-
- public ICoverageUnitFileContentsProvider getCoverageUnitFileContentsProvider() {
- return coverageUnitFileContentsProvider;
- }
-
- public void setCoverageUnitFileContentsProvider(ICoverageUnitFileContentsProvider coverageUnitFileContentsProvider) {
- this.coverageUnitFileContentsProvider = coverageUnitFileContentsProvider;
- }
-
- public CoverageUnit createCoverageUnit(ICoverage parent, String name, String location) {
- return new CoverageUnit(parent, name, location, coverageUnitFileContentsProvider);
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class CoveragePackageBase implements ICoverage, ICoverageUnitProvider {
+ List<CoverageUnit> coverageUnits = new ArrayList<CoverageUnit>();
+ final XResultData logResultData = new XResultData(false);
+ String guid = GUID.create();
+ String name;
+ boolean editable = true;
+ protected final CoverageOptionManager coverageOptionManager;
+ protected ICoverageUnitFileContentsProvider coverageUnitFileContentsProvider;
+
+ public CoveragePackageBase(String name, CoverageOptionManager coverageOptionManager) {
+ this.name = name;
+ this.coverageOptionManager = coverageOptionManager;
+ }
+
+ public abstract Date getDate();
+
+ public void addCoverageUnit(CoverageUnit coverageUnit) {
+ coverageUnit.setParent(this);
+ if (!coverageUnits.contains(coverageUnit)) {
+ coverageUnits.add(coverageUnit);
+ }
+ }
+
+ public List<CoverageUnit> getCoverageUnits() {
+ return coverageUnits;
+ }
+
+ public abstract void getOverviewHtmlHeader(XResultData xResultData);
+
+ public List<CoverageItem> getCoverageItems() {
+ List<CoverageItem> items = new ArrayList<CoverageItem>();
+ for (CoverageUnit coverageUnit : coverageUnits) {
+ items.addAll(coverageUnit.getCoverageItems(true));
+ }
+ return items;
+ }
+
+ @Override
+ public String getCoveragePercentStr() {
+ return CoverageUtil.getPercent(getCoverageItemsCovered().size(), getCoverageItems().size(), true).getSecond();
+ }
+
+ public Double getCoveragePercent() {
+ return CoverageUtil.getPercent(getCoverageItemsCovered().size(), getCoverageItems().size(), true).getFirst();
+ }
+
+ public List<CoverageItem> getCoverageItemsCovered() {
+ List<CoverageItem> items = new ArrayList<CoverageItem>();
+ for (CoverageItem coverageItem : getCoverageItems()) {
+ if (!coverageItem.getCoverageMethod().getName().equals(CoverageOptionManager.Not_Covered.name)) {
+ items.add(coverageItem);
+ }
+ }
+ return items;
+ }
+
+ public List<CoverageItem> getCoverageItemsCovered(CoverageOption... CoverageOption) {
+ return CoverageUtil.getCoverageItemsCovered(getCoverageItems(), CoverageOption);
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren(boolean recurse) {
+ Set<ICoverage> items = new HashSet<ICoverage>();
+ for (CoverageUnit coverageUnit : getCoverageUnits()) {
+ items.add(coverageUnit);
+ if (recurse) {
+ items.addAll(coverageUnit.getChildren(recurse));
+ }
+ }
+ return items;
+ }
+
+ public CoverageUnit getOrCreateParent(String namespace) {
+ // Look for already existing CU
+ for (ICoverage item : new CopyOnWriteArrayList<ICoverage>(getChildren(true))) {
+ if (!(item instanceof CoverageUnit)) continue;
+ CoverageUnit coverageUnit = (CoverageUnit) item;
+ if (coverageUnit.getName().equals(namespace)) {
+ return coverageUnit;
+ }
+ }
+ // Create
+ String[] names = namespace.split("\\.");
+ String nameStr = "";
+ for (String name : names) {
+ if (nameStr.equals("")) {
+ nameStr = name;
+ } else {
+ nameStr = nameStr + "." + name;
+ }
+ if (getCoverageUnits().isEmpty()) {
+ CoverageUnit newCoverageUnit = new CoverageUnit(this, nameStr, "", coverageUnitFileContentsProvider);
+ newCoverageUnit.setFolder(true);
+ newCoverageUnit.setNamespace(nameStr);
+ addCoverageUnit(newCoverageUnit);
+ if (nameStr.equals(namespace)) return newCoverageUnit;
+ continue;
+ }
+
+ // Look for already existing CU
+ boolean found = false;
+ for (ICoverage item : new CopyOnWriteArrayList<ICoverage>(getChildren(true))) {
+ if (!(item instanceof CoverageUnit)) continue;
+ if (item.getName().equals(nameStr)) {
+ found = true;
+ break;
+ }
+ }
+ if (found) continue;
+
+ // Create one if not exists
+
+ // Find parent
+ ICoverage parent = null;
+ if (nameStr.equals(name)) {
+ parent = this;
+ } else {
+ String parentNamespace = nameStr.replaceFirst("\\." + name + ".*$", "");
+ parent = getOrCreateParent(parentNamespace);
+ }
+ // Create new coverage unit
+ CoverageUnit newCoverageUnit = new CoverageUnit(parent, nameStr, "", coverageUnitFileContentsProvider);
+ newCoverageUnit.setNamespace(nameStr);
+ newCoverageUnit.setFolder(true);
+ // Add to parent
+ ((ICoverageUnitProvider) parent).addCoverageUnit(newCoverageUnit);
+ // Return if this is our coverage unit
+ if (nameStr.equals(namespace)) return newCoverageUnit;
+ }
+ return null;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public void setCoverageUnits(List<CoverageUnit> coverageUnits) {
+ this.coverageUnits = coverageUnits;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public XResultData getLog() {
+ return logResultData;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isImportAllowed() {
+ return isEditable().isTrue();
+ }
+
+ @Override
+ public boolean isAssignable() {
+ return isEditable().isTrue();
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren() {
+ return getChildren(false);
+ }
+
+ @Override
+ public boolean isCovered() {
+ for (CoverageUnit coverageUnit : coverageUnits) {
+ if (!coverageUnit.isCovered()) return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Result isEditable() {
+ if (!editable) return new Result("CoveragePackage locked for edits.");
+ return Result.TrueResult;
+ }
+
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ public void removeCoverageUnit(CoverageUnit coverageUnit) {
+ coverageUnits.remove(coverageUnit);
+ }
+
+ @Override
+ public KeyedImage getOseeImage() {
+ return null;
+ }
+
+ @Override
+ public String getLocation() {
+ return "";
+ }
+
+ @Override
+ public String getFileContents() throws OseeCoreException {
+ return "";
+ }
+
+ @Override
+ public String getNamespace() {
+ return "";
+ }
+
+ @Override
+ public String getNotes() {
+ return null;
+ }
+
+ @Override
+ public ICoverage getParent() {
+ return null;
+ }
+
+ @Override
+ public String getAssignees() throws OseeCoreException {
+ return "";
+ }
+
+ public abstract void saveKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException;
+
+ public abstract void loadKeyValues(KeyValueArtifact keyValueArtifact) throws OseeCoreException;
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((getGuid() == null) ? 0 : getGuid().hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ CoveragePackageBase other = (CoveragePackageBase) obj;
+ if (getGuid() == null) {
+ if (other.getGuid() != null) return false;
+ } else if (!getGuid().equals(other.getGuid())) return false;
+ return true;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public String getOrderNumber() {
+ return "";
+ }
+
+ public CoverageOptionManager getCoverageOptionManager() {
+ return coverageOptionManager;
+ }
+
+ public ICoverageUnitFileContentsProvider getCoverageUnitFileContentsProvider() {
+ return coverageUnitFileContentsProvider;
+ }
+
+ public void setCoverageUnitFileContentsProvider(ICoverageUnitFileContentsProvider coverageUnitFileContentsProvider) {
+ this.coverageUnitFileContentsProvider = coverageUnitFileContentsProvider;
+ }
+
+ public CoverageUnit createCoverageUnit(ICoverage parent, String name, String location) {
+ return new CoverageUnit(parent, name, location, coverageUnitFileContentsProvider);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePreferences.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePreferences.java
index 307d86b5df..e5379f8113 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePreferences.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePreferences.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -23,61 +23,61 @@ import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.KeyValueArtifact;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.ui.plugin.util.Result;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoveragePreferences {
-
- private static String ARTIFACT_NAME = "Coverage Preferences";
- private final Branch branch;
- private Artifact artifact;
-
- public CoveragePreferences(Branch branch) {
- this.branch = branch;
- }
-
- private Artifact getArtifact() throws OseeCoreException {
- if (artifact == null) {
- try {
- artifact = ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.GeneralData, ARTIFACT_NAME, branch);
- } catch (ArtifactDoesNotExist ex) {
- // do nothing
- }
- }
- if (artifact == null) {
- artifact =
- ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralData, BranchManager.getCommonBranch(),
- ARTIFACT_NAME);
- artifact.persist("Coverage Preferences - creation");
- }
- return artifact;
- }
-
- public Result isSaveable() throws OseeCoreException {
- if (!AccessControlManager.hasPermission(getArtifact(), PermissionEnum.WRITE)) {
- return new Result(String.format("You do not have permissions to change Coverage Preferences"));
- }
- return Result.TrueResult;
- }
-
- /**
- * Return global CoverageOptions or null if none available
- */
- public String getCoverageOptions() throws OseeCoreException {
- if (getArtifact() == null) {
- return null;
- }
- KeyValueArtifact keyValueArt =
- new KeyValueArtifact(getArtifact(), CoreAttributeTypes.GENERAL_STRING_DATA.getName());
- return keyValueArt.getValue("CoverageOptions");
- }
-
- public void setCoverageOptions(String options) throws OseeCoreException {
- KeyValueArtifact keyValueArt =
- new KeyValueArtifact(getArtifact(), CoreAttributeTypes.GENERAL_STRING_DATA.getName());
- keyValueArt.setValue("CoverageOptions", options);
- keyValueArt.save();
- getArtifact().persist("Coverage Preferences - save");
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoveragePreferences {
+
+ private static String ARTIFACT_NAME = "Coverage Preferences";
+ private final Branch branch;
+ private Artifact artifact;
+
+ public CoveragePreferences(Branch branch) {
+ this.branch = branch;
+ }
+
+ private Artifact getArtifact() throws OseeCoreException {
+ if (artifact == null) {
+ try {
+ artifact = ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.GeneralData, ARTIFACT_NAME, branch);
+ } catch (ArtifactDoesNotExist ex) {
+ // do nothing
+ }
+ }
+ if (artifact == null) {
+ artifact =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralData, BranchManager.getCommonBranch(),
+ ARTIFACT_NAME);
+ artifact.persist("Coverage Preferences - creation");
+ }
+ return artifact;
+ }
+
+ public Result isSaveable() throws OseeCoreException {
+ if (!AccessControlManager.hasPermission(getArtifact(), PermissionEnum.WRITE)) {
+ return new Result(String.format("You do not have permissions to change Coverage Preferences"));
+ }
+ return Result.TrueResult;
+ }
+
+ /**
+ * Return global CoverageOptions or null if none available
+ */
+ public String getCoverageOptions() throws OseeCoreException {
+ if (getArtifact() == null) {
+ return null;
+ }
+ KeyValueArtifact keyValueArt =
+ new KeyValueArtifact(getArtifact(), CoreAttributeTypes.GENERAL_STRING_DATA.getName());
+ return keyValueArt.getValue("CoverageOptions");
+ }
+
+ public void setCoverageOptions(String options) throws OseeCoreException {
+ KeyValueArtifact keyValueArt =
+ new KeyValueArtifact(getArtifact(), CoreAttributeTypes.GENERAL_STRING_DATA.getName());
+ keyValueArt.setValue("CoverageOptions", options);
+ keyValueArt.save();
+ getArtifact().persist("Coverage Preferences - save");
+ }
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java
index 2ceb421d30..6a5106df93 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java
@@ -8,132 +8,132 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.Collection;
import org.eclipse.osee.coverage.util.CoverageImage;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * Single test that can cover multiple Coverage Items
- *
- * @author Donald G. Dunne
- */
-public class CoverageTestUnit implements ICoverage {
-
- String name;
- String guid = GUID.create();
-
- public CoverageTestUnit(String name) {
- super();
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getGuid() {
- return guid;
- }
-
- @Override
- public String toString() {
- return getName();
- }
-
- @Override
- public String getAssignees() throws OseeCoreException {
- return "";
- }
-
- @Override
- public Result isEditable() {
- return Result.FalseResult;
- }
-
- @Override
- public KeyedImage getOseeImage() {
- if (isCovered()) {
- return CoverageImage.TEST_UNIT_GREEN;
- }
- return CoverageImage.TEST_UNIT_RED;
- }
-
- @Override
- public boolean isCovered() {
- return false;
- }
-
- @Override
- public ICoverage getParent() {
- return null;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- @Override
- public boolean isAssignable() {
- return false;
- }
-
- @Override
- public String getNotes() {
- return null;
- }
-
- @Override
- public Double getCoveragePercent() {
- return 0.0;
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren(boolean recurse) {
- return java.util.Collections.emptyList();
- }
-
- @Override
- public String getCoveragePercentStr() {
- return "";
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren() {
- return getChildren(false);
- }
-
- @Override
- public String getLocation() {
- return "";
- }
-
- @Override
- public String getNamespace() {
- return "";
- }
-
- @Override
- public String getFileContents() throws OseeCoreException {
- return "";
- }
-
- @Override
- public String getOrderNumber() {
- return "";
- }
-
-}
+
+/**
+ * Single test that can cover multiple Coverage Items
+ *
+ * @author Donald G. Dunne
+ */
+public class CoverageTestUnit implements ICoverage {
+
+ String name;
+ String guid = GUID.create();
+
+ public CoverageTestUnit(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ @Override
+ public String getAssignees() throws OseeCoreException {
+ return "";
+ }
+
+ @Override
+ public Result isEditable() {
+ return Result.FalseResult;
+ }
+
+ @Override
+ public KeyedImage getOseeImage() {
+ if (isCovered()) {
+ return CoverageImage.TEST_UNIT_GREEN;
+ }
+ return CoverageImage.TEST_UNIT_RED;
+ }
+
+ @Override
+ public boolean isCovered() {
+ return false;
+ }
+
+ @Override
+ public ICoverage getParent() {
+ return null;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ @Override
+ public boolean isAssignable() {
+ return false;
+ }
+
+ @Override
+ public String getNotes() {
+ return null;
+ }
+
+ @Override
+ public Double getCoveragePercent() {
+ return 0.0;
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren(boolean recurse) {
+ return java.util.Collections.emptyList();
+ }
+
+ @Override
+ public String getCoveragePercentStr() {
+ return "";
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren() {
+ return getChildren(false);
+ }
+
+ @Override
+ public String getLocation() {
+ return "";
+ }
+
+ @Override
+ public String getNamespace() {
+ return "";
+ }
+
+ @Override
+ public String getFileContents() throws OseeCoreException {
+ return "";
+ }
+
+ @Override
+ public String getOrderNumber() {
+ return "";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java
index 546b5e9a19..2d84fe3e11 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java
@@ -1,393 +1,393 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.osee.coverage.util.CoverageImage;
-import org.eclipse.osee.coverage.util.CoverageUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * Single code unit (file/procedure/function) that can contain other Coverage Unit or Coverage Items
- *
- * @author Donald G. Dunne
- */
-public class CoverageUnit implements ICoverage, ICoverageUnitProvider, ICoverageItemProvider {
-
- String name;
- String namespace;
- boolean folder;
- String notes;
- String assignees;
- String guid = GUID.create();
- final List<CoverageItem> coverageItems = new ArrayList<CoverageItem>();
- String location;
- String orderNumber = "";
- final List<CoverageUnit> coverageUnits = new ArrayList<CoverageUnit>();
- ICoverage parent;
- ICoverageUnitFileContentsProvider fileContentsProvider;
-
- public CoverageUnit(ICoverage parent, String name, String location, ICoverageUnitFileContentsProvider coverageUnitFileContentsProvider) {
- super();
- this.parent = parent;
- this.name = name;
- this.location = location;
- this.fileContentsProvider = coverageUnitFileContentsProvider;
- if (parent != null && parent instanceof ICoverageUnitProvider) {
- ((ICoverageUnitProvider) parent).addCoverageUnit(this);
- }
- }
-
- public void clearCoverageUnits() {
- coverageUnits.clear();
- }
-
- public void clearCoverageItems() {
- coverageItems.clear();
- }
-
- public void addCoverageUnit(CoverageUnit coverageUnit) {
- coverageUnit.setParent(this);
- if (!coverageUnits.contains(coverageUnit)) {
- coverageUnits.add(coverageUnit);
- }
- }
-
- public List<CoverageUnit> getCoverageUnits() {
- return getCoverageUnits(false);
- }
-
- public List<CoverageUnit> getCoverageUnits(boolean recurse) {
- if (!recurse) {
- return coverageUnits;
- }
- List<CoverageUnit> units = new ArrayList<CoverageUnit>(coverageUnits);
- for (CoverageUnit coverageUnit : coverageUnits) {
- units.addAll(coverageUnit.getCoverageUnits(recurse));
- }
- return units;
- }
-
- public void addCoverageItem(CoverageItem coverageItem) {
- if (!coverageItems.contains(coverageItem)) {
- coverageItems.add(coverageItem);
- }
- }
-
- public List<CoverageItem> getCoverageItems(boolean recurse) {
- if (!recurse) {
- return coverageItems;
- }
- List<CoverageItem> items = new ArrayList<CoverageItem>(coverageItems);
- for (CoverageUnit coverageUnit : coverageUnits) {
- items.addAll(coverageUnit.getCoverageItems(true));
- }
- return items;
- }
-
- public CoverageItem getCoverageItem(String childUnitOrderNum, String itemOrderNumber) {
- for (CoverageUnit coverageUnit : coverageUnits) {
- if (coverageUnit.getOrderNumber().equals(childUnitOrderNum)) {
- for (CoverageItem coverageItem : coverageUnit.getCoverageItems()) {
- if (coverageItem.getOrderNumber().equals(itemOrderNumber)) {
- return coverageItem;
- }
- }
- }
- }
- return null;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getFileContents() throws OseeCoreException {
- if (fileContentsProvider == null) {
- throw new OseeStateException("No File Contents Provider Specified");
- }
- return fileContentsProvider.getFileContents(this);
- }
-
- public void setFileContents(String fileContents) throws OseeStateException {
- if (fileContentsProvider == null) {
- throw new OseeStateException("No File Contents Provider Specified");
- }
- this.fileContentsProvider.setFileContents(this, fileContents);
- }
-
- public String getGuid() {
- return guid;
- }
-
- public CoverageUnit getParentCoverageUnit() {
- if (parent instanceof CoverageUnit) {
- return (CoverageUnit) parent;
- }
- return null;
- }
-
- @Override
- public String toString() {
- return String.format("[Unit [%s][M: %s][%s][Path: %s]]", getName(), getOrderNumber(), getGuid(),
- CoverageUtil.getFullPath(this));
- }
-
- @Override
- public Result isEditable() {
- return Result.TrueResult;
- }
-
- @Override
- public KeyedImage getOseeImage() {
- boolean covered = isCovered();
- if (isFolder()) {
- if (covered) {
- return CoverageImage.FOLDER_GREEN;
- } else {
- return CoverageImage.FOLDER_RED;
- }
- } else if (covered) {
- return CoverageImage.UNIT_GREEN;
- }
- return CoverageImage.UNIT_RED;
- }
-
- @Override
- public boolean isCovered() {
- for (CoverageItem coverageItem : getCoverageItems(true)) {
- if (!coverageItem.isCovered()) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (guid == null ? 0 : guid.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- CoverageUnit other = (CoverageUnit) obj;
- if (guid == null) {
- if (other.guid != null) {
- return false;
- }
- } else if (!guid.equals(other.guid)) {
- return false;
- }
- return true;
- }
-
- @Override
- public ICoverage getParent() {
- return parent;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getNamespace() {
- if (namespace == null) {
- return getParent() == null ? null : getParent().getNamespace();
- }
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- if (namespace == null) {
- this.namespace = null;
- } else {
- this.namespace = Strings.intern(namespace);
- }
- }
-
- public String getAssignees() {
- return assignees;
- }
-
- public void setAssignees(String assignees) {
- this.assignees = assignees;
- }
-
- @Override
- public boolean isAssignable() {
- return true;
- }
-
- @Override
- public String getNotes() {
- return notes;
- }
-
- public void setNotes(String notes) {
- this.notes = notes;
- }
-
- public List<CoverageItem> getCoverageItemsCovered(boolean recurse) {
- List<CoverageItem> items = new ArrayList<CoverageItem>();
- for (CoverageItem coverageItem : getCoverageItems(recurse)) {
- if (coverageItem.isCovered()) {
- items.add(coverageItem);
- }
- }
- return items;
- }
-
- public List<CoverageItem> getCoverageItemsCovered(boolean recurse, CoverageOption... CoverageOption) {
- List<CoverageOption> coverageMethods = Collections.getAggregate(CoverageOption);
- List<CoverageItem> items = new ArrayList<CoverageItem>();
- for (CoverageItem coverageItem : getCoverageItems(recurse)) {
- if (coverageMethods.contains(coverageItem.getCoverageMethod())) {
- items.add(coverageItem);
- }
- }
- return items;
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren() {
- return getChildren(false);
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren(boolean recurse) {
- Set<ICoverage> items = new HashSet<ICoverage>(coverageItems);
- for (CoverageUnit coverageUnit : getCoverageUnits()) {
- items.add(coverageUnit);
- if (recurse) {
- items.addAll(coverageUnit.getChildren(recurse));
- }
- }
- return items;
- }
-
- @Override
- public void removeCoverageUnit(CoverageUnit coverageUnit) {
- coverageUnits.remove(coverageUnit);
- }
-
- @Override
- public List<CoverageItem> getCoverageItems() {
- return coverageItems;
- }
-
- @Override
- public void removeCoverageItem(CoverageItem coverageItem) {
- coverageItems.remove(coverageItem);
- }
-
- public CoverageUnit copy(boolean includeItems) throws OseeCoreException {
- CoverageUnit coverageUnit = new CoverageUnit(parent, name, location, fileContentsProvider);
- coverageUnit.setGuid(guid);
- coverageUnit.setNamespace(namespace);
- coverageUnit.setNotes(notes);
- coverageUnit.setOrderNumber(orderNumber);
- coverageUnit.setFolder(folder);
- coverageUnit.setAssignees(assignees);
- coverageUnit.setLocation(location);
- if (includeItems) {
- for (CoverageItem coverageItem : coverageItems) {
- CoverageItem newCoverageItem =
- new CoverageItem(coverageUnit, coverageItem.toXml(), CoverageOptionManagerDefault.instance(),
- coverageItem.getTestUnitProvider());
- newCoverageItem.setTestUnitProvider(coverageItem.getTestUnitProvider());
- coverageUnit.addCoverageItem(newCoverageItem);
- }
- }
- coverageUnit.setFileContentsProvider(fileContentsProvider);
- return coverageUnit;
- }
-
- @Override
- public String getCoveragePercentStr() {
- return CoverageUtil.getPercent(getCoverageItemsCovered(true).size(), getCoverageItems(true).size(), true).getSecond();
- }
-
- public Double getCoveragePercent() {
- return CoverageUtil.getPercent(getCoverageItemsCovered(true).size(), getCoverageItems(true).size(), true).getFirst();
- }
-
- public boolean isFolder() {
- return folder;
- }
-
- public void setFolder(boolean folder) {
- this.folder = folder;
- }
-
- public List<CoverageItem> getCoverageItemsCovered(CoverageOption... CoverageOption) {
- return CoverageUtil.getCoverageItemsCovered(getCoverageItems(), CoverageOption);
- }
-
- public void updateAssigneesAndNotes(CoverageUnit coverageUnit) {
- setNotes(coverageUnit.getNotes());
- setAssignees(coverageUnit.getAssignees());
- }
-
- public void setParent(ICoverage parent) {
- this.parent = parent;
- }
-
- public String getOrderNumber() {
- return orderNumber;
- }
-
- public void setOrderNumber(String orderNumber) {
- this.orderNumber = Strings.intern(orderNumber);
- }
-
- public void setFileContentsProvider(ICoverageUnitFileContentsProvider fileContentsProvider) {
- this.fileContentsProvider = fileContentsProvider;
- }
-
- public ICoverageUnitFileContentsProvider getFileContentsProvider() {
- return fileContentsProvider;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.osee.coverage.util.CoverageImage;
+import org.eclipse.osee.coverage.util.CoverageUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+
+/**
+ * Single code unit (file/procedure/function) that can contain other Coverage Unit or Coverage Items
+ *
+ * @author Donald G. Dunne
+ */
+public class CoverageUnit implements ICoverage, ICoverageUnitProvider, ICoverageItemProvider {
+
+ String name;
+ String namespace;
+ boolean folder;
+ String notes;
+ String assignees;
+ String guid = GUID.create();
+ final List<CoverageItem> coverageItems = new ArrayList<CoverageItem>();
+ String location;
+ String orderNumber = "";
+ final List<CoverageUnit> coverageUnits = new ArrayList<CoverageUnit>();
+ ICoverage parent;
+ ICoverageUnitFileContentsProvider fileContentsProvider;
+
+ public CoverageUnit(ICoverage parent, String name, String location, ICoverageUnitFileContentsProvider coverageUnitFileContentsProvider) {
+ super();
+ this.parent = parent;
+ this.name = name;
+ this.location = location;
+ this.fileContentsProvider = coverageUnitFileContentsProvider;
+ if (parent != null && parent instanceof ICoverageUnitProvider) {
+ ((ICoverageUnitProvider) parent).addCoverageUnit(this);
+ }
+ }
+
+ public void clearCoverageUnits() {
+ coverageUnits.clear();
+ }
+
+ public void clearCoverageItems() {
+ coverageItems.clear();
+ }
+
+ public void addCoverageUnit(CoverageUnit coverageUnit) {
+ coverageUnit.setParent(this);
+ if (!coverageUnits.contains(coverageUnit)) {
+ coverageUnits.add(coverageUnit);
+ }
+ }
+
+ public List<CoverageUnit> getCoverageUnits() {
+ return getCoverageUnits(false);
+ }
+
+ public List<CoverageUnit> getCoverageUnits(boolean recurse) {
+ if (!recurse) {
+ return coverageUnits;
+ }
+ List<CoverageUnit> units = new ArrayList<CoverageUnit>(coverageUnits);
+ for (CoverageUnit coverageUnit : coverageUnits) {
+ units.addAll(coverageUnit.getCoverageUnits(recurse));
+ }
+ return units;
+ }
+
+ public void addCoverageItem(CoverageItem coverageItem) {
+ if (!coverageItems.contains(coverageItem)) {
+ coverageItems.add(coverageItem);
+ }
+ }
+
+ public List<CoverageItem> getCoverageItems(boolean recurse) {
+ if (!recurse) {
+ return coverageItems;
+ }
+ List<CoverageItem> items = new ArrayList<CoverageItem>(coverageItems);
+ for (CoverageUnit coverageUnit : coverageUnits) {
+ items.addAll(coverageUnit.getCoverageItems(true));
+ }
+ return items;
+ }
+
+ public CoverageItem getCoverageItem(String childUnitOrderNum, String itemOrderNumber) {
+ for (CoverageUnit coverageUnit : coverageUnits) {
+ if (coverageUnit.getOrderNumber().equals(childUnitOrderNum)) {
+ for (CoverageItem coverageItem : coverageUnit.getCoverageItems()) {
+ if (coverageItem.getOrderNumber().equals(itemOrderNumber)) {
+ return coverageItem;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getFileContents() throws OseeCoreException {
+ if (fileContentsProvider == null) {
+ throw new OseeStateException("No File Contents Provider Specified");
+ }
+ return fileContentsProvider.getFileContents(this);
+ }
+
+ public void setFileContents(String fileContents) throws OseeStateException {
+ if (fileContentsProvider == null) {
+ throw new OseeStateException("No File Contents Provider Specified");
+ }
+ this.fileContentsProvider.setFileContents(this, fileContents);
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public CoverageUnit getParentCoverageUnit() {
+ if (parent instanceof CoverageUnit) {
+ return (CoverageUnit) parent;
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("[Unit [%s][M: %s][%s][Path: %s]]", getName(), getOrderNumber(), getGuid(),
+ CoverageUtil.getFullPath(this));
+ }
+
+ @Override
+ public Result isEditable() {
+ return Result.TrueResult;
+ }
+
+ @Override
+ public KeyedImage getOseeImage() {
+ boolean covered = isCovered();
+ if (isFolder()) {
+ if (covered) {
+ return CoverageImage.FOLDER_GREEN;
+ } else {
+ return CoverageImage.FOLDER_RED;
+ }
+ } else if (covered) {
+ return CoverageImage.UNIT_GREEN;
+ }
+ return CoverageImage.UNIT_RED;
+ }
+
+ @Override
+ public boolean isCovered() {
+ for (CoverageItem coverageItem : getCoverageItems(true)) {
+ if (!coverageItem.isCovered()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (guid == null ? 0 : guid.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CoverageUnit other = (CoverageUnit) obj;
+ if (guid == null) {
+ if (other.guid != null) {
+ return false;
+ }
+ } else if (!guid.equals(other.guid)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public ICoverage getParent() {
+ return parent;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public String getNamespace() {
+ if (namespace == null) {
+ return getParent() == null ? null : getParent().getNamespace();
+ }
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ if (namespace == null) {
+ this.namespace = null;
+ } else {
+ this.namespace = Strings.intern(namespace);
+ }
+ }
+
+ public String getAssignees() {
+ return assignees;
+ }
+
+ public void setAssignees(String assignees) {
+ this.assignees = assignees;
+ }
+
+ @Override
+ public boolean isAssignable() {
+ return true;
+ }
+
+ @Override
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+
+ public List<CoverageItem> getCoverageItemsCovered(boolean recurse) {
+ List<CoverageItem> items = new ArrayList<CoverageItem>();
+ for (CoverageItem coverageItem : getCoverageItems(recurse)) {
+ if (coverageItem.isCovered()) {
+ items.add(coverageItem);
+ }
+ }
+ return items;
+ }
+
+ public List<CoverageItem> getCoverageItemsCovered(boolean recurse, CoverageOption... CoverageOption) {
+ List<CoverageOption> coverageMethods = Collections.getAggregate(CoverageOption);
+ List<CoverageItem> items = new ArrayList<CoverageItem>();
+ for (CoverageItem coverageItem : getCoverageItems(recurse)) {
+ if (coverageMethods.contains(coverageItem.getCoverageMethod())) {
+ items.add(coverageItem);
+ }
+ }
+ return items;
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren() {
+ return getChildren(false);
+ }
+
+ @Override
+ public Collection<? extends ICoverage> getChildren(boolean recurse) {
+ Set<ICoverage> items = new HashSet<ICoverage>(coverageItems);
+ for (CoverageUnit coverageUnit : getCoverageUnits()) {
+ items.add(coverageUnit);
+ if (recurse) {
+ items.addAll(coverageUnit.getChildren(recurse));
+ }
+ }
+ return items;
+ }
+
+ @Override
+ public void removeCoverageUnit(CoverageUnit coverageUnit) {
+ coverageUnits.remove(coverageUnit);
+ }
+
+ @Override
+ public List<CoverageItem> getCoverageItems() {
+ return coverageItems;
+ }
+
+ @Override
+ public void removeCoverageItem(CoverageItem coverageItem) {
+ coverageItems.remove(coverageItem);
+ }
+
+ public CoverageUnit copy(boolean includeItems) throws OseeCoreException {
+ CoverageUnit coverageUnit = new CoverageUnit(parent, name, location, fileContentsProvider);
+ coverageUnit.setGuid(guid);
+ coverageUnit.setNamespace(namespace);
+ coverageUnit.setNotes(notes);
+ coverageUnit.setOrderNumber(orderNumber);
+ coverageUnit.setFolder(folder);
+ coverageUnit.setAssignees(assignees);
+ coverageUnit.setLocation(location);
+ if (includeItems) {
+ for (CoverageItem coverageItem : coverageItems) {
+ CoverageItem newCoverageItem =
+ new CoverageItem(coverageUnit, coverageItem.toXml(), CoverageOptionManagerDefault.instance(),
+ coverageItem.getTestUnitProvider());
+ newCoverageItem.setTestUnitProvider(coverageItem.getTestUnitProvider());
+ coverageUnit.addCoverageItem(newCoverageItem);
+ }
+ }
+ coverageUnit.setFileContentsProvider(fileContentsProvider);
+ return coverageUnit;
+ }
+
+ @Override
+ public String getCoveragePercentStr() {
+ return CoverageUtil.getPercent(getCoverageItemsCovered(true).size(), getCoverageItems(true).size(), true).getSecond();
+ }
+
+ public Double getCoveragePercent() {
+ return CoverageUtil.getPercent(getCoverageItemsCovered(true).size(), getCoverageItems(true).size(), true).getFirst();
+ }
+
+ public boolean isFolder() {
+ return folder;
+ }
+
+ public void setFolder(boolean folder) {
+ this.folder = folder;
+ }
+
+ public List<CoverageItem> getCoverageItemsCovered(CoverageOption... CoverageOption) {
+ return CoverageUtil.getCoverageItemsCovered(getCoverageItems(), CoverageOption);
+ }
+
+ public void updateAssigneesAndNotes(CoverageUnit coverageUnit) {
+ setNotes(coverageUnit.getNotes());
+ setAssignees(coverageUnit.getAssignees());
+ }
+
+ public void setParent(ICoverage parent) {
+ this.parent = parent;
+ }
+
+ public String getOrderNumber() {
+ return orderNumber;
+ }
+
+ public void setOrderNumber(String orderNumber) {
+ this.orderNumber = Strings.intern(orderNumber);
+ }
+
+ public void setFileContentsProvider(ICoverageUnitFileContentsProvider fileContentsProvider) {
+ this.fileContentsProvider = fileContentsProvider;
+ }
+
+ public ICoverageUnitFileContentsProvider getFileContentsProvider() {
+ return fileContentsProvider;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java
index f82edd2e20..b511774e2d 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java
@@ -8,50 +8,50 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.Collection;
import org.eclipse.osee.framework.core.data.Identity;
import org.eclipse.osee.framework.core.data.Named;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ICoverage extends Named, Identity {
-
- public String getNotes();
-
- public String getAssignees() throws OseeCoreException;
-
- public boolean isAssignable();
-
- public Result isEditable();
-
- public Collection<? extends ICoverage> getChildren();
-
- public Collection<? extends ICoverage> getChildren(boolean recurse);
-
- public KeyedImage getOseeImage();
-
- public boolean isCovered();
-
- public ICoverage getParent();
-
- public String getFileContents() throws OseeCoreException;
-
- public String getLocation();
-
- public String getNamespace();
-
- public Double getCoveragePercent();
-
- public String getCoveragePercentStr();
-
- public boolean isFolder();
-
- public String getOrderNumber();
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ICoverage extends Named, Identity {
+
+ public String getNotes();
+
+ public String getAssignees() throws OseeCoreException;
+
+ public boolean isAssignable();
+
+ public Result isEditable();
+
+ public Collection<? extends ICoverage> getChildren();
+
+ public Collection<? extends ICoverage> getChildren(boolean recurse);
+
+ public KeyedImage getOseeImage();
+
+ public boolean isCovered();
+
+ public ICoverage getParent();
+
+ public String getFileContents() throws OseeCoreException;
+
+ public String getLocation();
+
+ public String getNamespace();
+
+ public Double getCoveragePercent();
+
+ public String getCoveragePercentStr();
+
+ public boolean isFolder();
+
+ public String getOrderNumber();
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageItemProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageItemProvider.java
index 9f3a52d4f7..d514a0a6df 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageItemProvider.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageItemProvider.java
@@ -8,19 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.List;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ICoverageItemProvider {
-
- public List<CoverageItem> getCoverageItems();
-
- public void addCoverageItem(CoverageItem coverageItem);
-
- public void removeCoverageItem(CoverageItem coverageItem);
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ICoverageItemProvider {
+
+ public List<CoverageItem> getCoverageItems();
+
+ public void addCoverageItem(CoverageItem coverageItem);
+
+ public void removeCoverageItem(CoverageItem coverageItem);
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnit.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnit.java
index 4e0fb3dfa3..b033d11b9d 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnit.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnit.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.framework.core.data.Identity;
-import org.eclipse.osee.framework.core.data.Named;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * Single code unit (file/procedure/function) that can contain other Coverage Unit or Coverage Items
- *
- * @author Donald G. Dunne
- */
-public interface ICoverageUnit extends Named, Identity {
-
- public void clearCoverageUnits();
-
- public void clearCoverageItems();
-
- public void addCoverageUnit(ICoverageUnit coverageUnit);
-
- public List<ICoverageUnit> getCoverageUnits();
-
- public List<ICoverageUnit> getCoverageUnits(boolean recurse);
-
- public void addCoverageItem(CoverageItem coverageItem);
-
- public List<CoverageItem> getCoverageItems(boolean recurse);
-
- public CoverageItem getCoverageItem(String childUnitOrderNum, String itemOrderNumber);
-
- public void setName(String name);
-
- public String getLocation();
-
- public void setLocation(String location);
-
- public String getFileContents();
-
- public void setFileContents(String fileContents);
-
- public ICoverageUnit getParentCoverageUnit();
-
- public Result isEditable();
-
- public KeyedImage getOseeImage();
-
- public boolean isCovered();
-
- public ICoverage getParent();
-
- public void setGuid(String guid);
-
- public String getNamespace();
-
- public void setNamespace(String namespace);
-
- public String getAssignees();
-
- public void setAssignees(String assignees);
-
- public boolean isAssignable();
-
- public String getNotes();
-
- public void setNotes(String notes);
-
- public List<CoverageItem> getCoverageItemsCovered(boolean recurse);
-
- public List<CoverageItem> getCoverageItemsCovered(boolean recurse, CoverageOption... CoverageOption);
-
- public Collection<? extends ICoverage> getChildren();
-
- public Collection<? extends ICoverage> getChildren(boolean recurse);
-
- public void removeCoverageUnit(ICoverageUnit coverageUnit);
-
- public List<CoverageItem> getCoverageItems();
-
- public void removeCoverageItem(CoverageItem coverageItem);
-
- public ICoverageUnit copy(boolean includeItems) throws OseeCoreException;
-
- public String getCoveragePercentStr();
-
- public int getCoveragePercent();
-
- public boolean isFolder();
-
- public void setFolder(boolean folder);
-
- public List<CoverageItem> getCoverageItemsCovered(CoverageOption... CoverageOption);
-
- public void updateAssigneesAndNotes(ICoverageUnit coverageUnit);
-
- public void setParent(ICoverage parent);
-
- public String getOrderNumber();
-
- public void setOrderNumber(String orderNumber);
-
- public void setFileContentsProvider(ICoverageUnitFileContentsProvider fileContentsProvider);
-
- public ICoverageUnitFileContentsProvider getFileContentsProvider();
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.model;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.Identity;
+import org.eclipse.osee.framework.core.data.Named;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+
+/**
+ * Single code unit (file/procedure/function) that can contain other Coverage Unit or Coverage Items
+ *
+ * @author Donald G. Dunne
+ */
+public interface ICoverageUnit extends Named, Identity {
+
+ public void clearCoverageUnits();
+
+ public void clearCoverageItems();
+
+ public void addCoverageUnit(ICoverageUnit coverageUnit);
+
+ public List<ICoverageUnit> getCoverageUnits();
+
+ public List<ICoverageUnit> getCoverageUnits(boolean recurse);
+
+ public void addCoverageItem(CoverageItem coverageItem);
+
+ public List<CoverageItem> getCoverageItems(boolean recurse);
+
+ public CoverageItem getCoverageItem(String childUnitOrderNum, String itemOrderNumber);
+
+ public void setName(String name);
+
+ public String getLocation();
+
+ public void setLocation(String location);
+
+ public String getFileContents();
+
+ public void setFileContents(String fileContents);
+
+ public ICoverageUnit getParentCoverageUnit();
+
+ public Result isEditable();
+
+ public KeyedImage getOseeImage();
+
+ public boolean isCovered();
+
+ public ICoverage getParent();
+
+ public void setGuid(String guid);
+
+ public String getNamespace();
+
+ public void setNamespace(String namespace);
+
+ public String getAssignees();
+
+ public void setAssignees(String assignees);
+
+ public boolean isAssignable();
+
+ public String getNotes();
+
+ public void setNotes(String notes);
+
+ public List<CoverageItem> getCoverageItemsCovered(boolean recurse);
+
+ public List<CoverageItem> getCoverageItemsCovered(boolean recurse, CoverageOption... CoverageOption);
+
+ public Collection<? extends ICoverage> getChildren();
+
+ public Collection<? extends ICoverage> getChildren(boolean recurse);
+
+ public void removeCoverageUnit(ICoverageUnit coverageUnit);
+
+ public List<CoverageItem> getCoverageItems();
+
+ public void removeCoverageItem(CoverageItem coverageItem);
+
+ public ICoverageUnit copy(boolean includeItems) throws OseeCoreException;
+
+ public String getCoveragePercentStr();
+
+ public int getCoveragePercent();
+
+ public boolean isFolder();
+
+ public void setFolder(boolean folder);
+
+ public List<CoverageItem> getCoverageItemsCovered(CoverageOption... CoverageOption);
+
+ public void updateAssigneesAndNotes(ICoverageUnit coverageUnit);
+
+ public void setParent(ICoverage parent);
+
+ public String getOrderNumber();
+
+ public void setOrderNumber(String orderNumber);
+
+ public void setFileContentsProvider(ICoverageUnitFileContentsProvider fileContentsProvider);
+
+ public ICoverageUnitFileContentsProvider getFileContentsProvider();
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitFileContentsProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitFileContentsProvider.java
index a3de42e935..f50b18e1af 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitFileContentsProvider.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitFileContentsProvider.java
@@ -8,18 +8,18 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
-/**
- * Allow external mecahnism for coverage unit file contents to be provided to UI. This provides for late loading of
- * large amounts of data that isn't needed often.
- *
- * @author Donald G. Dunne
- */
-public interface ICoverageUnitFileContentsProvider {
-
- public String getFileContents(CoverageUnit coverageUnit);
-
- public void setFileContents(CoverageUnit coverageUnit, String fileContents);
-
-}
+package org.eclipse.osee.coverage.model;
+
+/**
+ * Allow external mecahnism for coverage unit file contents to be provided to UI. This provides for late loading of
+ * large amounts of data that isn't needed often.
+ *
+ * @author Donald G. Dunne
+ */
+public interface ICoverageUnitFileContentsProvider {
+
+ public String getFileContents(CoverageUnit coverageUnit);
+
+ public void setFileContents(CoverageUnit coverageUnit, String fileContents);
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitProvider.java
index a8bfc3b737..9be14557a2 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitProvider.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverageUnitProvider.java
@@ -8,19 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.List;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ICoverageUnitProvider {
-
- public List<CoverageUnit> getCoverageUnits();
-
- public void addCoverageUnit(CoverageUnit coverageUnit);
-
- public void removeCoverageUnit(CoverageUnit coverageUnit);
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ICoverageUnitProvider {
+
+ public List<CoverageUnit> getCoverageUnits();
+
+ public void addCoverageUnit(CoverageUnit coverageUnit);
+
+ public void removeCoverageUnit(CoverageUnit coverageUnit);
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ITestUnitProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ITestUnitProvider.java
index b3fb4b2d56..2083156439 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ITestUnitProvider.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ITestUnitProvider.java
@@ -8,27 +8,27 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.Collection;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * Allow external mechnism for test units to be provided to UI
- *
- * @author Donald G. Dunne
- */
-public interface ITestUnitProvider {
-
- public Collection<String> getTestUnits(CoverageItem coverageItem) throws OseeCoreException;
-
- public void addTestUnit(CoverageItem coverageItem, String testUnitName) throws OseeCoreException;
-
- public void removeTestUnit(CoverageItem coverageItem, String testUnitName) throws OseeCoreException;
-
- public void setTestUnits(CoverageItem coverageItem, Collection<String> testUnitNames) throws OseeCoreException;
-
- public String toXml(CoverageItem coverageItem) throws OseeCoreException;
-
- public void fromXml(CoverageItem coverageItem, String xml) throws OseeCoreException;
-}
+
+/**
+ * Allow external mechnism for test units to be provided to UI
+ *
+ * @author Donald G. Dunne
+ */
+public interface ITestUnitProvider {
+
+ public Collection<String> getTestUnits(CoverageItem coverageItem) throws OseeCoreException;
+
+ public void addTestUnit(CoverageItem coverageItem, String testUnitName) throws OseeCoreException;
+
+ public void removeTestUnit(CoverageItem coverageItem, String testUnitName) throws OseeCoreException;
+
+ public void setTestUnits(CoverageItem coverageItem, Collection<String> testUnitNames) throws OseeCoreException;
+
+ public String toXml(CoverageItem coverageItem) throws OseeCoreException;
+
+ public void fromXml(CoverageItem coverageItem, String xml) throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java
index 828e7236a1..bfdc5eceff 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java
@@ -8,114 +8,114 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.model;
-
+package org.eclipse.osee.coverage.model;
+
import java.util.Collection;
import java.util.Collections;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.ui.plugin.util.Result;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class MessageCoverageItem implements ICoverage {
-
- private final String message;
-
- public MessageCoverageItem(String message) {
- this.message = message;
- }
-
- @Override
- public String getName() {
- return message;
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren() {
- return Collections.emptyList();
- }
-
- @Override
- public Collection<? extends ICoverage> getChildren(boolean recurse) {
- return Collections.emptyList();
- }
-
- @Override
- public String getAssignees() throws OseeCoreException {
- return "";
- }
-
- @Override
- public Double getCoveragePercent() {
- return 0.0;
- }
-
- @Override
- public String getCoveragePercentStr() {
- return "";
- }
-
- @Override
- public String getFileContents() throws OseeCoreException {
- return null;
- }
-
- @Override
- public String getGuid() {
- return null;
- }
-
- @Override
- public String getLocation() {
- return null;
- }
-
- @Override