Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2010-07-24 08:02:08 +0000
committerrbrooks2010-07-24 08:02:08 +0000
commit4ed8bddc791fda93940f238c5135556a07041dc0 (patch)
tree64a118285c5006c3a38320dbb2d374e8ea72a061 /plugins/org.eclipse.osee.ote.ui.define
parent542cc7344d3f129d64e47f547384297c8e1b1f43 (diff)
downloadorg.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.gz
org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.xz
org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.zip
converted all line terminators to unix style
Diffstat (limited to 'plugins/org.eclipse.osee.ote.ui.define')
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/.classpath14
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/.project56
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/build.properties16
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/help/testRunView.html26
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/plugin.xml380
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteDefineImage.java124
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteUiDefinePlugin.java76
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/CommitDialog.java312
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/OverrideInvalidScriptRevisions.java58
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ReportsDialog.java1038
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ResourceSelectionDialog.java92
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportPage.java684
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportWizard.java128
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/AddArtifactsToViewerJob.java72
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/CommitJobDialog.java358
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/CommentComposite.java88
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/IOverrideHandler.java30
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/ListSelectionPanel.java162
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/SelectionComposite.java752
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HighLevelSummary.java316
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HistoricalTestRunData.java232
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/ITestRunReport.java48
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTable.java396
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTableColumnData.java218
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlTableReport.java124
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/ExcelReportWriter.java138
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/HtmlReportWriter.java112
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/OutputFormat.java44
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/CommitConfiguration.java66
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/EditorUtility.java112
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/HtmlStringUtils.java36
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/SelectionHelper.java124
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/DragDropHandler.java426
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/IDataChangedListener.java18
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewer.java602
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewerFactory.java174
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/AbstractActionHandler.java76
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/EditDispositionAction.java136
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedScript.java118
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenInArtifactEditor.java136
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/ArtifactItem.java652
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/BranchItem.java150
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/DataItemLabelProvider.java102
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/IXViewerItem.java26
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/TestRunView.java560
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/FlatPresentationHandler.java22
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/GroupedPresentationHandler.java22
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/LongNamesPresentationHandler.java22
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ShortNamesPresentationHandler.java22
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ToggleFilterHandler.java40
50 files changed, 4868 insertions, 4868 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.define/.classpath b/plugins/org.eclipse.osee.ote.ui.define/.classpath
index 8a8f1668cdc..ad32c83a788 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/.classpath
+++ b/plugins/org.eclipse.osee.ote.ui.define/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.ote.ui.define/.project b/plugins/org.eclipse.osee.ote.ui.define/.project
index 97c63cfa9bd..11018edaaa0 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/.project
+++ b/plugins/org.eclipse.osee.ote.ui.define/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.ote.ui.define</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.ote.ui.define</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.ote.ui.define/build.properties b/plugins/org.eclipse.osee.ote.ui.define/build.properties
index 7a8fcc1a09c..97ff2f7c567 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/build.properties
+++ b/plugins/org.eclipse.osee.ote.ui.define/build.properties
@@ -1,8 +1,8 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- images/,\
- templates/,\
- help/
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ images/,\
+ templates/,\
+ help/
diff --git a/plugins/org.eclipse.osee.ote.ui.define/help/testRunView.html b/plugins/org.eclipse.osee.ote.ui.define/help/testRunView.html
index aab128ef4a1..1c5beff934a 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/help/testRunView.html
+++ b/plugins/org.eclipse.osee.ote.ui.define/help/testRunView.html
@@ -1,14 +1,14 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-</head>
-<body>
-<h1>Test Run View</h1>
-
-<img src="testrunview.jpg"/>
-
-<p>
-The test run view is used for viewing test run results. It can view a summary of output files that exist on a file system and it will upload those output files to the OSEE data store. It can also be used to view previous test runs that have been uploaded to the OSEE data store.
-</p>
-</body>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+<h1>Test Run View</h1>
+
+<img src="testrunview.jpg"/>
+
+<p>
+The test run view is used for viewing test run results. It can view a summary of output files that exist on a file system and it will upload those output files to the OSEE data store. It can also be used to view previous test runs that have been uploaded to the OSEE data store.
+</p>
+</body>
</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.define/plugin.xml b/plugins/org.eclipse.osee.ote.ui.define/plugin.xml
index d989b37806e..0aa9d779a07 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/plugin.xml
+++ b/plugins/org.eclipse.osee.ote.ui.define/plugin.xml
@@ -1,191 +1,191 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="ITestRunReport" name="ITestRunReport" schema="schema/ITestRunReport.exsd"/>
- <extension
- point="org.eclipse.ui.importWizards">
- <wizard
- category="org.eclipse.osee.define.import.category"
- class="org.eclipse.osee.ote.ui.define.importer.OutfileImportWizard"
- icon="images/outfile_import.gif"
- id="org.eclipse.osee.ote.ui.define.importer.outfileImportWizard"
- name="Test Outfiles">
- </wizard>
- </extension>
- <extension
- point="org.eclipse.ui.views">
- <category
- id="osee.test.category"
- name="OSEE Test">
- </category>
- <view
- allowMultiple="false"
- category="osee.test.category"
- class="org.eclipse.osee.ote.ui.define.views.TestRunView"
- icon="images/testRunView.gif"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView"
- name="Test Run View">
- </view>
- </extension>
- <extension
- point="org.eclipse.osee.framework.ui.plugin.XNavigateItem">
- <XNavigateItem
- classname="org.eclipse.osee.ote.ui.define.views.TestRunViewNavigateItem"
- viewId="org.eclipse.osee.ote.ui.navigate.OteNavigateView">
- </XNavigateItem>
- </extension>
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="org.eclipse.osee.ote.ui.TestPerspective">
- <viewShortcut
- id="org.eclipse.osee.ote.ui.define.views.TestRunView">
- </viewShortcut>
- </perspectiveExtension>
- </extension>
- <extension
- point="org.eclipse.osee.framework.skynet.core.HttpServerRequest">
- <IHttpServerRequest
- classname="org.eclipse.osee.ote.ui.define.reports.HttpReportRequest">
- </IHttpServerRequest>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- description="Display test runs grouped by branch"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.flatPresentation.command"
- name="By Branch">
- </command>
- <command
- description="Displays test runs grouped by script name and revision"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.groupedPresentation.command"
- name="By Script Revision">
- </command>
- <command
- description="Displays items in long notation"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.longNamesPresentation.command"
- name="Long">
- </command>
- <command
- description="Displays items in short notation"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.shortNamesPresentation.command"
- name="Short">
- </command>
- <command
- description="Displays the latest test run of each script."
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.latestOnlyFilterHandler.command"
- name="Show only the latest run">
- </command>
- </extension>
- <extension
- name="Test Run View Commands"
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.osee.ote.ui.define.views.handlers.FlatPresentationHandler"
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.flatPresentation.command">
- </handler>
- <handler
- class="org.eclipse.osee.ote.ui.define.views.handlers.GroupedPresentationHandler"
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.groupedPresentation.command">
- </handler>
- <handler
- class="org.eclipse.osee.ote.ui.define.views.handlers.LongNamesPresentationHandler"
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.longNamesPresentation.command">
- </handler>
- <handler
- class="org.eclipse.osee.ote.ui.define.views.handlers.ShortNamesPresentationHandler"
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.shortNamesPresentation.command">
- </handler>
- <handler
- class="org.eclipse.osee.ote.ui.define.views.handlers.ToggleFilterHandler"
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.latestOnlyFilterHandler.command">
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:org.eclipse.osee.ote.ui.define.views.TestRunView">
- <menu
- label="Group By">
- <command
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.groupedPresentation.command"
- icon="images/tree_layout.gif"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.groupedCommand"
- style="radio">
- </command>
- <command
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.flatPresentation.command"
- icon="images/flat_layout.gif"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.flatCommand"
- style="radio">
- </command>
- </menu>
- <menu
- label="Notation">
- <command
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.longNamesPresentation.command"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.longNamesCommand"
- style="radio">
- </command>
- <command
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.shortNamesPresentation.command"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.shortNamesCommand"
- style="radio">
- </command>
- </menu>
- <menu
- label="Filters">
- <command
- commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.latestOnlyFilterHandler.command"
- icon="images/latest_versions.gif"
- id="org.eclipse.osee.ote.ui.define.views.TestRunView.latestOnlyFilterCommand"
- style="toggle">
- </command>
- </menu>
- </menuContribution>
- </extension>
- <extension
- id="org.eclipse.osee.ote.ui.define.reports.HighLevelSummary"
- name="High Level Test Run Summary"
- point="org.eclipse.osee.ote.ui.define.ITestRunReport">
- <ITestRunReport
- classname="org.eclipse.osee.ote.ui.define.reports.HighLevelSummary"
- icon="images/latest_versions.gif">
- </ITestRunReport>
- </extension>
- <extension
- id="org.eclipse.osee.ote.ui.define.reports.HistoricalTestRunData"
- name="Historical Test Run Report"
- point="org.eclipse.osee.ote.ui.define.ITestRunReport">
- <ITestRunReport
- classname="org.eclipse.osee.ote.ui.define.reports.HistoricalTestRunData"
- icon="images/latest_versions.gif">
- </ITestRunReport>
- </extension>
- <extension
- point="org.eclipse.osee.framework.ui.plugin.PropertyStoreControl">
- <PropertyStoreControl
- classname="org.eclipse.osee.ote.ui.define.views.TestRunArtifactOptions"
- viewId="org.eclipse.osee.ote.ui.test.manager">
- </PropertyStoreControl>
- </extension>
- <extension
- point="org.eclipse.help.contexts">
- <contexts
- file="help/contexts.xml">
- </contexts>
- </extension>
- <extension
- point="org.eclipse.help.toc">
- <toc
- file="help/toc.xml"
- primary="false">
- </toc>
- </extension>
- <extension
- point="org.eclipse.osee.framework.ui.skynet.ArtifactImageProvider">
- <ArtifactImageProvider
- class="org.eclipse.osee.ote.ui.define.OteArtifactImageProvider">
- </ArtifactImageProvider>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="ITestRunReport" name="ITestRunReport" schema="schema/ITestRunReport.exsd"/>
+ <extension
+ point="org.eclipse.ui.importWizards">
+ <wizard
+ category="org.eclipse.osee.define.import.category"
+ class="org.eclipse.osee.ote.ui.define.importer.OutfileImportWizard"
+ icon="images/outfile_import.gif"
+ id="org.eclipse.osee.ote.ui.define.importer.outfileImportWizard"
+ name="Test Outfiles">
+ </wizard>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="osee.test.category"
+ name="OSEE Test">
+ </category>
+ <view
+ allowMultiple="false"
+ category="osee.test.category"
+ class="org.eclipse.osee.ote.ui.define.views.TestRunView"
+ icon="images/testRunView.gif"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView"
+ name="Test Run View">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.osee.framework.ui.plugin.XNavigateItem">
+ <XNavigateItem
+ classname="org.eclipse.osee.ote.ui.define.views.TestRunViewNavigateItem"
+ viewId="org.eclipse.osee.ote.ui.navigate.OteNavigateView">
+ </XNavigateItem>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.osee.ote.ui.TestPerspective">
+ <viewShortcut
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView">
+ </viewShortcut>
+ </perspectiveExtension>
+ </extension>
+ <extension
+ point="org.eclipse.osee.framework.skynet.core.HttpServerRequest">
+ <IHttpServerRequest
+ classname="org.eclipse.osee.ote.ui.define.reports.HttpReportRequest">
+ </IHttpServerRequest>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="Display test runs grouped by branch"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.flatPresentation.command"
+ name="By Branch">
+ </command>
+ <command
+ description="Displays test runs grouped by script name and revision"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.groupedPresentation.command"
+ name="By Script Revision">
+ </command>
+ <command
+ description="Displays items in long notation"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.longNamesPresentation.command"
+ name="Long">
+ </command>
+ <command
+ description="Displays items in short notation"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.shortNamesPresentation.command"
+ name="Short">
+ </command>
+ <command
+ description="Displays the latest test run of each script."
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.latestOnlyFilterHandler.command"
+ name="Show only the latest run">
+ </command>
+ </extension>
+ <extension
+ name="Test Run View Commands"
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.osee.ote.ui.define.views.handlers.FlatPresentationHandler"
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.flatPresentation.command">
+ </handler>
+ <handler
+ class="org.eclipse.osee.ote.ui.define.views.handlers.GroupedPresentationHandler"
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.groupedPresentation.command">
+ </handler>
+ <handler
+ class="org.eclipse.osee.ote.ui.define.views.handlers.LongNamesPresentationHandler"
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.longNamesPresentation.command">
+ </handler>
+ <handler
+ class="org.eclipse.osee.ote.ui.define.views.handlers.ShortNamesPresentationHandler"
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.shortNamesPresentation.command">
+ </handler>
+ <handler
+ class="org.eclipse.osee.ote.ui.define.views.handlers.ToggleFilterHandler"
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.latestOnlyFilterHandler.command">
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.osee.ote.ui.define.views.TestRunView">
+ <menu
+ label="Group By">
+ <command
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.groupedPresentation.command"
+ icon="images/tree_layout.gif"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.groupedCommand"
+ style="radio">
+ </command>
+ <command
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.flatPresentation.command"
+ icon="images/flat_layout.gif"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.flatCommand"
+ style="radio">
+ </command>
+ </menu>
+ <menu
+ label="Notation">
+ <command
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.longNamesPresentation.command"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.longNamesCommand"
+ style="radio">
+ </command>
+ <command
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.shortNamesPresentation.command"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.shortNamesCommand"
+ style="radio">
+ </command>
+ </menu>
+ <menu
+ label="Filters">
+ <command
+ commandId="org.eclipse.osee.ote.ui.define.views.TestRunView.latestOnlyFilterHandler.command"
+ icon="images/latest_versions.gif"
+ id="org.eclipse.osee.ote.ui.define.views.TestRunView.latestOnlyFilterCommand"
+ style="toggle">
+ </command>
+ </menu>
+ </menuContribution>
+ </extension>
+ <extension
+ id="org.eclipse.osee.ote.ui.define.reports.HighLevelSummary"
+ name="High Level Test Run Summary"
+ point="org.eclipse.osee.ote.ui.define.ITestRunReport">
+ <ITestRunReport
+ classname="org.eclipse.osee.ote.ui.define.reports.HighLevelSummary"
+ icon="images/latest_versions.gif">
+ </ITestRunReport>
+ </extension>
+ <extension
+ id="org.eclipse.osee.ote.ui.define.reports.HistoricalTestRunData"
+ name="Historical Test Run Report"
+ point="org.eclipse.osee.ote.ui.define.ITestRunReport">
+ <ITestRunReport
+ classname="org.eclipse.osee.ote.ui.define.reports.HistoricalTestRunData"
+ icon="images/latest_versions.gif">
+ </ITestRunReport>
+ </extension>
+ <extension
+ point="org.eclipse.osee.framework.ui.plugin.PropertyStoreControl">
+ <PropertyStoreControl
+ classname="org.eclipse.osee.ote.ui.define.views.TestRunArtifactOptions"
+ viewId="org.eclipse.osee.ote.ui.test.manager">
+ </PropertyStoreControl>
+ </extension>
+ <extension
+ point="org.eclipse.help.contexts">
+ <contexts
+ file="help/contexts.xml">
+ </contexts>
+ </extension>
+ <extension
+ point="org.eclipse.help.toc">
+ <toc
+ file="help/toc.xml"
+ primary="false">
+ </toc>
+ </extension>
+ <extension
+ point="org.eclipse.osee.framework.ui.skynet.ArtifactImageProvider">
+ <ArtifactImageProvider
+ class="org.eclipse.osee.ote.ui.define.OteArtifactImageProvider">
+ </ArtifactImageProvider>
</extension>
-</plugin>
+</plugin>
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteDefineImage.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteDefineImage.java
index f82cf832005..cbf9750db75 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteDefineImage.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteDefineImage.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * 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.ote.ui.define;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Andrew M. Finkbeiner
- * @author Ryan Schmitt
- */
-public enum OteDefineImage implements KeyedImage {
- ADDITION("addition.gif"),
- CHECKBOX_ENABLED("chkbox_enabled.gif"),
- CHECKBOX_DISABLED("chkbox_disabled.gif"),
- CHILD_BRANCH("childBranch.gif"),
- COLLAPSE_STATE("collapseState.gif"),
- COMMIT("commit.gif"),
- COMMIT_WIZ("commit_wiz.png"),
- CONFAUTO_OV("confauto_ov.gif"),
- DELETE("delete.gif"),
- DELETE_ALL("deleteAll.gif"),
- EXPAND_STATE("expandState.gif"),
- OBSTRUCTED("obstructed.gif"),
- OBSTRUCTED_16_BY_16("obstructed_16x16.gif"),
- REFRESH("refresh.gif"),
- REMOVE("remove.gif"),
- REMOVE_ALL("removeAll.gif"),
- SWITCHED("switched.gif"),
- TEST_CASE("file.gif"),
- TEST_CONFIG("config.gif"),
- TEST_PROCEDURE("procedure.gif"),
- TEST_RUN("testrun.gif"),
- TEST_RUN_VIEW("testRunView.gif"),
- TEST_SUPPORT("function.gif"),
-
- VERSION_CONTROLLED("version_controlled.gif");
-
- private final String fileName;
-
- private OteDefineImage(String fileName) {
- this.fileName = fileName;
- }
-
- @Override
- public ImageDescriptor createImageDescriptor() {
- return ImageManager.createImageDescriptor(OteUiDefinePlugin.PLUGIN_ID, "images", fileName);
- }
-
- @Override
- public String getImageKey() {
- return OteUiDefinePlugin.PLUGIN_ID + ".images." + fileName;
- }
+/*******************************************************************************
+ * 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.ote.ui.define;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+
+/**
+ * @author Andrew M. Finkbeiner
+ * @author Ryan Schmitt
+ */
+public enum OteDefineImage implements KeyedImage {
+ ADDITION("addition.gif"),
+ CHECKBOX_ENABLED("chkbox_enabled.gif"),
+ CHECKBOX_DISABLED("chkbox_disabled.gif"),
+ CHILD_BRANCH("childBranch.gif"),
+ COLLAPSE_STATE("collapseState.gif"),
+ COMMIT("commit.gif"),
+ COMMIT_WIZ("commit_wiz.png"),
+ CONFAUTO_OV("confauto_ov.gif"),
+ DELETE("delete.gif"),
+ DELETE_ALL("deleteAll.gif"),
+ EXPAND_STATE("expandState.gif"),
+ OBSTRUCTED("obstructed.gif"),
+ OBSTRUCTED_16_BY_16("obstructed_16x16.gif"),
+ REFRESH("refresh.gif"),
+ REMOVE("remove.gif"),
+ REMOVE_ALL("removeAll.gif"),
+ SWITCHED("switched.gif"),
+ TEST_CASE("file.gif"),
+ TEST_CONFIG("config.gif"),
+ TEST_PROCEDURE("procedure.gif"),
+ TEST_RUN("testrun.gif"),
+ TEST_RUN_VIEW("testRunView.gif"),
+ TEST_SUPPORT("function.gif"),
+
+ VERSION_CONTROLLED("version_controlled.gif");
+
+ private final String fileName;
+
+ private OteDefineImage(String fileName) {
+ this.fileName = fileName;
+ }
+
+ @Override
+ public ImageDescriptor createImageDescriptor() {
+ return ImageManager.createImageDescriptor(OteUiDefinePlugin.PLUGIN_ID, "images", fileName);
+ }
+
+ @Override
+ public String getImageKey() {
+ return OteUiDefinePlugin.PLUGIN_ID + ".images." + fileName;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteUiDefinePlugin.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteUiDefinePlugin.java
index e8ffe635087..7254803d3f9 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteUiDefinePlugin.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/OteUiDefinePlugin.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.ote.ui.define;
-
-import org.eclipse.osee.framework.ui.plugin.OseeUiActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class OteUiDefinePlugin extends OseeUiActivator {
-
- public static final String PLUGIN_ID = "org.eclipse.osee.ote.ui.define";
-
- private static OteUiDefinePlugin plugin;
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- public static OteUiDefinePlugin getInstance() {
- return plugin;
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define;
+
+import org.eclipse.osee.framework.ui.plugin.OseeUiActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class OteUiDefinePlugin extends OseeUiActivator {
+
+ public static final String PLUGIN_ID = "org.eclipse.osee.ote.ui.define";
+
+ private static OteUiDefinePlugin plugin;
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static OteUiDefinePlugin getInstance() {
+ return plugin;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/CommitDialog.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/CommitDialog.java
index d3bbedb9d2b..bb2663fcc20 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/CommitDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/CommitDialog.java
@@ -1,156 +1,156 @@
-/*******************************************************************************
- * 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.ote.ui.define.dialogs;
-
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.osee.ote.ui.define.panels.CommentComposite;
-import org.eclipse.osee.ote.ui.define.panels.IOverrideHandler;
-import org.eclipse.osee.ote.ui.define.panels.SelectionComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CommitDialog extends TitleAreaDialog {
-
- private static final Image MESSAGE_IMAGE = ImageManager.getImage(OteDefineImage.COMMIT_WIZ);
- private static final Image TITLE_BAR_IMAGE = ImageManager.getImage(OteDefineImage.COMMIT);
-
- private static final String MESSAGE_TITLE = "Enter a commit comment";
- private static final String TITLE_BAR_TEXT = "OSEE Commit";
- private static final String COMMENT_GROUP_TEXT = "Comment";
- private static final String MESSAGE =
- "You can specify a comment describing the changes in the area below. " + "Empty comments are allowed, but adding a comment would help others understand your changes. \n";
- private static final String CONFLICT_MESSAGE =
- "NOTE: Exclamation marks denote items that already exist in the repository or are missing revision infromation. These items will not be committed. \n";
-
- private SelectionComposite selectionComposite;
- private CommentComposite commentComposite;
- private final ITableLabelProvider tableLabelProvider;
- private Object[] selectable;
- private Object[] unselectable;
- private Object[] selected;
- private final String[] columnNames;
- private IOverrideHandler overrideHandler;
-
- public CommitDialog(Shell parent, String[] columnNames, ITableLabelProvider tableLabelProvider) {
- super(parent);
- setShellStyle(SWT.SHELL_TRIM);
- this.columnNames = columnNames;
- this.tableLabelProvider = tableLabelProvider;
- this.selectable = this.selected = new Object[0];
- this.overrideHandler = null;
- }
-
- @Override
- protected Control createButtonBar(Composite parent) {
- Label separator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
- separator.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
- return super.createButtonBar(parent);
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite content = (Composite) super.createDialogArea(parent);
-
- Composite composite = new Composite(content, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- SashForm sash = new SashForm(composite, SWT.VERTICAL);
- sash.setLayout(new GridLayout());
- sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- createCommentArea(sash);
- createCommitArea(sash);
- sash.setWeights(new int[] {1, 2});
-
- setTitle(MESSAGE_TITLE);
- setTitleImage(MESSAGE_IMAGE);
- setMessage(MESSAGE + (unselectable != null && unselectable.length > 0 ? CONFLICT_MESSAGE : ""));
- getShell().setText(TITLE_BAR_TEXT);
- getShell().setImage(TITLE_BAR_IMAGE);
- return sash;
- }
-
- private void createCommentArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true));
-
- Group group = new Group(composite, SWT.NONE);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- group.setText(COMMENT_GROUP_TEXT);
-
- commentComposite = new CommentComposite(group, SWT.NONE);
- commentComposite.setLayout(new GridLayout());
- commentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- separator.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
- }
-
- private void createCommitArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.verticalSpacing = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- selectionComposite =
- new SelectionComposite(composite, SWT.BORDER, columnNames, tableLabelProvider, selectable, true, selected,
- unselectable, overrideHandler);
- selectionComposite.setLayout(new GridLayout());
- selectionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- }
-
- public void setInput(Object[] input) {
- this.selectable = input;
- }
-
- public void setSelected(Object[] selected) {
- this.selected = selected;
- }
-
- public void setUnSelectable(Object[] unselectable) {
- this.unselectable = unselectable;
- }
-
- public void setOverrideHandler(IOverrideHandler overrideHandler) {
- this.overrideHandler = overrideHandler;
- }
-
- public String getComments() {
- return commentComposite.getMessage();
- }
-
- public Object[] getSelectedResources() {
- return selectionComposite.getSelectedResources();
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.dialogs;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.osee.ote.ui.define.panels.CommentComposite;
+import org.eclipse.osee.ote.ui.define.panels.IOverrideHandler;
+import org.eclipse.osee.ote.ui.define.panels.SelectionComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CommitDialog extends TitleAreaDialog {
+
+ private static final Image MESSAGE_IMAGE = ImageManager.getImage(OteDefineImage.COMMIT_WIZ);
+ private static final Image TITLE_BAR_IMAGE = ImageManager.getImage(OteDefineImage.COMMIT);
+
+ private static final String MESSAGE_TITLE = "Enter a commit comment";
+ private static final String TITLE_BAR_TEXT = "OSEE Commit";
+ private static final String COMMENT_GROUP_TEXT = "Comment";
+ private static final String MESSAGE =
+ "You can specify a comment describing the changes in the area below. " + "Empty comments are allowed, but adding a comment would help others understand your changes. \n";
+ private static final String CONFLICT_MESSAGE =
+ "NOTE: Exclamation marks denote items that already exist in the repository or are missing revision infromation. These items will not be committed. \n";
+
+ private SelectionComposite selectionComposite;
+ private CommentComposite commentComposite;
+ private final ITableLabelProvider tableLabelProvider;
+ private Object[] selectable;
+ private Object[] unselectable;
+ private Object[] selected;
+ private final String[] columnNames;
+ private IOverrideHandler overrideHandler;
+
+ public CommitDialog(Shell parent, String[] columnNames, ITableLabelProvider tableLabelProvider) {
+ super(parent);
+ setShellStyle(SWT.SHELL_TRIM);
+ this.columnNames = columnNames;
+ this.tableLabelProvider = tableLabelProvider;
+ this.selectable = this.selected = new Object[0];
+ this.overrideHandler = null;
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Label separator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
+ return super.createButtonBar(parent);
+ }
+
+ /*
+ * @see Dialog#createDialogArea(Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite content = (Composite) super.createDialogArea(parent);
+
+ Composite composite = new Composite(content, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ SashForm sash = new SashForm(composite, SWT.VERTICAL);
+ sash.setLayout(new GridLayout());
+ sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ createCommentArea(sash);
+ createCommitArea(sash);
+ sash.setWeights(new int[] {1, 2});
+
+ setTitle(MESSAGE_TITLE);
+ setTitleImage(MESSAGE_IMAGE);
+ setMessage(MESSAGE + (unselectable != null && unselectable.length > 0 ? CONFLICT_MESSAGE : ""));
+ getShell().setText(TITLE_BAR_TEXT);
+ getShell().setImage(TITLE_BAR_IMAGE);
+ return sash;
+ }
+
+ private void createCommentArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true));
+
+ Group group = new Group(composite, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ group.setText(COMMENT_GROUP_TEXT);
+
+ commentComposite = new CommentComposite(group, SWT.NONE);
+ commentComposite.setLayout(new GridLayout());
+ commentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
+ }
+
+ private void createCommitArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.verticalSpacing = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ selectionComposite =
+ new SelectionComposite(composite, SWT.BORDER, columnNames, tableLabelProvider, selectable, true, selected,
+ unselectable, overrideHandler);
+ selectionComposite.setLayout(new GridLayout());
+ selectionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ }
+
+ public void setInput(Object[] input) {
+ this.selectable = input;
+ }
+
+ public void setSelected(Object[] selected) {
+ this.selected = selected;
+ }
+
+ public void setUnSelectable(Object[] unselectable) {
+ this.unselectable = unselectable;
+ }
+
+ public void setOverrideHandler(IOverrideHandler overrideHandler) {
+ this.overrideHandler = overrideHandler;
+ }
+
+ public String getComments() {
+ return commentComposite.getMessage();
+ }
+
+ public Object[] getSelectedResources() {
+ return selectionComposite.getSelectedResources();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/OverrideInvalidScriptRevisions.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/OverrideInvalidScriptRevisions.java
index 8a06ddd02ca..bc680967e21 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/OverrideInvalidScriptRevisions.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/OverrideInvalidScriptRevisions.java
@@ -8,38 +8,38 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.dialogs;
-
+package org.eclipse.osee.ote.ui.define.dialogs;
+
import java.util.HashSet;
import java.util.Set;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
import org.eclipse.osee.ote.ui.define.panels.IOverrideHandler;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OverrideInvalidScriptRevisions implements IOverrideHandler {
-
- public String getText() {
- return "Allow Invalid Script Revisions.";
- }
-
- public String getToolTipText() {
- return "Allows invalid script revisions to be committed.\nWARNING: Duplicate commits are not overridable.";
- }
-
- public Set<Object> getOverridableFromUnselectable(Set<Object> unselectable) throws OseeCoreException {
- Set<Object> toReturn = new HashSet<Object>();
- for (Object object : unselectable) {
- if (object instanceof Artifact) {
- TestRunOperator operator = new TestRunOperator(((Artifact) object));
- if (operator.hasNotBeenCommitted() != false) {
- toReturn.add(object);
- }
- }
- }
- return toReturn;
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OverrideInvalidScriptRevisions implements IOverrideHandler {
+
+ public String getText() {
+ return "Allow Invalid Script Revisions.";
+ }
+
+ public String getToolTipText() {
+ return "Allows invalid script revisions to be committed.\nWARNING: Duplicate commits are not overridable.";
+ }
+
+ public Set<Object> getOverridableFromUnselectable(Set<Object> unselectable) throws OseeCoreException {
+ Set<Object> toReturn = new HashSet<Object>();
+ for (Object object : unselectable) {
+ if (object instanceof Artifact) {
+ TestRunOperator operator = new TestRunOperator(((Artifact) object));
+ if (operator.hasNotBeenCommitted() != false) {
+ toReturn.add(object);
+ }
+ }
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ReportsDialog.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ReportsDialog.java
index 88f30d85277..714fcd96214 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ReportsDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ReportsDialog.java
@@ -1,519 +1,519 @@
-/*******************************************************************************
- * 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.ote.ui.define.dialogs;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.osee.ote.define.jobs.RemoteResourceRequestJob;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.osee.ote.ui.define.panels.ListSelectionPanel;
-import org.eclipse.osee.ote.ui.define.panels.PreviewPanel;
-import org.eclipse.osee.ote.ui.define.panels.PreviewPanel.PanelEnum;
-import org.eclipse.osee.ote.ui.define.reports.ExtensionDefinedReports;
-import org.eclipse.osee.ote.ui.define.reports.HttpReportRequest;
-import org.eclipse.osee.ote.ui.define.reports.ITestRunReport;
-import org.eclipse.osee.ote.ui.define.reports.output.OutputFactory;
-import org.eclipse.osee.ote.ui.define.reports.output.OutputFormat;
-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.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ReportsDialog extends TitleAreaDialog {
- private static final Image MESSAGE_IMAGE = ImageManager.getImage(OteDefineImage.COMMIT_WIZ);
- private static final Image TITLE_BAR_IMAGE = ImageManager.getImage(OteDefineImage.COMMIT);
-
- private static final String MESSAGE_TITLE = "Select a report";
- private static final String TITLE_BAR_TEXT = "OSEE Test Run Reports";
- private static final String MESSAGE = "The preview window displays an example of the selected report.";
- private static final String REPORT_SELECTION_TITLE = "Select a Report";
- private static final String PREVIEW_TITLE = "Preview";
- private static final String FORMAT_TITLE = "Select a Format";
- private static final String REPORT_DESCRIPTION = "Report Description";
- private static final String PREVIEW_DESCRIPTION = "Enter Preview Size";
-
- private static final String REPORT_STORE_ID = ReportsDialog.class.getName() + ".reportId";
- private static final String FORMAT_STORE_ID = ReportsDialog.class.getName() + ".formatId";
- private static final String PREVIEW_SIZE_STORE_ID = ReportsDialog.class.getName() + ".previewSize";
-
- private static final int DEFAULT_PREVIEW_SIZE = 5;
-
- private PreviewPanel previewPanel;
- private org.eclipse.osee.ote.ui.define.panels.ListSelectionPanel listSelectionPanel;
- private SelectionChangedListener selectionChangedListener;
- private Text descriptionArea;
- private Text previewSizeArea;
- private String selectedReportId;
- private OutputFormat selectedReportFormat;
- private final List<IFile> filesToDelete;
- private Map<OutputFormat, Button> formatButtons;
-
- public ReportsDialog(Shell parent) {
- super(parent);
- this.filesToDelete = new ArrayList<IFile>();
- setShellStyle(SWT.SHELL_TRIM);
- }
-
- @Override
- protected Control createButtonBar(Composite parent) {
- Label separator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
- separator.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
- return super.createButtonBar(parent);
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite content = (Composite) super.createDialogArea(parent);
-
- Composite composite = new Composite(content, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setFont(parent.getFont());
-
- SashForm sash = new SashForm(composite, SWT.HORIZONTAL);
- sash.setLayout(new GridLayout());
- sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- sash.setFont(parent.getFont());
-
- createReportSelectionArea(sash);
-
- Composite panel = new Composite(sash, SWT.NONE);
- GridLayout gL1 = new GridLayout();
- gL1.marginHeight = 0;
- gL1.marginWidth = 0;
- panel.setLayout(gL1);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- createFormatAndDescriptionArea(panel);
- createPreviewArea(panel);
- sash.setWeights(new int[] {1, 2});
-
- setTitle(MESSAGE_TITLE);
- setTitleImage(MESSAGE_IMAGE);
- setMessage(MESSAGE);
- getShell().setText(TITLE_BAR_TEXT);
- getShell().setImage(TITLE_BAR_IMAGE);
- attachListeners();
- restoreDialog();
- return sash;
- }
-
- private void restoreDialog() {
- IDialogSettings settings = OteUiDefinePlugin.getInstance().getDialogSettings();
- if (settings != null) {
- String reportSelected = settings.get(REPORT_STORE_ID);
- String format = settings.get(FORMAT_STORE_ID);
-
- int value = 0;
- try {
- value = settings.getInt(PREVIEW_SIZE_STORE_ID);
- } catch (Exception ex) {
- value = DEFAULT_PREVIEW_SIZE;
- }
- clamp(previewSizeArea, value);
-
- OutputFormat outputFormat = OutputFormat.HTML;
- int index = 0;
- if (Strings.isValid(reportSelected) && Strings.isValid(format)) {
- Pair<String, String> pair = ExtensionDefinedReports.getInstance().getIdAndName(reportSelected);
- index = listSelectionPanel.indexOf(pair);
- outputFormat = OutputFormat.fromString(format);
- }
- if (index > -1) {
- listSelectionPanel.setSelection(index);
- }
- setReportFormat(outputFormat);
- for (OutputFormat key : formatButtons.keySet()) {
- Button button = formatButtons.get(key);
- button.setSelection(key.equals(outputFormat));
- }
- }
- }
-
- private void saveDialog() {
- IDialogSettings settings = OteUiDefinePlugin.getInstance().getDialogSettings();
- if (settings != null) {
- String reportSelected = getReportSelected();
- String format = getReportFormat();
- int previewSize = getPreviewSize();
- settings.put(REPORT_STORE_ID, reportSelected);
- settings.put(FORMAT_STORE_ID, format);
- settings.put(PREVIEW_SIZE_STORE_ID, previewSize);
- }
- }
-
- @Override
- protected void okPressed() {
- saveDialog();
- cleanUp(filesToDelete);
- super.okPressed();
- }
-
- private void createReportSelectionArea(Composite parent) {
- Group composite = new Group(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setFont(parent.getFont());
- composite.setText(REPORT_SELECTION_TITLE);
-
- listSelectionPanel = new ListSelectionPanel(composite, SWT.NONE, 300, 300, new ListLabelProvider());
- listSelectionPanel.setSorter(new ViewerSorter() {
-
- @Override
- @SuppressWarnings("unchecked")
- public int compare(Viewer viewer, Object o1, Object o2) {
- Pair<String, String> pair1 = (Pair<String, String>) o1;
- Pair<String, String> pair2 = (Pair<String, String>) o2;
- return getComparator().compare(pair1.getSecond(), pair2.getSecond());
- }
-
- });
- Pair<String, String>[] reportNames = ExtensionDefinedReports.getInstance().getIdsAndNames();
- listSelectionPanel.setInput(reportNames);
- listSelectionPanel.setSelection(0);
- }
-
- private void createFormatAndDescriptionArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gL = new GridLayout(2, false);
- gL.marginHeight = 0;
- gL.marginWidth = 0;
- composite.setLayout(gL);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- createFormatArea(composite);
-
- Composite panel = new Composite(composite, SWT.NONE);
- GridLayout gL1 = new GridLayout();
- gL1.marginHeight = 0;
- gL1.marginWidth = 0;
- panel.setLayout(gL1);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- createDescriptionArea(panel);
- createPreviewSizeArea(panel);
- }
-
- private void createPreviewSizeArea(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout(2, false));
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- group.setFont(parent.getFont());
- group.setText(PREVIEW_DESCRIPTION);
-
- previewSizeArea = new Text(group, SWT.SINGLE | SWT.BORDER);
- previewSizeArea.setTextLimit(2);
- GridData gd = new GridData(SWT.RIGHT, SWT.FILL, false, false);
- gd.heightHint = convertHeightInCharsToPixels(1);
- gd.widthHint = convertWidthInCharsToPixels(4);
- previewSizeArea.setLayoutData(gd);
- new Widgets.IntegerTextEntryHandler(previewSizeArea, false, 2) {
- @Override
- public void applyValue(long value) {
- clamp(previewSizeArea, value);
- }
- };
-
- Label label = new Label(group, SWT.NONE);
- label.setText("[ 0-10 ]");
- label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- }
-
- private void clamp(Text text, long value) {
- if (value < 0) {
- previewSizeArea.setText(Integer.toString(0));
- }
- if (value > 10) {
- previewSizeArea.setText(Integer.toString(10));
- }
- }
-
- private void createDescriptionArea(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- group.setFont(parent.getFont());
- group.setText(REPORT_DESCRIPTION);
-
- descriptionArea = new Text(group, SWT.WRAP | SWT.MULTI);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.heightHint = 100;
- gd.widthHint = 100;
- descriptionArea.setLayoutData(gd);
- descriptionArea.setEditable(false);
- }
-
- private void createFormatArea(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- group.setFont(parent.getFont());
- group.setText(FORMAT_TITLE);
-
- this.formatButtons = new HashMap<OutputFormat, Button>();
- for (OutputFormat format : OutputFormat.values()) {
- Button button = new Button(group, SWT.RADIO);
- button.setText(format.name());
- button.setData(format);
- if (format.equals(OutputFormat.HTML)) {
- button.setSelection(true);
- }
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button) e.getSource();
- if (button.getSelection() != false) {
- setReportFormat((OutputFormat) button.getData());
- }
- }
- });
- formatButtons.put(format, button);
- }
- }
-
- private void createPreviewArea(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- group.setFont(parent.getFont());
- group.setText(PREVIEW_TITLE);
- previewPanel = new PreviewPanel(group, SWT.NONE);
- }
-
- private void attachListeners() {
- listSelectionPanel.addDoubleClickListener(new IDoubleClickListener() {
- @SuppressWarnings("unchecked")
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection != null) {
- Pair<String, String> item = (Pair<String, String>) selection.getFirstElement();
- if (item != null) {
- selectedReportId = item.getFirst();
- }
- }
- okPressed();
- }
- });
-
- selectionChangedListener = new SelectionChangedListener();
- listSelectionPanel.addSelectionChangedListener(selectionChangedListener);
- }
-
- public String getReportSelected() {
- return selectedReportId;
- }
-
- public String getReportFormat() {
- return selectedReportFormat.name();
- }
-
- private void setReportFormat(OutputFormat reportFormat) {
- this.selectedReportFormat = reportFormat;
- selectionChangedListener.selectionChanged(null);
- }
-
- private PanelEnum asPanelEnum(OutputFormat format) {
- PanelEnum toReturn = PanelEnum.DEFAULT;
- switch (format) {
- case HTML:
- case PDF:
- case EXCEL:
- case RTF:
- toReturn = PanelEnum.BROWSER;
- break;
- default:
- toReturn = PanelEnum.DEFAULT;
- break;
- }
- return toReturn;
- }
-
- private void updatePanel(final PanelEnum panelId, final URI uri, final String description, final List<IFile> oldIFiles) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- previewPanel.updatePreview(panelId, uri);
- previewPanel.setDisplay(panelId);
- descriptionArea.setText(description);
- }
- });
- cleanUp(oldIFiles);
- }
-
- private int getPreviewSize() {
- int toReturn = DEFAULT_PREVIEW_SIZE;
- String value = previewSizeArea.getText();
- try {
- toReturn = Integer.parseInt(value);
- } catch (Exception ex) {
- toReturn = DEFAULT_PREVIEW_SIZE;
- updatePreviewSizeValue(toReturn);
- }
- return toReturn;
- }
-
- private void updatePreviewSizeValue(final int value) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- previewSizeArea.setText(Integer.toString(value));
- }
- });
- }
-
- private void generatePreview(final OutputFormat outputFormat, final String reportId, final ITestRunReport report) throws URISyntaxException, OseeStateException {
- String urlRequest = HttpReportRequest.getUrl(reportId, outputFormat.name(), "local", getPreviewSize());
- String fileName = OutputFactory.getOutputFilename(outputFormat, reportId);
- switch (outputFormat) {
- case HTML:
- updatePanel(asPanelEnum(outputFormat), new URI(urlRequest), report.getDescription(), filesToDelete);
- break;
- default:
- remoteFileToLocal(outputFormat, urlRequest, fileName, report);
- break;
- }
- }
-
- private void remoteFileToLocal(final OutputFormat outputFormat, final String urlRequest, final String fileName, final ITestRunReport report) {
- RemoteResourceRequestJob requestJob = new RemoteResourceRequestJob(urlRequest, fileName);
- requestJob.addJobChangeListener(new PreviewUpdateJobChangeListener(report, outputFormat));
- requestJob.getDownloadedFile();
- requestJob.schedule();
- }
-
- private final class SelectionChangedListener implements ISelectionChangedListener {
- @SuppressWarnings("unchecked")
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = listSelectionPanel.getSelection();
- if (selection != null) {
- Pair<String, String> item = (Pair<String, String>) selection.getFirstElement();
- if (item != null) {
- ITestRunReport report = ExtensionDefinedReports.getInstance().getReportGenerator(item.getFirst());
- if (report != null) {
- selectedReportId = item.getFirst();
- try {
- generatePreview(selectedReportFormat, selectedReportId, report);
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- }
- }
-
- private final class ListLabelProvider extends LabelProvider {
-
- @SuppressWarnings("unchecked")
- @Override
- public Image getImage(Object element) {
- Image toReturn = null;
- if (element instanceof Pair) {
- toReturn = ExtensionDefinedReports.getInstance().getImage(((Pair<String, String>) element).getFirst());
- }
- return toReturn;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public String getText(Object element) {
- if (element instanceof Pair) {
- return ((Pair<String, String>) element).getSecond();
- }
- return super.getText(element);
- }
- }
-
- private final class PreviewUpdateJobChangeListener extends JobChangeAdapter {
- private final ITestRunReport report;
- private final OutputFormat format;
-
- private PreviewUpdateJobChangeListener(ITestRunReport report, OutputFormat format) {
- this.report = report;
- this.format = format;
- }
-
- @Override
- public void done(IJobChangeEvent event) {
- IStatus status = event.getResult();
- if (status.equals(Status.OK_STATUS) || status.getCode() == Status.OK) {
- IFile iFile = ((RemoteResourceRequestJob) event.getJob()).getDownloadedFile();
- if (iFile != null) {
- updatePanel(asPanelEnum(format), iFile.getLocationURI(), report.getDescription(), filesToDelete);
- filesToDelete.add(iFile);
- }
- }
- }
- }
-
- private void cleanUp(final List<IFile> iFiles) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- for (IFile iFile : iFiles) {
- if (iFile != null && iFile.exists()) {
- try {
- iFile.delete(true, new NullProgressMonitor());
- filesToDelete.remove(iFile);
- } catch (CoreException ex) {
- // Do Nothing
- }
- }
- }
- }
- });
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.dialogs;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.osee.ote.define.jobs.RemoteResourceRequestJob;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.osee.ote.ui.define.panels.ListSelectionPanel;
+import org.eclipse.osee.ote.ui.define.panels.PreviewPanel;
+import org.eclipse.osee.ote.ui.define.panels.PreviewPanel.PanelEnum;
+import org.eclipse.osee.ote.ui.define.reports.ExtensionDefinedReports;
+import org.eclipse.osee.ote.ui.define.reports.HttpReportRequest;
+import org.eclipse.osee.ote.ui.define.reports.ITestRunReport;
+import org.eclipse.osee.ote.ui.define.reports.output.OutputFactory;
+import org.eclipse.osee.ote.ui.define.reports.output.OutputFormat;
+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.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ReportsDialog extends TitleAreaDialog {
+ private static final Image MESSAGE_IMAGE = ImageManager.getImage(OteDefineImage.COMMIT_WIZ);
+ private static final Image TITLE_BAR_IMAGE = ImageManager.getImage(OteDefineImage.COMMIT);
+
+ private static final String MESSAGE_TITLE = "Select a report";
+ private static final String TITLE_BAR_TEXT = "OSEE Test Run Reports";
+ private static final String MESSAGE = "The preview window displays an example of the selected report.";
+ private static final String REPORT_SELECTION_TITLE = "Select a Report";
+ private static final String PREVIEW_TITLE = "Preview";
+ private static final String FORMAT_TITLE = "Select a Format";
+ private static final String REPORT_DESCRIPTION = "Report Description";
+ private static final String PREVIEW_DESCRIPTION = "Enter Preview Size";
+
+ private static final String REPORT_STORE_ID = ReportsDialog.class.getName() + ".reportId";
+ private static final String FORMAT_STORE_ID = ReportsDialog.class.getName() + ".formatId";
+ private static final String PREVIEW_SIZE_STORE_ID = ReportsDialog.class.getName() + ".previewSize";
+
+ private static final int DEFAULT_PREVIEW_SIZE = 5;
+
+ private PreviewPanel previewPanel;
+ private org.eclipse.osee.ote.ui.define.panels.ListSelectionPanel listSelectionPanel;
+ private SelectionChangedListener selectionChangedListener;
+ private Text descriptionArea;
+ private Text previewSizeArea;
+ private String selectedReportId;
+ private OutputFormat selectedReportFormat;
+ private final List<IFile> filesToDelete;
+ private Map<OutputFormat, Button> formatButtons;
+
+ public ReportsDialog(Shell parent) {
+ super(parent);
+ this.filesToDelete = new ArrayList<IFile>();
+ setShellStyle(SWT.SHELL_TRIM);
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Label separator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
+ return super.createButtonBar(parent);
+ }
+
+ /*
+ * @see Dialog#createDialogArea(Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite content = (Composite) super.createDialogArea(parent);
+
+ Composite composite = new Composite(content, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setFont(parent.getFont());
+
+ SashForm sash = new SashForm(composite, SWT.HORIZONTAL);
+ sash.setLayout(new GridLayout());
+ sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ sash.setFont(parent.getFont());
+
+ createReportSelectionArea(sash);
+
+ Composite panel = new Composite(sash, SWT.NONE);
+ GridLayout gL1 = new GridLayout();
+ gL1.marginHeight = 0;
+ gL1.marginWidth = 0;
+ panel.setLayout(gL1);
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ createFormatAndDescriptionArea(panel);
+ createPreviewArea(panel);
+ sash.setWeights(new int[] {1, 2});
+
+ setTitle(MESSAGE_TITLE);
+ setTitleImage(MESSAGE_IMAGE);
+ setMessage(MESSAGE);
+ getShell().setText(TITLE_BAR_TEXT);
+ getShell().setImage(TITLE_BAR_IMAGE);
+ attachListeners();
+ restoreDialog();
+ return sash;
+ }
+
+ private void restoreDialog() {
+ IDialogSettings settings = OteUiDefinePlugin.getInstance().getDialogSettings();
+ if (settings != null) {
+ String reportSelected = settings.get(REPORT_STORE_ID);
+ String format = settings.get(FORMAT_STORE_ID);
+
+ int value = 0;
+ try {
+ value = settings.getInt(PREVIEW_SIZE_STORE_ID);
+ } catch (Exception ex) {
+ value = DEFAULT_PREVIEW_SIZE;
+ }
+ clamp(previewSizeArea, value);
+
+ OutputFormat outputFormat = OutputFormat.HTML;
+ int index = 0;
+ if (Strings.isValid(reportSelected) && Strings.isValid(format)) {
+ Pair<String, String> pair = ExtensionDefinedReports.getInstance().getIdAndName(reportSelected);
+ index = listSelectionPanel.indexOf(pair);
+ outputFormat = OutputFormat.fromString(format);
+ }
+ if (index > -1) {
+ listSelectionPanel.setSelection(index);
+ }
+ setReportFormat(outputFormat);
+ for (OutputFormat key : formatButtons.keySet()) {
+ Button button = formatButtons.get(key);
+ button.setSelection(key.equals(outputFormat));
+ }
+ }
+ }
+
+ private void saveDialog() {
+ IDialogSettings settings = OteUiDefinePlugin.getInstance().getDialogSettings();
+ if (settings != null) {
+ String reportSelected = getReportSelected();
+ String format = getReportFormat();
+ int previewSize = getPreviewSize();
+ settings.put(REPORT_STORE_ID, reportSelected);
+ settings.put(FORMAT_STORE_ID, format);
+ settings.put(PREVIEW_SIZE_STORE_ID, previewSize);
+ }
+ }
+
+ @Override
+ protected void okPressed() {
+ saveDialog();
+ cleanUp(filesToDelete);
+ super.okPressed();
+ }
+
+ private void createReportSelectionArea(Composite parent) {
+ Group composite = new Group(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setFont(parent.getFont());
+ composite.setText(REPORT_SELECTION_TITLE);
+
+ listSelectionPanel = new ListSelectionPanel(composite, SWT.NONE, 300, 300, new ListLabelProvider());
+ listSelectionPanel.setSorter(new ViewerSorter() {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public int compare(Viewer viewer, Object o1, Object o2) {
+ Pair<String, String> pair1 = (Pair<String, String>) o1;
+ Pair<String, String> pair2 = (Pair<String, String>) o2;
+ return getComparator().compare(pair1.getSecond(), pair2.getSecond());
+ }
+
+ });
+ Pair<String, String>[] reportNames = ExtensionDefinedReports.getInstance().getIdsAndNames();
+ listSelectionPanel.setInput(reportNames);
+ listSelectionPanel.setSelection(0);
+ }
+
+ private void createFormatAndDescriptionArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gL = new GridLayout(2, false);
+ gL.marginHeight = 0;
+ gL.marginWidth = 0;
+ composite.setLayout(gL);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ createFormatArea(composite);
+
+ Composite panel = new Composite(composite, SWT.NONE);
+ GridLayout gL1 = new GridLayout();
+ gL1.marginHeight = 0;
+ gL1.marginWidth = 0;
+ panel.setLayout(gL1);
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ createDescriptionArea(panel);
+ createPreviewSizeArea(panel);
+ }
+
+ private void createPreviewSizeArea(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout(2, false));
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setFont(parent.getFont());
+ group.setText(PREVIEW_DESCRIPTION);
+
+ previewSizeArea = new Text(group, SWT.SINGLE | SWT.BORDER);
+ previewSizeArea.setTextLimit(2);
+ GridData gd = new GridData(SWT.RIGHT, SWT.FILL, false, false);
+ gd.heightHint = convertHeightInCharsToPixels(1);
+ gd.widthHint = convertWidthInCharsToPixels(4);
+ previewSizeArea.setLayoutData(gd);
+ new Widgets.IntegerTextEntryHandler(previewSizeArea, false, 2) {
+ @Override
+ public void applyValue(long value) {
+ clamp(previewSizeArea, value);
+ }
+ };
+
+ Label label = new Label(group, SWT.NONE);
+ label.setText("[ 0-10 ]");
+ label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ }
+
+ private void clamp(Text text, long value) {
+ if (value < 0) {
+ previewSizeArea.setText(Integer.toString(0));
+ }
+ if (value > 10) {
+ previewSizeArea.setText(Integer.toString(10));
+ }
+ }
+
+ private void createDescriptionArea(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setFont(parent.getFont());
+ group.setText(REPORT_DESCRIPTION);
+
+ descriptionArea = new Text(group, SWT.WRAP | SWT.MULTI);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.heightHint = 100;
+ gd.widthHint = 100;
+ descriptionArea.setLayoutData(gd);
+ descriptionArea.setEditable(false);
+ }
+
+ private void createFormatArea(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ group.setFont(parent.getFont());
+ group.setText(FORMAT_TITLE);
+
+ this.formatButtons = new HashMap<OutputFormat, Button>();
+ for (OutputFormat format : OutputFormat.values()) {
+ Button button = new Button(group, SWT.RADIO);
+ button.setText(format.name());
+ button.setData(format);
+ if (format.equals(OutputFormat.HTML)) {
+ button.setSelection(true);
+ }
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button button = (Button) e.getSource();
+ if (button.getSelection() != false) {
+ setReportFormat((OutputFormat) button.getData());
+ }
+ }
+ });
+ formatButtons.put(format, button);
+ }
+ }
+
+ private void createPreviewArea(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ group.setFont(parent.getFont());
+ group.setText(PREVIEW_TITLE);
+ previewPanel = new PreviewPanel(group, SWT.NONE);
+ }
+
+ private void attachListeners() {
+ listSelectionPanel.addDoubleClickListener(new IDoubleClickListener() {
+ @SuppressWarnings("unchecked")
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ if (selection != null) {
+ Pair<String, String> item = (Pair<String, String>) selection.getFirstElement();
+ if (item != null) {
+ selectedReportId = item.getFirst();
+ }
+ }
+ okPressed();
+ }
+ });
+
+ selectionChangedListener = new SelectionChangedListener();
+ listSelectionPanel.addSelectionChangedListener(selectionChangedListener);
+ }
+
+ public String getReportSelected() {
+ return selectedReportId;
+ }
+
+ public String getReportFormat() {
+ return selectedReportFormat.name();
+ }
+
+ private void setReportFormat(OutputFormat reportFormat) {
+ this.selectedReportFormat = reportFormat;
+ selectionChangedListener.selectionChanged(null);
+ }
+
+ private PanelEnum asPanelEnum(OutputFormat format) {
+ PanelEnum toReturn = PanelEnum.DEFAULT;
+ switch (format) {
+ case HTML:
+ case PDF:
+ case EXCEL:
+ case RTF:
+ toReturn = PanelEnum.BROWSER;
+ break;
+ default:
+ toReturn = PanelEnum.DEFAULT;
+ break;
+ }
+ return toReturn;
+ }
+
+ private void updatePanel(final PanelEnum panelId, final URI uri, final String description, final List<IFile> oldIFiles) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ previewPanel.updatePreview(panelId, uri);
+ previewPanel.setDisplay(panelId);
+ descriptionArea.setText(description);
+ }
+ });
+ cleanUp(oldIFiles);
+ }
+
+ private int getPreviewSize() {
+ int toReturn = DEFAULT_PREVIEW_SIZE;
+ String value = previewSizeArea.getText();
+ try {
+ toReturn = Integer.parseInt(value);
+ } catch (Exception ex) {
+ toReturn = DEFAULT_PREVIEW_SIZE;
+ updatePreviewSizeValue(toReturn);
+ }
+ return toReturn;
+ }
+
+ private void updatePreviewSizeValue(final int value) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ previewSizeArea.setText(Integer.toString(value));
+ }
+ });
+ }
+
+ private void generatePreview(final OutputFormat outputFormat, final String reportId, final ITestRunReport report) throws URISyntaxException, OseeStateException {
+ String urlRequest = HttpReportRequest.getUrl(reportId, outputFormat.name(), "local", getPreviewSize());
+ String fileName = OutputFactory.getOutputFilename(outputFormat, reportId);
+ switch (outputFormat) {
+ case HTML:
+ updatePanel(asPanelEnum(outputFormat), new URI(urlRequest), report.getDescription(), filesToDelete);
+ break;
+ default:
+ remoteFileToLocal(outputFormat, urlRequest, fileName, report);
+ break;
+ }
+ }
+
+ private void remoteFileToLocal(final OutputFormat outputFormat, final String urlRequest, final String fileName, final ITestRunReport report) {
+ RemoteResourceRequestJob requestJob = new RemoteResourceRequestJob(urlRequest, fileName);
+ requestJob.addJobChangeListener(new PreviewUpdateJobChangeListener(report, outputFormat));
+ requestJob.getDownloadedFile();
+ requestJob.schedule();
+ }
+
+ private final class SelectionChangedListener implements ISelectionChangedListener {
+ @SuppressWarnings("unchecked")
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = listSelectionPanel.getSelection();
+ if (selection != null) {
+ Pair<String, String> item = (Pair<String, String>) selection.getFirstElement();
+ if (item != null) {
+ ITestRunReport report = ExtensionDefinedReports.getInstance().getReportGenerator(item.getFirst());
+ if (report != null) {
+ selectedReportId = item.getFirst();
+ try {
+ generatePreview(selectedReportFormat, selectedReportId, report);
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private final class ListLabelProvider extends LabelProvider {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Image getImage(Object element) {
+ Image toReturn = null;
+ if (element instanceof Pair) {
+ toReturn = ExtensionDefinedReports.getInstance().getImage(((Pair<String, String>) element).getFirst());
+ }
+ return toReturn;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public String getText(Object element) {
+ if (element instanceof Pair) {
+ return ((Pair<String, String>) element).getSecond();
+ }
+ return super.getText(element);
+ }
+ }
+
+ private final class PreviewUpdateJobChangeListener extends JobChangeAdapter {
+ private final ITestRunReport report;
+ private final OutputFormat format;
+
+ private PreviewUpdateJobChangeListener(ITestRunReport report, OutputFormat format) {
+ this.report = report;
+ this.format = format;
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ IStatus status = event.getResult();
+ if (status.equals(Status.OK_STATUS) || status.getCode() == Status.OK) {
+ IFile iFile = ((RemoteResourceRequestJob) event.getJob()).getDownloadedFile();
+ if (iFile != null) {
+ updatePanel(asPanelEnum(format), iFile.getLocationURI(), report.getDescription(), filesToDelete);
+ filesToDelete.add(iFile);
+ }
+ }
+ }
+ }
+
+ private void cleanUp(final List<IFile> iFiles) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ for (IFile iFile : iFiles) {
+ if (iFile != null && iFile.exists()) {
+ try {
+ iFile.delete(true, new NullProgressMonitor());
+ filesToDelete.remove(iFile);
+ } catch (CoreException ex) {
+ // Do Nothing
+ }
+ }
+ }
+ }
+ });
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ResourceSelectionDialog.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ResourceSelectionDialog.java
index edcc6ead293..9a466715554 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ResourceSelectionDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/dialogs/ResourceSelectionDialog.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.dialogs;
-
+package org.eclipse.osee.ote.ui.define.dialogs;
+
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
@@ -26,47 +26,47 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
-
-public class ResourceSelectionDialog extends CheckedTreeSelectionDialog {
-
- public ResourceSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
- super(parent, labelProvider, contentProvider);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- applyDialogFont(composite);
-
- Label messageLabel = createMessageArea(composite);
- CheckboxTreeViewer treeViewer = createTreeViewer(composite);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(80);
- data.heightHint = convertHeightInCharsToPixels(16);
- Tree treeWidget = treeViewer.getTree();
- treeViewer.addCheckStateListener(new ICheckStateListener() {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- boolean wasChecked = event.getChecked();
- CheckboxTreeViewer viewer = getTreeViewer();
- TreeItem[] items = viewer.getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- viewer.setSubtreeChecked(items[i], false);
- }
- event.getCheckable().setChecked(event.getElement(), wasChecked);
- }
-
- });
- treeWidget.setLayoutData(data);
- treeWidget.setFont(parent.getFont());
- messageLabel.setEnabled(true);
- treeWidget.setEnabled(true);
- return composite;
- }
-};
+
+public class ResourceSelectionDialog extends CheckedTreeSelectionDialog {
+
+ public ResourceSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+ super(parent, labelProvider, contentProvider);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ applyDialogFont(composite);
+
+ Label messageLabel = createMessageArea(composite);
+ CheckboxTreeViewer treeViewer = createTreeViewer(composite);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(80);
+ data.heightHint = convertHeightInCharsToPixels(16);
+ Tree treeWidget = treeViewer.getTree();
+ treeViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ boolean wasChecked = event.getChecked();
+ CheckboxTreeViewer viewer = getTreeViewer();
+ TreeItem[] items = viewer.getTree().getItems();
+ for (int i = 0; i < items.length; i++) {
+ viewer.setSubtreeChecked(items[i], false);
+ }
+ event.getCheckable().setChecked(event.getElement(), wasChecked);
+ }
+
+ });
+ treeWidget.setLayoutData(data);
+ treeWidget.setFont(parent.getFont());
+ messageLabel.setEnabled(true);
+ treeWidget.setEnabled(true);
+ return composite;
+ }
+};
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportPage.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportPage.java
index 92ab59715f0..925fbd51df3 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportPage.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportPage.java
@@ -1,342 +1,342 @@
-/*******************************************************************************
- * 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.ote.ui.define.importer;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.osee.framework.core.data.TestRunStorageKey;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-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.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
-import org.eclipse.ui.dialogs.WizardDataTransferPage;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OutfileImportPage extends WizardDataTransferPage {
- private static final String PAGE_NAME = "Outfile Import";
-
- private CheckboxTreeViewer treeViewer;
- private final IStructuredSelection startingResourceSelection;
- private final boolean treeSelectionMode;
- private final ITreeContentProvider contentProvider;
- private final ILabelProvider labelProvider;
- private final List<ViewerFilter> filters;
- private final Object treeInput;
- private XBranchSelectWidget branchSelect;
-
- /**
- * @param pageName
- */
- protected OutfileImportPage(IStructuredSelection selection) {
- super(PAGE_NAME);
- this.treeInput = ResourcesPlugin.getWorkspace().getRoot();
- this.treeSelectionMode = true;
- this.contentProvider = new WorkbenchContentProvider();
- this.labelProvider = new WorkbenchLabelProvider();
- this.filters = new ArrayList<ViewerFilter>();
- // this.filters.add(new FileFilter());
- this.startingResourceSelection = selection;
- }
-
- @Override
- protected boolean allowNewContainerName() {
- return false;
- }
-
- public void handleEvent(Event event) {
- updateWidgetEnablements();
- }
-
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- composite.setFont(parent.getFont());
-
- Group group = new Group(composite, SWT.NONE);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- group.setText("Select a Branch to import files into");
- group.setToolTipText("Opens the branch selection dialog");
- branchSelect = new XBranchSelectWidget("branch");
- branchSelect.createWidgets(group, SWT.BORDER | SWT.READ_ONLY);
-
- createFileSelectArea(composite);
-
- restoreWidgetValues();
- updateWidgetEnablements();
- setErrorMessage(null); // should not initially have error message
- setControl(composite);
- }
-
- private void createFileSelectArea(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- group.setLayout(layout);
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- group.setText("Select Files");
- group.setToolTipText("Select files to import");
-
- Composite composite = new Composite(group, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- composite.setFont(parent.getFont());
-
- if (treeSelectionMode) {
- treeViewer = new ContainerCheckedTreeViewer(composite, SWT.BORDER);
- } else {
- treeViewer = new CheckboxTreeViewer(composite, SWT.BORDER);
- }
-
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setLabelProvider(labelProvider);
- treeViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- setPageComplete(determinePageCompletion());
- }
- });
- if (filters != null) {
- for (int i = 0; i != filters.size(); i++) {
- treeViewer.addFilter(filters.get(i));
- }
- }
- treeViewer.setInput(treeInput);
-
- Tree treeWidget = treeViewer.getTree();
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.widthHint = convertWidthInCharsToPixels(80);
- data.heightHint = convertHeightInCharsToPixels(16);
- treeWidget.setLayout(new GridLayout());
- treeWidget.setLayoutData(data);
- treeWidget.setFont(composite.getFont());
- treeWidget.setEnabled(true);
-
- createSelectionButtons(composite);
- }
-
- private Button createButton(Composite parent, int id, String label, boolean defaultButton) {
- // increment the number of columns in the button bar
- ((GridLayout) parent.getLayout()).numColumns++;
- Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- button.setFont(JFaceResources.getDialogFont());
- button.setData(new Integer(id));
- setButtonLayoutData(button);
- return button;
- }
-
- private Composite createSelectionButtons(Composite composite) {
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- buttonComposite.setLayout(layout);
- buttonComposite.setFont(composite.getFont());
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.grabExcessHorizontalSpace = true;
- composite.setData(data);
- Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select All", false);
- SelectionListener listener = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- Object[] viewerElements = contentProvider.getElements(treeInput);
- if (treeSelectionMode) {
- treeViewer.setCheckedElements(viewerElements);
- } else {
- for (int i = 0; i < viewerElements.length; i++) {
- treeViewer.setSubtreeChecked(viewerElements[i], true);
- }
- }
- updateWidgetEnablements();
- }
- };
- selectButton.addSelectionListener(listener);
- Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "Deselect All", false);
- listener = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- treeViewer.setCheckedElements(new Object[0]);
- updateWidgetEnablements();
- }
- };
- deselectButton.addSelectionListener(listener);
- return buttonComposite;
- }
-
- @Override
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String lastSelected = settings.get(TestRunStorageKey.SELECTED_BRANCH_ID);
- try {
- branchSelect.setSelection(BranchManager.getBranch(Integer.parseInt(lastSelected)));
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
- onStartSelectedResource();
- }
-
- private void onStartSelectedResource() {
- if (startingResourceSelection != null) {
- if (startingResourceSelection.size() > 0) {
- for (Object firstElement : startingResourceSelection.toArray()) {
- if (firstElement instanceof IAdaptable) {
- Object resource = ((IAdaptable) firstElement).getAdapter(IResource.class);
- if (resource != null) {
- IResource currentResource = (IResource) resource;
- if (currentResource.getType() == IResource.FILE) {
- IResource parentResource = currentResource.getParent();
- if (parentResource != null && parentResource.isAccessible() != false) {
- treeViewer.expandToLevel(parentResource, IResource.DEPTH_ONE);
- treeViewer.setChecked(currentResource, true);
- }
- }
- }
- }
- }
- }
- }
- }
-
- @Override
- protected boolean validateSourceGroup() {
- boolean toReturn = super.validateSourceGroup();
- URI[] selectedResources = getSelectedResources();
- if (selectedResources.length == 0) {
- setMessage(null);
- setErrorMessage("There are no resources currently selected for import.");
- toReturn &= false;
- }
- return toReturn;
- }
-
- @Override
- protected boolean validateDestinationGroup() {
- boolean toReturn = super.validateDestinationGroup();
- Branch branch = branchSelect.getData();
- if (branch == null) {
- setMessage(null);
- setErrorMessage("Please select a working branch. Cannot import into a null branch.");
- toReturn &= false;
- } else {
- try {
- if (!branch.hasParentBranch()) {
- setMessage(null);
- setErrorMessage("Please select a working branch. Cannot import into a top-level branch.");
- toReturn &= false;
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
- return toReturn;
- }
-
- @Override
- protected void updateWidgetEnablements() {
- boolean pageComplete = determinePageCompletion();
- setPageComplete(pageComplete);
- if (pageComplete) {
- setMessage(null);
- }
- super.updateWidgetEnablements();
- }
-
- @Override
- protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // update source names history
- String[] branchIds = settings.getArray(TestRunStorageKey.BRANCH_IDS);
- if (branchIds == null) {
- branchIds = new String[0];
- }
-
- Branch branch = branchSelect.getData();
- try {
- if (branch != null && branch.hasParentBranch()) {
- String lastBranchSelected = Integer.toString(branch.getId());
- branchIds = addToHistory(branchIds, lastBranchSelected);
-
- settings.put(TestRunStorageKey.BRANCH_IDS, branchIds);
- settings.put(TestRunStorageKey.SELECTED_BRANCH_ID, lastBranchSelected);
- try {
- settings.save(this.getClass().getName());
- } catch (IOException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
- }
-
- private URI[] getSelectedResources() {
- Object[] selected = treeViewer.getCheckedElements();
- List<URI> selectedResources = new ArrayList<URI>();
- for (Object object : selected) {
- if (object instanceof IFile) {
- IFile iFile = (IFile) object;
- selectedResources.add(iFile.getLocationURI());
- }
- }
- return selectedResources.toArray(new URI[selectedResources.size()]);
- }
-
- public boolean finish() {
- saveWidgetValues();
- return new ImportOutfileUIOperation(branchSelect.getData(), getSelectedResources()).execute();
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.importer;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.osee.framework.core.data.TestRunStorageKey;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+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.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
+import org.eclipse.ui.dialogs.WizardDataTransferPage;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OutfileImportPage extends WizardDataTransferPage {
+ private static final String PAGE_NAME = "Outfile Import";
+
+ private CheckboxTreeViewer treeViewer;
+ private final IStructuredSelection startingResourceSelection;
+ private final boolean treeSelectionMode;
+ private final ITreeContentProvider contentProvider;
+ private final ILabelProvider labelProvider;
+ private final List<ViewerFilter> filters;
+ private final Object treeInput;
+ private XBranchSelectWidget branchSelect;
+
+ /**
+ * @param pageName
+ */
+ protected OutfileImportPage(IStructuredSelection selection) {
+ super(PAGE_NAME);
+ this.treeInput = ResourcesPlugin.getWorkspace().getRoot();
+ this.treeSelectionMode = true;
+ this.contentProvider = new WorkbenchContentProvider();
+ this.labelProvider = new WorkbenchLabelProvider();
+ this.filters = new ArrayList<ViewerFilter>();
+ // this.filters.add(new FileFilter());
+ this.startingResourceSelection = selection;
+ }
+
+ @Override
+ protected boolean allowNewContainerName() {
+ return false;
+ }
+
+ public void handleEvent(Event event) {
+ updateWidgetEnablements();
+ }
+
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
+ composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ composite.setFont(parent.getFont());
+
+ Group group = new Group(composite, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setText("Select a Branch to import files into");
+ group.setToolTipText("Opens the branch selection dialog");
+ branchSelect = new XBranchSelectWidget("branch");
+ branchSelect.createWidgets(group, SWT.BORDER | SWT.READ_ONLY);
+
+ createFileSelectArea(composite);
+
+ restoreWidgetValues();
+ updateWidgetEnablements();
+ setErrorMessage(null); // should not initially have error message
+ setControl(composite);
+ }
+
+ private void createFileSelectArea(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ group.setLayout(layout);
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ group.setText("Select Files");
+ group.setToolTipText("Select files to import");
+
+ Composite composite = new Composite(group, SWT.NULL);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ composite.setFont(parent.getFont());
+
+ if (treeSelectionMode) {
+ treeViewer = new ContainerCheckedTreeViewer(composite, SWT.BORDER);
+ } else {
+ treeViewer = new CheckboxTreeViewer(composite, SWT.BORDER);
+ }
+
+ treeViewer.setContentProvider(contentProvider);
+ treeViewer.setLabelProvider(labelProvider);
+ treeViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ setPageComplete(determinePageCompletion());
+ }
+ });
+ if (filters != null) {
+ for (int i = 0; i != filters.size(); i++) {
+ treeViewer.addFilter(filters.get(i));
+ }
+ }
+ treeViewer.setInput(treeInput);
+
+ Tree treeWidget = treeViewer.getTree();
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.widthHint = convertWidthInCharsToPixels(80);
+ data.heightHint = convertHeightInCharsToPixels(16);
+ treeWidget.setLayout(new GridLayout());
+ treeWidget.setLayoutData(data);
+ treeWidget.setFont(composite.getFont());
+ treeWidget.setEnabled(true);
+
+ createSelectionButtons(composite);
+ }
+
+ private Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+ // increment the number of columns in the button bar
+ ((GridLayout) parent.getLayout()).numColumns++;
+ Button button = new Button(parent, SWT.PUSH);
+ button.setText(label);
+ button.setFont(JFaceResources.getDialogFont());
+ button.setData(new Integer(id));
+ setButtonLayoutData(button);
+ return button;
+ }
+
+ private Composite createSelectionButtons(Composite composite) {
+ Composite buttonComposite = new Composite(composite, SWT.RIGHT);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ buttonComposite.setLayout(layout);
+ buttonComposite.setFont(composite.getFont());
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
+ data.grabExcessHorizontalSpace = true;
+ composite.setData(data);
+ Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select All", false);
+ SelectionListener listener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Object[] viewerElements = contentProvider.getElements(treeInput);
+ if (treeSelectionMode) {
+ treeViewer.setCheckedElements(viewerElements);
+ } else {
+ for (int i = 0; i < viewerElements.length; i++) {
+ treeViewer.setSubtreeChecked(viewerElements[i], true);
+ }
+ }
+ updateWidgetEnablements();
+ }
+ };
+ selectButton.addSelectionListener(listener);
+ Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "Deselect All", false);
+ listener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ treeViewer.setCheckedElements(new Object[0]);
+ updateWidgetEnablements();
+ }
+ };
+ deselectButton.addSelectionListener(listener);
+ return buttonComposite;
+ }
+
+ @Override
+ protected void restoreWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ String lastSelected = settings.get(TestRunStorageKey.SELECTED_BRANCH_ID);
+ try {
+ branchSelect.setSelection(BranchManager.getBranch(Integer.parseInt(lastSelected)));
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+ onStartSelectedResource();
+ }
+
+ private void onStartSelectedResource() {
+ if (startingResourceSelection != null) {
+ if (startingResourceSelection.size() > 0) {
+ for (Object firstElement : startingResourceSelection.toArray()) {
+ if (firstElement instanceof IAdaptable) {
+ Object resource = ((IAdaptable) firstElement).getAdapter(IResource.class);
+ if (resource != null) {
+ IResource currentResource = (IResource) resource;
+ if (currentResource.getType() == IResource.FILE) {
+ IResource parentResource = currentResource.getParent();
+ if (parentResource != null && parentResource.isAccessible() != false) {
+ treeViewer.expandToLevel(parentResource, IResource.DEPTH_ONE);
+ treeViewer.setChecked(currentResource, true);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean validateSourceGroup() {
+ boolean toReturn = super.validateSourceGroup();
+ URI[] selectedResources = getSelectedResources();
+ if (selectedResources.length == 0) {
+ setMessage(null);
+ setErrorMessage("There are no resources currently selected for import.");
+ toReturn &= false;
+ }
+ return toReturn;
+ }
+
+ @Override
+ protected boolean validateDestinationGroup() {
+ boolean toReturn = super.validateDestinationGroup();
+ Branch branch = branchSelect.getData();
+ if (branch == null) {
+ setMessage(null);
+ setErrorMessage("Please select a working branch. Cannot import into a null branch.");
+ toReturn &= false;
+ } else {
+ try {
+ if (!branch.hasParentBranch()) {
+ setMessage(null);
+ setErrorMessage("Please select a working branch. Cannot import into a top-level branch.");
+ toReturn &= false;
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return toReturn;
+ }
+
+ @Override
+ protected void updateWidgetEnablements() {
+ boolean pageComplete = determinePageCompletion();
+ setPageComplete(pageComplete);
+ if (pageComplete) {
+ setMessage(null);
+ }
+ super.updateWidgetEnablements();
+ }
+
+ @Override
+ protected void saveWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ // update source names history
+ String[] branchIds = settings.getArray(TestRunStorageKey.BRANCH_IDS);
+ if (branchIds == null) {
+ branchIds = new String[0];
+ }
+
+ Branch branch = branchSelect.getData();
+ try {
+ if (branch != null && branch.hasParentBranch()) {
+ String lastBranchSelected = Integer.toString(branch.getId());
+ branchIds = addToHistory(branchIds, lastBranchSelected);
+
+ settings.put(TestRunStorageKey.BRANCH_IDS, branchIds);
+ settings.put(TestRunStorageKey.SELECTED_BRANCH_ID, lastBranchSelected);
+ try {
+ settings.save(this.getClass().getName());
+ } catch (IOException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ private URI[] getSelectedResources() {
+ Object[] selected = treeViewer.getCheckedElements();
+ List<URI> selectedResources = new ArrayList<URI>();
+ for (Object object : selected) {
+ if (object instanceof IFile) {
+ IFile iFile = (IFile) object;
+ selectedResources.add(iFile.getLocationURI());
+ }
+ }
+ return selectedResources.toArray(new URI[selectedResources.size()]);
+ }
+
+ public boolean finish() {
+ saveWidgetValues();
+ return new ImportOutfileUIOperation(branchSelect.getData(), getSelectedResources()).execute();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportWizard.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportWizard.java
index 00b811af2d6..82b58c4def9 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportWizard.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/importer/OutfileImportWizard.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * 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.ote.ui.define.importer;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OutfileImportWizard extends Wizard implements IImportWizard {
- private static final String TITLE = "Import outfiles into Define";
- private static final ImageDescriptor WIZARD_IMAGE = ImageManager.getImageDescriptor(OteDefineImage.COMMIT_WIZ);
- private OutfileImportPage mainPage;
-
- public OutfileImportWizard() {
- super();
- setDialogSettings(OteUiDefinePlugin.getInstance().getDialogSettings());
- setWindowTitle("Outfile Import Wizard");
- setDefaultPageImageDescriptor(WIZARD_IMAGE);
- }
-
- @Override
- public boolean performFinish() {
- return mainPage.finish();
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.mainPage = new OutfileImportPage(selection);
- mainPage.setTitle(TITLE);
- mainPage.setDescription("Import artifacts into Define");
- addPage(mainPage);
- }
-
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- return null;
- }
-
- @Override
- public IWizardPage getPreviousPage(IWizardPage page) {
- return null;
- }
-
- @Override
- public boolean canFinish() {
- return mainPage.isPageComplete();
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.importer;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OutfileImportWizard extends Wizard implements IImportWizard {
+ private static final String TITLE = "Import outfiles into Define";
+ private static final ImageDescriptor WIZARD_IMAGE = ImageManager.getImageDescriptor(OteDefineImage.COMMIT_WIZ);
+ private OutfileImportPage mainPage;
+
+ public OutfileImportWizard() {
+ super();
+ setDialogSettings(OteUiDefinePlugin.getInstance().getDialogSettings());
+ setWindowTitle("Outfile Import Wizard");
+ setDefaultPageImageDescriptor(WIZARD_IMAGE);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.mainPage = new OutfileImportPage(selection);
+ mainPage.setTitle(TITLE);
+ mainPage.setDescription("Import artifacts into Define");
+ addPage(mainPage);
+ }
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ return null;
+ }
+
+ @Override
+ public IWizardPage getPreviousPage(IWizardPage page) {
+ return null;
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/AddArtifactsToViewerJob.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/AddArtifactsToViewerJob.java
index af850556250..b9af291492b 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/AddArtifactsToViewerJob.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/AddArtifactsToViewerJob.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.jobs;
-
+package org.eclipse.osee.ote.ui.define.jobs;
+
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -20,37 +20,37 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
import org.eclipse.osee.ote.ui.define.viewers.XViewerDataManager;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AddArtifactsToViewerJob extends Job {
- private static final String JOB_NAME = "Adding Artifacts to Table";
- private final List<Artifact> artifacts;
- private final XViewerDataManager viewerDataManager;
-
- public AddArtifactsToViewerJob(XViewerDataManager viewerDataManager, final List<Artifact> artifacts) {
- super(JOB_NAME);
- this.artifacts = artifacts;
- this.viewerDataManager = viewerDataManager;
- setUser(true);
- setPriority(Job.LONG);
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IStatus toReturn = Status.CANCEL_STATUS;
- monitor.beginTask(getName(), artifacts.size());
- try {
- viewerDataManager.addArtifacts(monitor, artifacts);
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return new Status(Status.ERROR, OteUiDefinePlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
- }
- if (monitor.isCanceled() != true) {
- toReturn = Status.OK_STATUS;
- }
- monitor.done();
- return toReturn;
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AddArtifactsToViewerJob extends Job {
+ private static final String JOB_NAME = "Adding Artifacts to Table";
+ private final List<Artifact> artifacts;
+ private final XViewerDataManager viewerDataManager;
+
+ public AddArtifactsToViewerJob(XViewerDataManager viewerDataManager, final List<Artifact> artifacts) {
+ super(JOB_NAME);
+ this.artifacts = artifacts;
+ this.viewerDataManager = viewerDataManager;
+ setUser(true);
+ setPriority(Job.LONG);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IStatus toReturn = Status.CANCEL_STATUS;
+ monitor.beginTask(getName(), artifacts.size());
+ try {
+ viewerDataManager.addArtifacts(monitor, artifacts);
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Status(Status.ERROR, OteUiDefinePlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
+ }
+ if (monitor.isCanceled() != true) {
+ toReturn = Status.OK_STATUS;
+ }
+ monitor.done();
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/CommitJobDialog.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/CommitJobDialog.java
index 5416199631f..cfd013e5f53 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/CommitJobDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/jobs/CommitJobDialog.java
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * 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.ote.ui.define.jobs;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.window.Window;
-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.ote.define.artifacts.TestRunOperator;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.osee.ote.ui.define.dialogs.CommitDialog;
-import org.eclipse.osee.ote.ui.define.dialogs.OverrideInvalidScriptRevisions;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.UIJob;
-
-/**
- * @author Roberto E. Escobar
- */
-class CommitJobDialog extends UIJob {
- private static final Image CHILD_BRANCH_IMAGE = ImageManager.getImage(OteDefineImage.CHILD_BRANCH);
-
- private static String JOB_NAME = "Commit Test Run";
- private String message;
- private Object[] items;
-
- private final Artifact[] allItems;
- private final Artifact[] preSelected;
- private final Artifact[] unselectable;
- private final boolean isOverrideAllowed;
-
- public CommitJobDialog(Artifact[] allitems, Artifact[] preSelected, boolean isOverrideAllowed) {
- this(allitems, preSelected, null, isOverrideAllowed);
- }
-
- public CommitJobDialog(Artifact[] allitems, Artifact[] preSelected, Artifact[] unselectable, boolean isOverrideAllowed) {
- super(JOB_NAME);
- this.allItems = allitems;
- this.preSelected = preSelected;
- this.unselectable = unselectable;
- setUser(false);
- setPriority(Job.LONG);
- if (unselectable == null) {
- unselectable = new Artifact[0];
- }
- this.isOverrideAllowed = isOverrideAllowed;
- this.message = null;
- this.items = null;
- }
-
- public String getMessage() {
- return message;
- }
-
- public Object[] getSelected() {
- return items;
- }
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IStatus toReturn = Status.CANCEL_STATUS;
- monitor.setTaskName(getName());
- Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
- CommitDialog dialog = new CommitDialog(shell, CommitColumnEnum.toStringArray(), new TestRunTableLabelProvider());
- dialog.setBlockOnOpen(true);
- dialog.setInput(allItems);
- dialog.setUnSelectable(unselectable);
- dialog.setSelected(preSelected);
- if (isOverrideAllowed != false) {
- dialog.setOverrideHandler(new OverrideInvalidScriptRevisions());
- }
- int result = dialog.open();
- if (result == Window.OK) {
- message = dialog.getComments();
- items = dialog.getSelectedResources();
- toReturn = Status.OK_STATUS;
- }
- return toReturn;
- }
-
- private enum CommitColumnEnum {
-
- Branch,
- Name,
- Id,
- Outfile;
-
- public static String[] toStringArray() {
-
- CommitColumnEnum[] cols = CommitColumnEnum.values();
- String[] toReturn = new String[cols.length];
- for (int index = 0; index < cols.length; index++) {
- toReturn[index] = cols[index].name();
- }
- return toReturn;
- }
- }
-
- private final class TestRunTableLabelProvider extends BaseLabelProvider implements ITableLabelProvider {
- private final HashSet<Object> unselectableItems = new HashSet<Object>();
- private final int DUMMY_COLUMNS = 1;
-
- public TestRunTableLabelProvider() {
- if (unselectable != null) {
- this.unselectableItems.addAll(Arrays.asList(unselectable));
- }
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- Image toReturn = null;
- if (columnIndex >= DUMMY_COLUMNS) {
- CommitColumnEnum column = CommitColumnEnum.values()[columnIndex - DUMMY_COLUMNS];
- switch (column) {
- case Branch:
- toReturn = CHILD_BRANCH_IMAGE;
- break;
- default:
- break;
- }
- }
- return toReturn;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- String toReturn = "";
- if (columnIndex >= DUMMY_COLUMNS) {
- if (element instanceof Artifact) {
- Artifact artifact = (Artifact) element;
- if (artifact != null && artifact.isDeleted() != true) {
- CommitColumnEnum column = CommitColumnEnum.values()[columnIndex - DUMMY_COLUMNS];
- switch (column) {
- case Branch:
- toReturn = artifact.getBranch().getName();
- break;
- case Id:
- try {
- toReturn = new TestRunOperator(artifact).getChecksum();
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, "Error getting Checksum", ex);
- }
- break;
- case Name:
- toReturn = artifact.getName();
- break;
- case Outfile:
- try {
- toReturn = new TestRunOperator(artifact).getOutfileAttribute().getDisplayableString();
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, "Error getting Outfile", ex);
- }
- break;
- default:
- break;
- }
- }
- }
- }
- return toReturn;
- }
- }
+/*******************************************************************************
+ * 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.ote.ui.define.jobs;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.window.Window;
+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.ote.define.artifacts.TestRunOperator;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.osee.ote.ui.define.dialogs.CommitDialog;
+import org.eclipse.osee.ote.ui.define.dialogs.OverrideInvalidScriptRevisions;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.UIJob;
+
+/**
+ * @author Roberto E. Escobar
+ */
+class CommitJobDialog extends UIJob {
+ private static final Image CHILD_BRANCH_IMAGE = ImageManager.getImage(OteDefineImage.CHILD_BRANCH);
+
+ private static String JOB_NAME = "Commit Test Run";
+ private String message;
+ private Object[] items;
+
+ private final Artifact[] allItems;
+ private final Artifact[] preSelected;
+ private final Artifact[] unselectable;
+ private final boolean isOverrideAllowed;
+
+ public CommitJobDialog(Artifact[] allitems, Artifact[] preSelected, boolean isOverrideAllowed) {
+ this(allitems, preSelected, null, isOverrideAllowed);
+ }
+
+ public CommitJobDialog(Artifact[] allitems, Artifact[] preSelected, Artifact[] unselectable, boolean isOverrideAllowed) {
+ super(JOB_NAME);
+ this.allItems = allitems;
+ this.preSelected = preSelected;
+ this.unselectable = unselectable;
+ setUser(false);
+ setPriority(Job.LONG);
+ if (unselectable == null) {
+ unselectable = new Artifact[0];
+ }
+ this.isOverrideAllowed = isOverrideAllowed;
+ this.message = null;
+ this.items = null;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Object[] getSelected() {
+ return items;
+ }
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ IStatus toReturn = Status.CANCEL_STATUS;
+ monitor.setTaskName(getName());
+ Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ CommitDialog dialog = new CommitDialog(shell, CommitColumnEnum.toStringArray(), new TestRunTableLabelProvider());
+ dialog.setBlockOnOpen(true);
+ dialog.setInput(allItems);
+ dialog.setUnSelectable(unselectable);
+ dialog.setSelected(preSelected);
+ if (isOverrideAllowed != false) {
+ dialog.setOverrideHandler(new OverrideInvalidScriptRevisions());
+ }
+ int result = dialog.open();
+ if (result == Window.OK) {
+ message = dialog.getComments();
+ items = dialog.getSelectedResources();
+ toReturn = Status.OK_STATUS;
+ }
+ return toReturn;
+ }
+
+ private enum CommitColumnEnum {
+
+ Branch,
+ Name,
+ Id,
+ Outfile;
+
+ public static String[] toStringArray() {
+
+ CommitColumnEnum[] cols = CommitColumnEnum.values();
+ String[] toReturn = new String[cols.length];
+ for (int index = 0; index < cols.length; index++) {
+ toReturn[index] = cols[index].name();
+ }
+ return toReturn;
+ }
+ }
+
+ private final class TestRunTableLabelProvider extends BaseLabelProvider implements ITableLabelProvider {
+ private final HashSet<Object> unselectableItems = new HashSet<Object>();
+ private final int DUMMY_COLUMNS = 1;
+
+ public TestRunTableLabelProvider() {
+ if (unselectable != null) {
+ this.unselectableItems.addAll(Arrays.asList(unselectable));
+ }
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ Image toReturn = null;
+ if (columnIndex >= DUMMY_COLUMNS) {
+ CommitColumnEnum column = CommitColumnEnum.values()[columnIndex - DUMMY_COLUMNS];
+ switch (column) {
+ case Branch:
+ toReturn = CHILD_BRANCH_IMAGE;
+ break;
+ default:
+ break;
+ }
+ }
+ return toReturn;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ String toReturn = "";
+ if (columnIndex >= DUMMY_COLUMNS) {
+ if (element instanceof Artifact) {
+ Artifact artifact = (Artifact) element;
+ if (artifact != null && artifact.isDeleted() != true) {
+ CommitColumnEnum column = CommitColumnEnum.values()[columnIndex - DUMMY_COLUMNS];
+ switch (column) {
+ case Branch:
+ toReturn = artifact.getBranch().getName();
+ break;
+ case Id:
+ try {
+ toReturn = new TestRunOperator(artifact).getChecksum();
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, "Error getting Checksum", ex);
+ }
+ break;
+ case Name:
+ toReturn = artifact.getName();
+ break;
+ case Outfile:
+ try {
+ toReturn = new TestRunOperator(artifact).getOutfileAttribute().getDisplayableString();
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, "Error getting Outfile", ex);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ return toReturn;
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/CommentComposite.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/CommentComposite.java
index 9688acb7f69..09b5f95067a 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/CommentComposite.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/CommentComposite.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.panels;
-
+package org.eclipse.osee.ote.ui.define.panels;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -17,45 +17,45 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CommentComposite extends Composite {
-
- protected Text textArea;
- protected String message;
-
- public CommentComposite(Composite parent, int style) {
- super(parent, style);
- this.message = "";
- createControls();
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- textArea.setText(message);
- }
-
- private void createControls() {
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- this.setLayout(layout);
-
- this.textArea = new Text(this, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 80;
- this.textArea.setLayoutData(data);
- this.textArea.selectAll();
-
- this.textArea.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- message = textArea.getText();
- }
- });
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CommentComposite extends Composite {
+
+ protected Text textArea;
+ protected String message;
+
+ public CommentComposite(Composite parent, int style) {
+ super(parent, style);
+ this.message = "";
+ createControls();
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ textArea.setText(message);
+ }
+
+ private void createControls() {
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ this.setLayout(layout);
+
+ this.textArea = new Text(this, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = 80;
+ this.textArea.setLayoutData(data);
+ this.textArea.selectAll();
+
+ this.textArea.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ message = textArea.getText();
+ }
+ });
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/IOverrideHandler.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/IOverrideHandler.java
index 6158f5d1565..697fa3c79fc 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/IOverrideHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/IOverrideHandler.java
@@ -8,20 +8,20 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.panels;
-
+package org.eclipse.osee.ote.ui.define.panels;
+
import java.util.Set;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IOverrideHandler {
-
- public String getText();
-
- public String getToolTipText();
-
- public Set<Object> getOverridableFromUnselectable(Set<Object> unselectable) throws OseeCoreException;
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IOverrideHandler {
+
+ public String getText();
+
+ public String getToolTipText();
+
+ public Set<Object> getOverridableFromUnselectable(Set<Object> unselectable) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/ListSelectionPanel.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/ListSelectionPanel.java
index e28470ebffa..45eee14bd73 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/ListSelectionPanel.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/ListSelectionPanel.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.panels;
-
+package org.eclipse.osee.ote.ui.define.panels;
+
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -23,82 +23,82 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ListSelectionPanel extends Composite {
-
- private TableViewer tableViewer;
- private IBaseLabelProvider labelProvider;
- private int width;
- private int height;
-
- public ListSelectionPanel(Composite parent, int style, int width, int height, IBaseLabelProvider labelProvider) {
- super(parent, style);
- this.width = width;
- this.height = height;
- this.labelProvider = labelProvider;
- createControl(this);
- }
-
- private void createControl(Composite parent) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
-
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- tableViewer = new TableViewer(parent, getTableStyle());
- tableViewer.setContentProvider(new ArrayContentProvider());
- tableViewer.setLabelProvider(labelProvider);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = width;
- gd.widthHint = height;
- Table table = tableViewer.getTable();
- table.setLayoutData(gd);
- table.setFont(parent.getFont());
- }
-
- private int getTableStyle() {
- return SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- }
-
- public void addDoubleClickListener(IDoubleClickListener listener) {
- tableViewer.addDoubleClickListener(listener);
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- tableViewer.addSelectionChangedListener(listener);
- }
-
- public void setInput(Object input) {
- tableViewer.setInput(input);
- }
-
- public void setSelection(int index) {
- tableViewer.getTable().select(index);
- }
-
- public void setSorter(ViewerSorter sorter) {
- tableViewer.setSorter(sorter);
- }
-
- public IStructuredSelection getSelection() {
- return (IStructuredSelection) tableViewer.getSelection();
- }
-
- public int indexOf(Object object) {
- int found = -1;
- TableItem[] items = tableViewer.getTable().getItems();
- for (int index = 0; index < items.length; index++) {
- TableItem item = items[index];
- if (item.getData().equals(object)) {
- found = index;
- break;
- }
- }
- return found;
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ListSelectionPanel extends Composite {
+
+ private TableViewer tableViewer;
+ private IBaseLabelProvider labelProvider;
+ private int width;
+ private int height;
+
+ public ListSelectionPanel(Composite parent, int style, int width, int height, IBaseLabelProvider labelProvider) {
+ super(parent, style);
+ this.width = width;
+ this.height = height;
+ this.labelProvider = labelProvider;
+ createControl(this);
+ }
+
+ private void createControl(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ tableViewer = new TableViewer(parent, getTableStyle());
+ tableViewer.setContentProvider(new ArrayContentProvider());
+ tableViewer.setLabelProvider(labelProvider);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = width;
+ gd.widthHint = height;
+ Table table = tableViewer.getTable();
+ table.setLayoutData(gd);
+ table.setFont(parent.getFont());
+ }
+
+ private int getTableStyle() {
+ return SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
+ }
+
+ public void addDoubleClickListener(IDoubleClickListener listener) {
+ tableViewer.addDoubleClickListener(listener);
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ tableViewer.addSelectionChangedListener(listener);
+ }
+
+ public void setInput(Object input) {
+ tableViewer.setInput(input);
+ }
+
+ public void setSelection(int index) {
+ tableViewer.getTable().select(index);
+ }
+
+ public void setSorter(ViewerSorter sorter) {
+ tableViewer.setSorter(sorter);
+ }
+
+ public IStructuredSelection getSelection() {
+ return (IStructuredSelection) tableViewer.getSelection();
+ }
+
+ public int indexOf(Object object) {
+ int found = -1;
+ TableItem[] items = tableViewer.getTable().getItems();
+ for (int index = 0; index < items.length; index++) {
+ TableItem item = items[index];
+ if (item.getData().equals(object)) {
+ found = index;
+ break;
+ }
+ }
+ return found;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/SelectionComposite.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/SelectionComposite.java
index d47329142b3..d5c627d755e 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/SelectionComposite.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/panels/SelectionComposite.java
@@ -1,376 +1,376 @@
-/*******************************************************************************
- * 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.ote.ui.define.panels;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.CheckboxCellEditor;
-import org.eclipse.jface.viewers.ColumnViewer;
-import org.eclipse.jface.viewers.DecorationOverlayIcon;
-import org.eclipse.jface.viewers.EditingSupport;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SelectionComposite extends Composite {
- private static final Image CONFLICT_IMAGE = ImageManager.getImage(OteDefineImage.OBSTRUCTED);
- private static final Image CHECKED_IMAGE = ImageManager.getImage(OteDefineImage.CHECKBOX_ENABLED);
- private static final Image UNCHECKED_IMAGE = ImageManager.getImage(OteDefineImage.CHECKBOX_DISABLED);
- private static Image CHECK_OVERRIDEN_IMAGE = null;
- private static Image UNCHECKED_OVERRIDEN_IMAGE = null;
-
- private final ITableLabelProvider tableLabelProvider;
- private TableViewer tableViewer;
- private final Object[] resources;
- private final boolean isSelectAllByDefault;
- private final Map<Object, MutableBoolean> selectableMap;
- private final Set<Object> userSelectedResources = new HashSet<Object>();
- private final Set<Object> notSelectableResources = new HashSet<Object>();
- private final Set<Object> overridable = new HashSet<Object>();
- private final String[] columnNames;
- private Label lblSelectedResourcesNumber;
- private IOverrideHandler overrideHandler;
- private boolean areOverridesAllowed;
-
- public SelectionComposite(Composite parent, int style, String[] columnNames, ITableLabelProvider tableLabelProvider, Object[] resources, boolean isSelectAllByDefault, IOverrideHandler overrideHandler) throws OseeCoreException {
- this(parent, style, columnNames, tableLabelProvider, resources, isSelectAllByDefault, null, null, overrideHandler);
- }
-
- public SelectionComposite(Composite parent, int style, String[] columnNames, ITableLabelProvider tableLabelProvider, Object[] resources, boolean isSelectAllByDefault, Object[] userSelectedResources, Object[] unSelectableResources, IOverrideHandler overrideHandler) {
- super(parent, style);
- this.columnNames = columnNames;
- this.tableLabelProvider = tableLabelProvider;
- this.selectableMap = new HashMap<Object, MutableBoolean>();
- this.resources = resources;
- this.isSelectAllByDefault = isSelectAllByDefault;
- if (userSelectedResources != null) {
- this.userSelectedResources.addAll(Arrays.asList(userSelectedResources));
- }
- if (unSelectableResources != null) {
- this.notSelectableResources.addAll(Arrays.asList(unSelectableResources));
- }
- this.overrideHandler = overrideHandler;
- if (overrideHandler != null) {
- try {
- this.overridable.addAll(overrideHandler.getOverridableFromUnselectable(notSelectableResources));
- } catch (OseeCoreException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
- this.areOverridesAllowed = false;
- createControls();
- }
-
- private void createControls() {
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- this.setLayout(gridLayout);
-
- createTableArea(this);
- Composite buttonComposite = createButtonArea(this);
- createLabelArea(buttonComposite);
- }
-
- private void createTableArea(Composite parent) {
- int style = SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER;
- Table table = new Table(parent, style);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- this.tableViewer = new TableViewer(table);
- this.tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
- this.tableViewer.setLabelProvider(this.tableLabelProvider);
- this.tableViewer.setContentProvider(new TableContentProvider());
- this.tableViewer.setSorter(new ViewerSorter());
-
- TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
- viewerColumn.setEditingSupport(new CheckColumnEditingSupport(tableViewer));
- viewerColumn.setLabelProvider(new CheckCellLabelProvider());
-
- createColumns();
-
- initializeSelections();
- this.tableViewer.setInput(this.resources);
- packColumnData();
- }
-
- private void packColumnData() {
- TableColumn[] columns = tableViewer.getTable().getColumns();
- for (TableColumn column : columns) {
- column.pack();
- }
- }
-
- private void createColumns() {
- Table table = tableViewer.getTable();
- for (String item : columnNames) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setResizable(true);
- column.setText(item);
- }
- }
-
- private void createLabelArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- this.lblSelectedResourcesNumber = new Label(composite, SWT.RIGHT);
- this.lblSelectedResourcesNumber.setText(selectItemsToString(getSelectedCount()));
- this.lblSelectedResourcesNumber.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- }
-
- private Composite createButtonArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.RIGHT);
- GridLayout gLayout = new GridLayout();
- gLayout.numColumns = overrideHandler != null ? 4 : 3;
- gLayout.marginWidth = 0;
- composite.setLayout(gLayout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Button selectButton = new Button(composite, SWT.PUSH);
- selectButton.setText("Select All");
- selectButton.setLayoutData(new GridData());
- selectButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- setAllItemsChecked(true);
- }
- });
-
- Button deselectButton = new Button(composite, SWT.PUSH);
- deselectButton.setText("Deselect All");
- deselectButton.setLayoutData(new GridData());
- deselectButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- setAllItemsChecked(false);
- }
- });
-
- if (overrideHandler != null) {
- final Button overrideButton = new Button(composite, SWT.CHECK);
- overrideButton.setText(overrideHandler.getText());
- overrideButton.setToolTipText(overrideHandler.getToolTipText());
- overrideButton.setLayoutData(new GridData());
- overrideButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- areOverridesAllowed = overrideButton.getSelection();
- if (areOverridesAllowed != false) {
- for (Object object : overridable) {
- selectableMap.put(object, new MutableBoolean(false));
- }
- } else {
- for (Object object : overridable) {
- selectableMap.remove(object);
- }
- }
- refresh();
- }
- });
- }
- return composite;
- }
-
- private void setAllItemsChecked(boolean state) {
- for (Object key : selectableMap.keySet()) {
- MutableBoolean mutable = selectableMap.get(key);
- mutable.setValue(state);
- selectableMap.put(key, mutable);
- }
- refresh();
- }
-
- private void refresh() {
- lblSelectedResourcesNumber.setText(selectItemsToString(getSelectedCount()));
- tableViewer.refresh();
- }
-
- protected void initializeSelections() {
- for (Object object : resources) {
- if (notSelectableResources.contains(object) != true) {
- boolean initialValue = userSelectedResources.contains(object) || isSelectAllByDefault;
- selectableMap.put(object, new MutableBoolean(initialValue));
- }
- }
- }
-
- protected String selectItemsToString(int value) {
- return String.format("Selected: %s of %s", String.valueOf(value), String.valueOf(resources.length));
- }
-
- public void addOverrideHandler(IOverrideHandler overrideHandler) {
- this.overrideHandler = overrideHandler;
- }
-
- public Object[] getSelectedResources() {
- return getSelectedItems(true);
- }
-
- public Object[] getNotSelectedResources() {
- return getSelectedItems(false);
- }
-
- private Object[] getSelectedItems(boolean thatMatchTrue) {
- List<Object> toReturn = new ArrayList<Object>();
- for (Object key : selectableMap.keySet()) {
- if (selectableMap.get(key).getValue() == thatMatchTrue) {
- toReturn.add(key);
- }
- }
- return toReturn.toArray(new Object[toReturn.size()]);
- }
-
- public int getSelectedCount() {
- int count = 0;
- for (MutableBoolean value : selectableMap.values()) {
- if (value.getValue() == true) {
- count++;
- }
- }
- return count;
- }
-
- private boolean isOverridable(Object element) {
- return overridable.contains(element) != false && areOverridesAllowed != false;
- }
-
- private final class TableContentProvider implements IStructuredContentProvider {
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public Object[] getElements(Object inputElement) {
- return resources;
- }
- }
-
- private final class CheckCellLabelProvider extends CellLabelProvider {
-
- public CheckCellLabelProvider() {
- super();
- }
-
- @Override
- public void update(ViewerCell cell) {
- if (cell.getColumnIndex() == 0) {
- Object data = cell.getItem().getData();
- if (notSelectableResources.contains(data) && isOverridable(data) != true) {
- cell.setImage(CONFLICT_IMAGE);
- } else {
- MutableBoolean isSelectedObject = selectableMap.get(data);
- boolean isSelected = isSelectedObject != null && isSelectedObject.getValue() == true;
- boolean isOverriden = overridable.contains(data);
- cell.setImage(getImage(isSelected, isOverriden));
- }
- }
- }
-
- private Image getImage(boolean isChecked, boolean isOverriden) {
- Image toReturn = isChecked != false ? CHECKED_IMAGE : UNCHECKED_IMAGE;
- if (isOverriden != false) {
- if (CHECK_OVERRIDEN_IMAGE == null || UNCHECKED_OVERRIDEN_IMAGE == null) {
- DecorationOverlayIcon overlay =
- new DecorationOverlayIcon(toReturn, ImageManager.getImageDescriptor(OteDefineImage.SWITCHED),
- IDecoration.BOTTOM_RIGHT);
-
- Image overlayedImage = overlay.createImage();
- if (isChecked != false) {
- CHECK_OVERRIDEN_IMAGE = overlayedImage;
- } else {
- UNCHECKED_OVERRIDEN_IMAGE = overlayedImage;
- }
- }
- toReturn = isChecked != false ? CHECK_OVERRIDEN_IMAGE : UNCHECKED_OVERRIDEN_IMAGE;
- }
- return toReturn;
- }
- }
-
- private final class CheckColumnEditingSupport extends EditingSupport {
-
- private final CheckboxCellEditor editor;
-
- public CheckColumnEditingSupport(ColumnViewer viewer) {
- super(viewer);
- this.editor = new CheckboxCellEditor((Composite) viewer.getControl());
- viewer.setCellEditors(new CellEditor[] {editor});
- }
-
- @Override
- protected boolean canEdit(Object element) {
- return notSelectableResources.contains(element) != true || overridable.contains(element);
- }
-
- @Override
- protected CellEditor getCellEditor(Object element) {
- return editor;
- }
-
- @Override
- protected Object getValue(Object element) {
- MutableBoolean value = selectableMap.get(element);
- return value != null ? value.getValue() : false;
- }
-
- @Override
- protected void setValue(Object element, Object value) {
- MutableBoolean object = selectableMap.get(element);
- if (object != null) {
- object.setValue((Boolean) value);
- }
- refresh();
- }
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.panels;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SelectionComposite extends Composite {
+ private static final Image CONFLICT_IMAGE = ImageManager.getImage(OteDefineImage.OBSTRUCTED);
+ private static final Image CHECKED_IMAGE = ImageManager.getImage(OteDefineImage.CHECKBOX_ENABLED);
+ private static final Image UNCHECKED_IMAGE = ImageManager.getImage(OteDefineImage.CHECKBOX_DISABLED);
+ private static Image CHECK_OVERRIDEN_IMAGE = null;
+ private static Image UNCHECKED_OVERRIDEN_IMAGE = null;
+
+ private final ITableLabelProvider tableLabelProvider;
+ private TableViewer tableViewer;
+ private final Object[] resources;
+ private final boolean isSelectAllByDefault;
+ private final Map<Object, MutableBoolean> selectableMap;
+ private final Set<Object> userSelectedResources = new HashSet<Object>();
+ private final Set<Object> notSelectableResources = new HashSet<Object>();
+ private final Set<Object> overridable = new HashSet<Object>();
+ private final String[] columnNames;
+ private Label lblSelectedResourcesNumber;
+ private IOverrideHandler overrideHandler;
+ private boolean areOverridesAllowed;
+
+ public SelectionComposite(Composite parent, int style, String[] columnNames, ITableLabelProvider tableLabelProvider, Object[] resources, boolean isSelectAllByDefault, IOverrideHandler overrideHandler) throws OseeCoreException {
+ this(parent, style, columnNames, tableLabelProvider, resources, isSelectAllByDefault, null, null, overrideHandler);
+ }
+
+ public SelectionComposite(Composite parent, int style, String[] columnNames, ITableLabelProvider tableLabelProvider, Object[] resources, boolean isSelectAllByDefault, Object[] userSelectedResources, Object[] unSelectableResources, IOverrideHandler overrideHandler) {
+ super(parent, style);
+ this.columnNames = columnNames;
+ this.tableLabelProvider = tableLabelProvider;
+ this.selectableMap = new HashMap<Object, MutableBoolean>();
+ this.resources = resources;
+ this.isSelectAllByDefault = isSelectAllByDefault;
+ if (userSelectedResources != null) {
+ this.userSelectedResources.addAll(Arrays.asList(userSelectedResources));
+ }
+ if (unSelectableResources != null) {
+ this.notSelectableResources.addAll(Arrays.asList(unSelectableResources));
+ }
+ this.overrideHandler = overrideHandler;
+ if (overrideHandler != null) {
+ try {
+ this.overridable.addAll(overrideHandler.getOverridableFromUnselectable(notSelectableResources));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+ this.areOverridesAllowed = false;
+ createControls();
+ }
+
+ private void createControls() {
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 0;
+ this.setLayout(gridLayout);
+
+ createTableArea(this);
+ Composite buttonComposite = createButtonArea(this);
+ createLabelArea(buttonComposite);
+ }
+
+ private void createTableArea(Composite parent) {
+ int style = SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER;
+ Table table = new Table(parent, style);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ TableLayout layout = new TableLayout();
+ table.setLayout(layout);
+
+ this.tableViewer = new TableViewer(table);
+ this.tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
+ this.tableViewer.setLabelProvider(this.tableLabelProvider);
+ this.tableViewer.setContentProvider(new TableContentProvider());
+ this.tableViewer.setSorter(new ViewerSorter());
+
+ TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
+ viewerColumn.setEditingSupport(new CheckColumnEditingSupport(tableViewer));
+ viewerColumn.setLabelProvider(new CheckCellLabelProvider());
+
+ createColumns();
+
+ initializeSelections();
+ this.tableViewer.setInput(this.resources);
+ packColumnData();
+ }
+
+ private void packColumnData() {
+ TableColumn[] columns = tableViewer.getTable().getColumns();
+ for (TableColumn column : columns) {
+ column.pack();
+ }
+ }
+
+ private void createColumns() {
+ Table table = tableViewer.getTable();
+ for (String item : columnNames) {
+ TableColumn column = new TableColumn(table, SWT.NONE);
+ column.setResizable(true);
+ column.setText(item);
+ }
+ }
+
+ private void createLabelArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.horizontalSpacing = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ this.lblSelectedResourcesNumber = new Label(composite, SWT.RIGHT);
+ this.lblSelectedResourcesNumber.setText(selectItemsToString(getSelectedCount()));
+ this.lblSelectedResourcesNumber.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ }
+
+ private Composite createButtonArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.RIGHT);
+ GridLayout gLayout = new GridLayout();
+ gLayout.numColumns = overrideHandler != null ? 4 : 3;
+ gLayout.marginWidth = 0;
+ composite.setLayout(gLayout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Button selectButton = new Button(composite, SWT.PUSH);
+ selectButton.setText("Select All");
+ selectButton.setLayoutData(new GridData());
+ selectButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setAllItemsChecked(true);
+ }
+ });
+
+ Button deselectButton = new Button(composite, SWT.PUSH);
+ deselectButton.setText("Deselect All");
+ deselectButton.setLayoutData(new GridData());
+ deselectButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setAllItemsChecked(false);
+ }
+ });
+
+ if (overrideHandler != null) {
+ final Button overrideButton = new Button(composite, SWT.CHECK);
+ overrideButton.setText(overrideHandler.getText());
+ overrideButton.setToolTipText(overrideHandler.getToolTipText());
+ overrideButton.setLayoutData(new GridData());
+ overrideButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ areOverridesAllowed = overrideButton.getSelection();
+ if (areOverridesAllowed != false) {
+ for (Object object : overridable) {
+ selectableMap.put(object, new MutableBoolean(false));
+ }
+ } else {
+ for (Object object : overridable) {
+ selectableMap.remove(object);
+ }
+ }
+ refresh();
+ }
+ });
+ }
+ return composite;
+ }
+
+ private void setAllItemsChecked(boolean state) {
+ for (Object key : selectableMap.keySet()) {
+ MutableBoolean mutable = selectableMap.get(key);
+ mutable.setValue(state);
+ selectableMap.put(key, mutable);
+ }
+ refresh();
+ }
+
+ private void refresh() {
+ lblSelectedResourcesNumber.setText(selectItemsToString(getSelectedCount()));
+ tableViewer.refresh();
+ }
+
+ protected void initializeSelections() {
+ for (Object object : resources) {
+ if (notSelectableResources.contains(object) != true) {
+ boolean initialValue = userSelectedResources.contains(object) || isSelectAllByDefault;
+ selectableMap.put(object, new MutableBoolean(initialValue));
+ }
+ }
+ }
+
+ protected String selectItemsToString(int value) {
+ return String.format("Selected: %s of %s", String.valueOf(value), String.valueOf(resources.length));
+ }
+
+ public void addOverrideHandler(IOverrideHandler overrideHandler) {
+ this.overrideHandler = overrideHandler;
+ }
+
+ public Object[] getSelectedResources() {
+ return getSelectedItems(true);
+ }
+
+ public Object[] getNotSelectedResources() {
+ return getSelectedItems(false);
+ }
+
+ private Object[] getSelectedItems(boolean thatMatchTrue) {
+ List<Object> toReturn = new ArrayList<Object>();
+ for (Object key : selectableMap.keySet()) {
+ if (selectableMap.get(key).getValue() == thatMatchTrue) {
+ toReturn.add(key);
+ }
+ }
+ return toReturn.toArray(new Object[toReturn.size()]);
+ }
+
+ public int getSelectedCount() {
+ int count = 0;
+ for (MutableBoolean value : selectableMap.values()) {
+ if (value.getValue() == true) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ private boolean isOverridable(Object element) {
+ return overridable.contains(element) != false && areOverridesAllowed != false;
+ }
+
+ private final class TableContentProvider implements IStructuredContentProvider {
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return resources;
+ }
+ }
+
+ private final class CheckCellLabelProvider extends CellLabelProvider {
+
+ public CheckCellLabelProvider() {
+ super();
+ }
+
+ @Override
+ public void update(ViewerCell cell) {
+ if (cell.getColumnIndex() == 0) {
+ Object data = cell.getItem().getData();
+ if (notSelectableResources.contains(data) && isOverridable(data) != true) {
+ cell.setImage(CONFLICT_IMAGE);
+ } else {
+ MutableBoolean isSelectedObject = selectableMap.get(data);
+ boolean isSelected = isSelectedObject != null && isSelectedObject.getValue() == true;
+ boolean isOverriden = overridable.contains(data);
+ cell.setImage(getImage(isSelected, isOverriden));
+ }
+ }
+ }
+
+ private Image getImage(boolean isChecked, boolean isOverriden) {
+ Image toReturn = isChecked != false ? CHECKED_IMAGE : UNCHECKED_IMAGE;
+ if (isOverriden != false) {
+ if (CHECK_OVERRIDEN_IMAGE == null || UNCHECKED_OVERRIDEN_IMAGE == null) {
+ DecorationOverlayIcon overlay =
+ new DecorationOverlayIcon(toReturn, ImageManager.getImageDescriptor(OteDefineImage.SWITCHED),
+ IDecoration.BOTTOM_RIGHT);
+
+ Image overlayedImage = overlay.createImage();
+ if (isChecked != false) {
+ CHECK_OVERRIDEN_IMAGE = overlayedImage;
+ } else {
+ UNCHECKED_OVERRIDEN_IMAGE = overlayedImage;
+ }
+ }
+ toReturn = isChecked != false ? CHECK_OVERRIDEN_IMAGE : UNCHECKED_OVERRIDEN_IMAGE;
+ }
+ return toReturn;
+ }
+ }
+
+ private final class CheckColumnEditingSupport extends EditingSupport {
+
+ private final CheckboxCellEditor editor;
+
+ public CheckColumnEditingSupport(ColumnViewer viewer) {
+ super(viewer);
+ this.editor = new CheckboxCellEditor((Composite) viewer.getControl());
+ viewer.setCellEditors(new CellEditor[] {editor});
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return notSelectableResources.contains(element) != true || overridable.contains(element);
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return editor;
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ MutableBoolean value = selectableMap.get(element);
+ return value != null ? value.getValue() : false;
+ }
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ MutableBoolean object = selectableMap.get(element);
+ if (object != null) {
+ object.setValue((Boolean) value);
+ }
+ refresh();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HighLevelSummary.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HighLevelSummary.java
index e2f66c0b32d..66a761458e1 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HighLevelSummary.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HighLevelSummary.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports;
-
+package org.eclipse.osee.ote.ui.define.reports;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -21,159 +21,159 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.utility.Requirements;
import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HighLevelSummary implements ITestRunReport {
- private static final String[] HEADER =
- new String[] {Requirements.PARTITION, Requirements.SUBSYSTEM, "ScriptCount", "RunTime Issues",
- "Scripts with Failures", "Scripts Pass"};
- private Map<String, CollectedData> dataMap;
-
- public HighLevelSummary() {
- this.dataMap = new HashMap<String, CollectedData>();
- }
-
- public void gatherData(IProgressMonitor monitor, TestRunOperator... items) throws Exception {
- clear();
- for (int index = 0; index < items.length; index++) {
- TestRunOperator operator = items[index];
- monitor.subTask(String.format("Processing [%s of%s]", index + 1, items.length));
- String partition = operator.getPartition();
- String subsystem = operator.getSubsystem();
- String key = String.format("%s:%s", partition, subsystem);
- CollectedData data = dataMap.get(key);
- if (data == null) {
- data = new CollectedData(partition, subsystem);
- dataMap.put(key, data);
- }
- try {
- processData(data, operator);
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- if (monitor.isCanceled()) {
- break;
- }
- }
- }
-
- public String[][] getBody() {
- int numRows = dataMap.size();
- List<String> keys = new ArrayList<String>(dataMap.keySet());
- String[][] toReturn = new String[numRows][getHeader().length];
- for (int row = 0; row < numRows; row++) {
- String key = keys.get(row);
- CollectedData collectedData = dataMap.get(key);
- toReturn[row] = addRow(collectedData);
- }
- return toReturn;
- }
-
- private String[] addRow(CollectedData data) {
- List<String> values = new ArrayList<String>();
- values.add(data.getPartition());
- values.add(data.getSubsytem());
- values.add(Integer.toString(data.getScriptCount()));
- values.add(Integer.toString(data.getRunTimeIssues()));
- values.add(Integer.toString(data.getScriptWithFailures()));
- values.add(Integer.toString(data.getScriptPassed()));
- return values.toArray(new String[values.size()]);
- }
-
- public String[] getHeader() {
- return HEADER;
- }
-
- public String getTitle() {
- return "High Level Test Run Summary";
- }
-
- private void processData(CollectedData data, TestRunOperator operator) throws OseeCoreException {
- data.incrementScriptCount();
-
- int failed = operator.getTestPointsFailed();
- int passed = operator.getTestPointsPassed();
- int total = operator.getTotalTestPoints();
- boolean wasAborted = operator.wasAborted();
-
- if (wasAborted) {
- data.incrementRunTimeIssues();
- } else if (total == 0) {
- data.incrementRunTimeIssues();
- } else if (failed > 0) {
- data.incrementScriptWithFailures();
- } else if (passed == total && failed == 0) {
- data.incrementScriptPassed();
- }
- }
-
- private final class CollectedData {
- private String partition;
- private String subsytem;
- private int scriptCount;
- private int runTimeIssues;
- private int scriptWithFailures;
- private int scriptPassed;
-
- public CollectedData(String partition, String subsytem) {
- this.partition = partition;
- this.subsytem = subsytem;
- this.scriptCount = 0;
- this.runTimeIssues = 0;
- this.scriptWithFailures = 0;
- this.scriptPassed = 0;
- }
-
- public String getPartition() {
- return partition;
- }
-
- public String getSubsytem() {
- return subsytem;
- }
-
- public int getScriptCount() {
- return scriptCount;
- }
-
- public int getRunTimeIssues() {
- return runTimeIssues;
- }
-
- public int getScriptWithFailures() {
- return scriptWithFailures;
- }
-
- public int getScriptPassed() {
- return scriptPassed;
- }
-
- public void incrementScriptCount() {
- this.scriptCount++;
- }
-
- public void incrementRunTimeIssues() {
- this.runTimeIssues++;
- }
-
- public void incrementScriptWithFailures() {
- this.scriptWithFailures++;
- }
-
- public void incrementScriptPassed() {
- this.scriptPassed++;
- }
- }
-
- public String getDescription() {
- return "Generates a summary report of all test runs.";
- }
-
- @Override
- public void clear() {
- this.dataMap.clear();
- }
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class HighLevelSummary implements ITestRunReport {
+ private static final String[] HEADER =
+ new String[] {Requirements.PARTITION, Requirements.SUBSYSTEM, "ScriptCount", "RunTime Issues",
+ "Scripts with Failures", "Scripts Pass"};
+ private Map<String, CollectedData> dataMap;
+
+ public HighLevelSummary() {
+ this.dataMap = new HashMap<String, CollectedData>();
+ }
+
+ public void gatherData(IProgressMonitor monitor, TestRunOperator... items) throws Exception {
+ clear();
+ for (int index = 0; index < items.length; index++) {
+ TestRunOperator operator = items[index];
+ monitor.subTask(String.format("Processing [%s of%s]", index + 1, items.length));
+ String partition = operator.getPartition();
+ String subsystem = operator.getSubsystem();
+ String key = String.format("%s:%s", partition, subsystem);
+ CollectedData data = dataMap.get(key);
+ if (data == null) {
+ data = new CollectedData(partition, subsystem);
+ dataMap.put(key, data);
+ }
+ try {
+ processData(data, operator);
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ if (monitor.isCanceled()) {
+ break;
+ }
+ }
+ }
+
+ public String[][] getBody() {
+ int numRows = dataMap.size();
+ List<String> keys = new ArrayList<String>(dataMap.keySet());
+ String[][] toReturn = new String[numRows][getHeader().length];
+ for (int row = 0; row < numRows; row++) {
+ String key = keys.get(row);
+ CollectedData collectedData = dataMap.get(key);
+ toReturn[row] = addRow(collectedData);
+ }
+ return toReturn;
+ }
+
+ private String[] addRow(CollectedData data) {
+ List<String> values = new ArrayList<String>();
+ values.add(data.getPartition());
+ values.add(data.getSubsytem());
+ values.add(Integer.toString(data.getScriptCount()));
+ values.add(Integer.toString(data.getRunTimeIssues()));
+ values.add(Integer.toString(data.getScriptWithFailures()));
+ values.add(Integer.toString(data.getScriptPassed()));
+ return values.toArray(new String[values.size()]);
+ }
+
+ public String[] getHeader() {
+ return HEADER;
+ }
+
+ public String getTitle() {
+ return "High Level Test Run Summary";
+ }
+
+ private void processData(CollectedData data, TestRunOperator operator) throws OseeCoreException {
+ data.incrementScriptCount();
+
+ int failed = operator.getTestPointsFailed();
+ int passed = operator.getTestPointsPassed();
+ int total = operator.getTotalTestPoints();
+ boolean wasAborted = operator.wasAborted();
+
+ if (wasAborted) {
+ data.incrementRunTimeIssues();
+ } else if (total == 0) {
+ data.incrementRunTimeIssues();
+ } else if (failed > 0) {
+ data.incrementScriptWithFailures();
+ } else if (passed == total && failed == 0) {
+ data.incrementScriptPassed();
+ }
+ }
+
+ private final class CollectedData {
+ private String partition;
+ private String subsytem;
+ private int scriptCount;
+ private int runTimeIssues;
+ private int scriptWithFailures;
+ private int scriptPassed;
+
+ public CollectedData(String partition, String subsytem) {
+ this.partition = partition;
+ this.subsytem = subsytem;
+ this.scriptCount = 0;
+ this.runTimeIssues = 0;
+ this.scriptWithFailures = 0;
+ this.scriptPassed = 0;
+ }
+
+ public String getPartition() {
+ return partition;
+ }
+
+ public String getSubsytem() {
+ return subsytem;
+ }
+
+ public int getScriptCount() {
+ return scriptCount;
+ }
+
+ public int getRunTimeIssues() {
+ return runTimeIssues;
+ }
+
+ public int getScriptWithFailures() {
+ return scriptWithFailures;
+ }
+
+ public int getScriptPassed() {
+ return scriptPassed;
+ }
+
+ public void incrementScriptCount() {
+ this.scriptCount++;
+ }
+
+ public void incrementRunTimeIssues() {
+ this.runTimeIssues++;
+ }
+
+ public void incrementScriptWithFailures() {
+ this.scriptWithFailures++;
+ }
+
+ public void incrementScriptPassed() {
+ this.scriptPassed++;
+ }
+ }
+
+ public String getDescription() {
+ return "Generates a summary report of all test runs.";
+ }
+
+ @Override
+ public void clear() {
+ this.dataMap.clear();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HistoricalTestRunData.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HistoricalTestRunData.java
index fb898f67605..3fd50d58a1c 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HistoricalTestRunData.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/HistoricalTestRunData.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports;
-
+package org.eclipse.osee.ote.ui.define.reports;
+
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -26,117 +26,117 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HistoricalTestRunData implements ITestRunReport {
- private static final String DATE_HEADER = "Date";
- private static final String[] PER_SCRIPT_HEADER = new String[] {"Passed", "Failed", "Total", "Status"};
-
- private static final DateFormat formatter = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
-
- private HashMap<Date, Map<String, TestRunOperator>> runByCollection;
- private Set<String> runsByName;
-
- public HistoricalTestRunData() {
- this.runByCollection = new HashMap<Date, Map<String, TestRunOperator>>();
- this.runsByName = new TreeSet<String>();
- }
-
- public void gatherData(IProgressMonitor monitor, TestRunOperator... artifacts) throws Exception {
- clear();
- for (TestRunOperator operator : artifacts) {
- try {
- Date date = operator.getEndDate();
- Map<String, TestRunOperator> theMap = runByCollection.get(date);
- if (theMap == null) {
- theMap = new HashMap<String, TestRunOperator>();
- runByCollection.put(date, theMap);
- }
- String name = operator.getScriptSimpleName();
- theMap.put(name, operator);
- runsByName.add(name);
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
- }
-
- public String[][] getBody() {
- String[][] toReturn = new String[runByCollection.size() + 1][getHeader().length];
- int index = 0;
- toReturn[index++] = getTitleRow();
- List<Date> dateList = new ArrayList<Date>(runByCollection.keySet());
- Collections.sort(dateList);
- for (Date date : dateList) {
- Map<String, TestRunOperator> theMap = runByCollection.get(date);
- toReturn[index++] = getRow(date, theMap);
- }
- return toReturn;
- }
-
- private String[] getRow(Date date, Map<String, TestRunOperator> theMap) {
- List<String> row = new ArrayList<String>();
- row.add(formatter.format(date));
- for (String name : runsByName) {
- TestRunOperator operator = theMap.get(name);
- for (String entry : getData(operator)) {
- row.add(entry);
- }
- }
- return row.toArray(new String[row.size()]);
- }
-
- private String[] getData(TestRunOperator operator) {
- String[] data = new String[PER_SCRIPT_HEADER.length];
- Arrays.fill(data, ONE_SPACE_STRING);
- try {
- if (operator != null) {
- data[0] = Integer.toString(operator.getTestPointsPassed());
- data[1] = Integer.toString(operator.getTestPointsFailed());
- data[2] = Integer.toString(operator.getTotalTestPoints());
- data[3] = operator.getTestResultStatus();
- }
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- return data;
- }
-
- private String[] getTitleRow() {
- List<String> header = new ArrayList<String>();
- header.add(ONE_SPACE_STRING);
- for (int index = 0; index < runsByName.size(); index++) {
- header.addAll(Arrays.asList(PER_SCRIPT_HEADER));
- }
- return header.toArray(new String[header.size()]);
- }
-
- public String getDescription() {
- return "Creates a table of run results by date.";
- }
-
- public String[] getHeader() {
- List<String> header = new ArrayList<String>();
- header.add(DATE_HEADER);
- for (String name : runsByName) {
- header.add(name);
- header.add(ONE_SPACE_STRING);
- header.add(ONE_SPACE_STRING);
- header.add(ONE_SPACE_STRING);
- }
- return header.toArray(new String[header.size()]);
- }
-
- public String getTitle() {
- return "Test Run Historical Trend";
- }
-
- @Override
- public void clear() {
- this.runByCollection.clear();
- this.runsByName.clear();
- }
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class HistoricalTestRunData implements ITestRunReport {
+ private static final String DATE_HEADER = "Date";
+ private static final String[] PER_SCRIPT_HEADER = new String[] {"Passed", "Failed", "Total", "Status"};
+
+ private static final DateFormat formatter = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
+
+ private HashMap<Date, Map<String, TestRunOperator>> runByCollection;
+ private Set<String> runsByName;
+
+ public HistoricalTestRunData() {
+ this.runByCollection = new HashMap<Date, Map<String, TestRunOperator>>();
+ this.runsByName = new TreeSet<String>();
+ }
+
+ public void gatherData(IProgressMonitor monitor, TestRunOperator... artifacts) throws Exception {
+ clear();
+ for (TestRunOperator operator : artifacts) {
+ try {
+ Date date = operator.getEndDate();
+ Map<String, TestRunOperator> theMap = runByCollection.get(date);
+ if (theMap == null) {
+ theMap = new HashMap<String, TestRunOperator>();
+ runByCollection.put(date, theMap);
+ }
+ String name = operator.getScriptSimpleName();
+ theMap.put(name, operator);
+ runsByName.add(name);
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ public String[][] getBody() {
+ String[][] toReturn = new String[runByCollection.size() + 1][getHeader().length];
+ int index = 0;
+ toReturn[index++] = getTitleRow();
+ List<Date> dateList = new ArrayList<Date>(runByCollection.keySet());
+ Collections.sort(dateList);
+ for (Date date : dateList) {
+ Map<String, TestRunOperator> theMap = runByCollection.get(date);
+ toReturn[index++] = getRow(date, theMap);
+ }
+ return toReturn;
+ }
+
+ private String[] getRow(Date date, Map<String, TestRunOperator> theMap) {
+ List<String> row = new ArrayList<String>();
+ row.add(formatter.format(date));
+ for (String name : runsByName) {
+ TestRunOperator operator = theMap.get(name);
+ for (String entry : getData(operator)) {
+ row.add(entry);
+ }
+ }
+ return row.toArray(new String[row.size()]);
+ }
+
+ private String[] getData(TestRunOperator operator) {
+ String[] data = new String[PER_SCRIPT_HEADER.length];
+ Arrays.fill(data, ONE_SPACE_STRING);
+ try {
+ if (operator != null) {
+ data[0] = Integer.toString(operator.getTestPointsPassed());
+ data[1] = Integer.toString(operator.getTestPointsFailed());
+ data[2] = Integer.toString(operator.getTotalTestPoints());
+ data[3] = operator.getTestResultStatus();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ return data;
+ }
+
+ private String[] getTitleRow() {
+ List<String> header = new ArrayList<String>();
+ header.add(ONE_SPACE_STRING);
+ for (int index = 0; index < runsByName.size(); index++) {
+ header.addAll(Arrays.asList(PER_SCRIPT_HEADER));
+ }
+ return header.toArray(new String[header.size()]);
+ }
+
+ public String getDescription() {
+ return "Creates a table of run results by date.";
+ }
+
+ public String[] getHeader() {
+ List<String> header = new ArrayList<String>();
+ header.add(DATE_HEADER);
+ for (String name : runsByName) {
+ header.add(name);
+ header.add(ONE_SPACE_STRING);
+ header.add(ONE_SPACE_STRING);
+ header.add(ONE_SPACE_STRING);
+ }
+ return header.toArray(new String[header.size()]);
+ }
+
+ public String getTitle() {
+ return "Test Run Historical Trend";
+ }
+
+ @Override
+ public void clear() {
+ this.runByCollection.clear();
+ this.runsByName.clear();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/ITestRunReport.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/ITestRunReport.java
index 656fed710b0..d9d86bf01a2 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/ITestRunReport.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/ITestRunReport.java
@@ -8,29 +8,29 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports;
-
+package org.eclipse.osee.ote.ui.define.reports;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface ITestRunReport {
-
- public static final String ONE_SPACE_STRING = " ";
- public static final String EMPTY_STRING = "";
- public static final String FLOAT_TYPE = "float";
-
- public void gatherData(IProgressMonitor monitor, TestRunOperator... artifacts) throws Exception;
-
- public String getTitle();
-
- public String[] getHeader();
-
- public String[][] getBody();
-
- public String getDescription();
-
- public void clear();
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface ITestRunReport {
+
+ public static final String ONE_SPACE_STRING = " ";
+ public static final String EMPTY_STRING = "";
+ public static final String FLOAT_TYPE = "float";
+
+ public void gatherData(IProgressMonitor monitor, TestRunOperator... artifacts) throws Exception;
+
+ public String getTitle();
+
+ public String[] getHeader();
+
+ public String[][] getBody();
+
+ public String getDescription();
+
+ public void clear();
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTable.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTable.java
index 23d9b9f7fe1..7b78af85855 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTable.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTable.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports.html;
-
+package org.eclipse.osee.ote.ui.define.reports.html;
+
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
@@ -21,199 +21,199 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
import org.eclipse.osee.ote.ui.define.utilities.HtmlStringUtils;
import org.osgi.framework.Bundle;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HtmlActiveTable {
- private static final String TEMPLATE_PATH = "templates/HtmlActiveTableTemplate";
-
- private static final String ELEMENT_NAME_TAG = "##ELEMENT_NAME##";
- private static final String TABLE_HEIGHT = "##HEIGHT##";
- private static final String TABLE_WIDTH = "##WIDTH##";
- private static final String TABLE_TITLE = "##TABLE_TITLE##";
-
- private static final String TABLE_DATA_TAG = "##TABLE_DATA##";
- private static final String CUSTOM_FUNCTIONS_TAG = "##CUSTOM_FUNCTIONS##";
- private static final String COLUMN_METADATA_TAG = "##COLUMN_DATA##";
- private static final String COLUMN_CUSTOMIZATIONS_TAG = "##COLUMN_CUSTOMIZATIONS_DATA##";
- private static final String AUTO_EXPAND_ON_COLUMN = "##AUTO_EXPAND_COLUMN##";
-
- private String elementName;
- private String tableHeight;
- private String tableWidth;
- private String tableTitle;
- private List<List<String>> rowData;
- private List<HtmlActiveTableColumnData> columnList;
-
- public HtmlActiveTable() {
- super();
- this.rowData = new ArrayList<List<String>>();
- this.columnList = new ArrayList<HtmlActiveTableColumnData>();
- this.elementName = "ID";
- this.tableHeight = "";
- this.tableWidth = "";
- this.tableTitle = this.getClass().getName();
- }
-
- public void setElementName(String elementName) {
- this.elementName = elementName;
- }
-
- public void setTableHeight(String tableHeight) {
- this.tableHeight = tableHeight;
- }
-
- public void setTableWidth(String tableWidth) {
- this.tableWidth = tableWidth;
- }
-
- public void setTableTitle(String tableTitle) {
- this.tableTitle = tableTitle;
- }
-
- private URL getTemplate() throws IOException {
- URL url = null;
- Bundle bundle = OteUiDefinePlugin.getInstance().getBundle();
- if (bundle != null) {
- url = bundle.getEntry(TEMPLATE_PATH);
- url = FileLocator.resolve(url);
- }
- return url;
- }
-
- public void addColumn(HtmlActiveTableColumnData columnData) {
- this.columnList.add(columnData);
- }
-
- private String getColumnDataStoreInfo() {
- StringBuilder builder = new StringBuilder();
- int size = columnList.size();
- for (int index = 0; index < size; index++) {
- HtmlActiveTableColumnData data = columnList.get(index);
- builder.append(data.asMetaData());
- if (index + 1 < size) {
- builder.append(",\n");
- }
- }
- return builder.toString();
- }
-
- private String getColumnCustomizations() {
- StringBuilder builder = new StringBuilder();
- int size = columnList.size();
- for (int index = 0; index < size; index++) {
- HtmlActiveTableColumnData data = columnList.get(index);
- String row = data.asColumnCustomization();
-
- if (index == 0) {
- row = row.substring(1, row.length());
- builder.append("{ id:");
- String name = data.getName().toLowerCase();
- builder.append(HtmlStringUtils.addSingleQuotes(HtmlStringUtils.escapeString(name)));
- builder.append(", ");
- }
- builder.append(row);
- if (index + 1 < size) {
- builder.append(",\n");
- }
- }
- return builder.toString();
- }
-
- public String generate() throws IOException {
- URL url = getTemplate();
- String template = Lib.inputStreamToString(url.openStream());
-
- try {
- template = template.replace(ELEMENT_NAME_TAG, elementName);
- String widthEntry = "autoWidth: true";
- if (Strings.isValid(tableWidth)) {
- widthEntry = "width: " + tableWidth;
- }
- template = template.replace(TABLE_WIDTH, widthEntry);
- String heightEntry = "autoHeight: true";
- if (Strings.isValid(tableHeight)) {
- heightEntry = "height: " + tableHeight;
- }
- template = template.replace(TABLE_HEIGHT, heightEntry);
- template = template.replace(TABLE_TITLE, tableTitle);
- template = template.replace(COLUMN_METADATA_TAG, getColumnDataStoreInfo());
- template = template.replace(TABLE_DATA_TAG, generateTableData());
- template = template.replace(CUSTOM_FUNCTIONS_TAG, getCustomFunction());
- template = template.replace(COLUMN_CUSTOMIZATIONS_TAG, getColumnCustomizations());
- template = template.replace(AUTO_EXPAND_ON_COLUMN, getAutoExpandColumn());
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return template;
- }
-
- private String getAutoExpandColumn() {
- StringBuilder builder = new StringBuilder();
- if (columnList.size() > 0) {
- builder.append("autoExpandColumn: ");
- HtmlActiveTableColumnData data = columnList.get(0);
- String name = data.getName().toLowerCase();
- builder.append(HtmlStringUtils.addSingleQuotes(HtmlStringUtils.escapeString(name)));
- builder.append(", autoExpandMin: ");
- builder.append(data.getWidth());
- builder.append(", autoExpandMax: ");
- builder.append(data.getWidth() * 10);
- }
- return builder.toString();
- }
-
- private String generateTableData() {
- StringBuilder builder = new StringBuilder();
- for (int index = 0; index < rowData.size(); index++) {
- builder.append(processRow(rowData.get(index)));
- if (index + 1 < rowData.size()) {
- builder.append(", ");
- }
- }
- return builder.toString();
- }
-
- private String processRow(List<String> values) {
- StringBuilder builder = new StringBuilder();
- builder.append("[ ");
- for (int index = 0; index < values.size(); index++) {
- String rawData = values.get(index);
- String data = HtmlStringUtils.escapeString(rawData != null ? rawData : "");
- HtmlActiveTableColumnData metaData = columnList.get(index);
- if (Strings.isValid(metaData.getType()) != true || metaData.getType().equalsIgnoreCase("string")) {
- data = HtmlStringUtils.addSingleQuotes(data);
- }
- builder.append(data);
- if (index + 1 < values.size()) {
- builder.append(",");
- }
- }
- builder.append(" ]\n");
- return builder.toString();
- }
-
- public void addDataRow(String... values) {
- this.rowData.add(Arrays.asList(values));
- }
-
- public String getElementName() {
- return elementName;
- }
-
- private String getCustomFunction() {
- StringBuilder builder = new StringBuilder();
- // TODO: Create Custom Colors
- // function change(val){
- // if(val > 0){
- // return '<span style="color:green;">' + val + '</span>';
- // }else if(val < 0){
- // return '<span style="color:red;">' + val + '</span>';
- // }
- // return val;
- // }
- return builder.toString();
- }
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class HtmlActiveTable {
+ private static final String TEMPLATE_PATH = "templates/HtmlActiveTableTemplate";
+
+ private static final String ELEMENT_NAME_TAG = "##ELEMENT_NAME##";
+ private static final String TABLE_HEIGHT = "##HEIGHT##";
+ private static final String TABLE_WIDTH = "##WIDTH##";
+ private static final String TABLE_TITLE = "##TABLE_TITLE##";
+
+ private static final String TABLE_DATA_TAG = "##TABLE_DATA##";
+ private static final String CUSTOM_FUNCTIONS_TAG = "##CUSTOM_FUNCTIONS##";
+ private static final String COLUMN_METADATA_TAG = "##COLUMN_DATA##";
+ private static final String COLUMN_CUSTOMIZATIONS_TAG = "##COLUMN_CUSTOMIZATIONS_DATA##";
+ private static final String AUTO_EXPAND_ON_COLUMN = "##AUTO_EXPAND_COLUMN##";
+
+ private String elementName;
+ private String tableHeight;
+ private String tableWidth;
+ private String tableTitle;
+ private List<List<String>> rowData;
+ private List<HtmlActiveTableColumnData> columnList;
+
+ public HtmlActiveTable() {
+ super();
+ this.rowData = new ArrayList<List<String>>();
+ this.columnList = new ArrayList<HtmlActiveTableColumnData>();
+ this.elementName = "ID";
+ this.tableHeight = "";
+ this.tableWidth = "";
+ this.tableTitle = this.getClass().getName();
+ }
+
+ public void setElementName(String elementName) {
+ this.elementName = elementName;
+ }
+
+ public void setTableHeight(String tableHeight) {
+ this.tableHeight = tableHeight;
+ }
+
+ public void setTableWidth(String tableWidth) {
+ this.tableWidth = tableWidth;
+ }
+
+ public void setTableTitle(String tableTitle) {
+ this.tableTitle = tableTitle;
+ }
+
+ private URL getTemplate() throws IOException {
+ URL url = null;
+ Bundle bundle = OteUiDefinePlugin.getInstance().getBundle();
+ if (bundle != null) {
+ url = bundle.getEntry(TEMPLATE_PATH);
+ url = FileLocator.resolve(url);
+ }
+ return url;
+ }
+
+ public void addColumn(HtmlActiveTableColumnData columnData) {
+ this.columnList.add(columnData);
+ }
+
+ private String getColumnDataStoreInfo() {
+ StringBuilder builder = new StringBuilder();
+ int size = columnList.size();
+ for (int index = 0; index < size; index++) {
+ HtmlActiveTableColumnData data = columnList.get(index);
+ builder.append(data.asMetaData());
+ if (index + 1 < size) {
+ builder.append(",\n");
+ }
+ }
+ return builder.toString();
+ }
+
+ private String getColumnCustomizations() {
+ StringBuilder builder = new StringBuilder();
+ int size = columnList.size();
+ for (int index = 0; index < size; index++) {
+ HtmlActiveTableColumnData data = columnList.get(index);
+ String row = data.asColumnCustomization();
+
+ if (index == 0) {
+ row = row.substring(1, row.length());
+ builder.append("{ id:");
+ String name = data.getName().toLowerCase();
+ builder.append(HtmlStringUtils.addSingleQuotes(HtmlStringUtils.escapeString(name)));
+ builder.append(", ");
+ }
+ builder.append(row);
+ if (index + 1 < size) {
+ builder.append(",\n");
+ }
+ }
+ return builder.toString();
+ }
+
+ public String generate() throws IOException {
+ URL url = getTemplate();
+ String template = Lib.inputStreamToString(url.openStream());
+
+ try {
+ template = template.replace(ELEMENT_NAME_TAG, elementName);
+ String widthEntry = "autoWidth: true";
+ if (Strings.isValid(tableWidth)) {
+ widthEntry = "width: " + tableWidth;
+ }
+ template = template.replace(TABLE_WIDTH, widthEntry);
+ String heightEntry = "autoHeight: true";
+ if (Strings.isValid(tableHeight)) {
+ heightEntry = "height: " + tableHeight;
+ }
+ template = template.replace(TABLE_HEIGHT, heightEntry);
+ template = template.replace(TABLE_TITLE, tableTitle);
+ template = template.replace(COLUMN_METADATA_TAG, getColumnDataStoreInfo());
+ template = template.replace(TABLE_DATA_TAG, generateTableData());
+ template = template.replace(CUSTOM_FUNCTIONS_TAG, getCustomFunction());
+ template = template.replace(COLUMN_CUSTOMIZATIONS_TAG, getColumnCustomizations());
+ template = template.replace(AUTO_EXPAND_ON_COLUMN, getAutoExpandColumn());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return template;
+ }
+
+ private String getAutoExpandColumn() {
+ StringBuilder builder = new StringBuilder();
+ if (columnList.size() > 0) {
+ builder.append("autoExpandColumn: ");
+ HtmlActiveTableColumnData data = columnList.get(0);
+ String name = data.getName().toLowerCase();
+ builder.append(HtmlStringUtils.addSingleQuotes(HtmlStringUtils.escapeString(name)));
+ builder.append(", autoExpandMin: ");
+ builder.append(data.getWidth());
+ builder.append(", autoExpandMax: ");
+ builder.append(data.getWidth() * 10);
+ }
+ return builder.toString();
+ }
+
+ private String generateTableData() {
+ StringBuilder builder = new StringBuilder();
+ for (int index = 0; index < rowData.size(); index++) {
+ builder.append(processRow(rowData.get(index)));
+ if (index + 1 < rowData.size()) {
+ builder.append(", ");
+ }
+ }
+ return builder.toString();
+ }
+
+ private String processRow(List<String> values) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("[ ");
+ for (int index = 0; index < values.size(); index++) {
+ String rawData = values.get(index);
+ String data = HtmlStringUtils.escapeString(rawData != null ? rawData : "");
+ HtmlActiveTableColumnData metaData = columnList.get(index);
+ if (Strings.isValid(metaData.getType()) != true || metaData.getType().equalsIgnoreCase("string")) {
+ data = HtmlStringUtils.addSingleQuotes(data);
+ }
+ builder.append(data);
+ if (index + 1 < values.size()) {
+ builder.append(",");
+ }
+ }
+ builder.append(" ]\n");
+ return builder.toString();
+ }
+
+ public void addDataRow(String... values) {
+ this.rowData.add(Arrays.asList(values));
+ }
+
+ public String getElementName() {
+ return elementName;
+ }
+
+ private String getCustomFunction() {
+ StringBuilder builder = new StringBuilder();
+ // TODO: Create Custom Colors
+ // function change(val){
+ // if(val > 0){
+ // return '<span style="color:green;">' + val + '</span>';
+ // }else if(val < 0){
+ // return '<span style="color:red;">' + val + '</span>';
+ // }
+ // return val;
+ // }
+ return builder.toString();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTableColumnData.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTableColumnData.java
index a7d8324ce6a..042cd209df9 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTableColumnData.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlActiveTableColumnData.java
@@ -8,114 +8,114 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports.html;
-
+package org.eclipse.osee.ote.ui.define.reports.html;
+
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.ote.ui.define.utilities.HtmlStringUtils;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HtmlActiveTableColumnData {
-
- private String name;
- private String type;
- private String dataFormat;
- private boolean sortable;
- private int width;
-
- public HtmlActiveTableColumnData(String name) {
- this(name, "");
- }
-
- public HtmlActiveTableColumnData(String name, String type) {
- super();
- this.name = name;
- this.type = type;
- this.dataFormat = "";
- this.sortable = true;
- this.width = name.length();
- }
-
- public String asMetaData() {
- StringBuilder builder = new StringBuilder();
- builder.append("{");
- builder.append("name: ");
- builder.append(escapeString(getName().toLowerCase()));
- if (Strings.isValid(getType())) {
- builder.append(", type: ");
- builder.append(escapeString(getType()));
- }
- if (Strings.isValid(getDataFormat())) {
- builder.append(", dateFormat: ");
- builder.append(escapeString(getDataFormat()));
- }
- builder.append("}");
- return builder.toString();
- }
-
- public String asColumnCustomization() {
- StringBuilder builder = new StringBuilder();
- builder.append("{");
- builder.append("header: ");
- builder.append("\"");
- builder.append(HtmlStringUtils.escapeString(getName()));
- builder.append("\"");
- // builder.append(", width: ");
- // builder.append(getWidth());
- builder.append(", sortable: ");
- builder.append(isSortable());
-
- //TODO: Add special renderer calls
-
- builder.append(", dataIndex: ");
- builder.append(escapeString(getName().toLowerCase()));
- builder.append("}");
- return builder.toString();
- }
-
- private String escapeString(String value) {
- return HtmlStringUtils.addSingleQuotes(HtmlStringUtils.escapeString(value));
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDataFormat() {
- return dataFormat;
- }
-
- public void setDataFormat(String dataFormat) {
- this.dataFormat = dataFormat;
- }
-
- public boolean isSortable() {
- return sortable;
- }
-
- public void setSortable(boolean sortable) {
- this.sortable = sortable;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class HtmlActiveTableColumnData {
+
+ private String name;
+ private String type;
+ private String dataFormat;
+ private boolean sortable;
+ private int width;
+
+ public HtmlActiveTableColumnData(String name) {
+ this(name, "");
+ }
+
+ public HtmlActiveTableColumnData(String name, String type) {
+ super();
+ this.name = name;
+ this.type = type;
+ this.dataFormat = "";
+ this.sortable = true;
+ this.width = name.length();
+ }
+
+ public String asMetaData() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("{");
+ builder.append("name: ");
+ builder.append(escapeString(getName().toLowerCase()));
+ if (Strings.isValid(getType())) {
+ builder.append(", type: ");
+ builder.append(escapeString(getType()));
+ }
+ if (Strings.isValid(getDataFormat())) {
+ builder.append(", dateFormat: ");
+ builder.append(escapeString(getDataFormat()));
+ }
+ builder.append("}");
+ return builder.toString();
+ }
+
+ public String asColumnCustomization() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("{");
+ builder.append("header: ");
+ builder.append("\"");
+ builder.append(HtmlStringUtils.escapeString(getName()));
+ builder.append("\"");
+ // builder.append(", width: ");
+ // builder.append(getWidth());
+ builder.append(", sortable: ");
+ builder.append(isSortable());
+
+ //TODO: Add special renderer calls
+
+ builder.append(", dataIndex: ");
+ builder.append(escapeString(getName().toLowerCase()));
+ builder.append("}");
+ return builder.toString();
+ }
+
+ private String escapeString(String value) {
+ return HtmlStringUtils.addSingleQuotes(HtmlStringUtils.escapeString(value));
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDataFormat() {
+ return dataFormat;
+ }
+
+ public void setDataFormat(String dataFormat) {
+ this.dataFormat = dataFormat;
+ }
+
+ public boolean isSortable() {
+ return sortable;
+ }
+
+ public void setSortable(boolean sortable) {
+ this.sortable = sortable;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlTableReport.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlTableReport.java
index f7f38149c27..e00e98ea7d7 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlTableReport.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/html/HtmlTableReport.java
@@ -8,69 +8,69 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports.html;
-
+package org.eclipse.osee.ote.ui.define.reports.html;
+
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HtmlTableReport {
- private static String HTML_HEADER =
- "<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><head>";
- private static String HTML_FOOTER = "</body></html>";
-
- private String reportTitle;
- private HtmlActiveTable activeTable;
-
- public HtmlTableReport() {
- this.activeTable = new HtmlActiveTable();
- this.reportTitle = "Report";
- }
-
- public void setReportTitle(String title) {
- this.reportTitle = title;
- }
-
- public HtmlActiveTable getActiveTable() {
- return activeTable;
- }
-
- public String generate() throws IOException {
- StringBuilder builder = new StringBuilder();
- builder.append(HTML_HEADER);
- builder.append("<title>");
- builder.append(reportTitle);
- builder.append("</title>");
- builder.append(activeTable.generate());
- builder.append("</head>");
- builder.append(getReportSummary());
- builder.append("<br/>");
- builder.append("<div id=\"");
- builder.append(activeTable.getElementName());
- builder.append("\" style=\"width:100%;\">");
- builder.append("</div>");
- builder.append(HTML_FOOTER);
- return builder.toString();
- }
-
- private String getReportSummary() {
- StringBuilder builder = new StringBuilder();
- builder.append("<div id=\"title\" class=\"x-grid3-hd-text\" style=\"color:#15428b;background:#ebf3fd;border:1px solid #aaccf6;\">");
- builder.append("<table class=\" x-grid3-summary-row x-grid3-hd-text\" style=\"width:95%;color:#15428b;\">");
- builder.append("<tr>");
- builder.append("<td style=\"text-align:left; font-size:14px;\"><b>");
- builder.append(reportTitle);
- builder.append("</b></td>");
- builder.append("<td style=\"text-align:right; font-size:14px;\"><b>");
- builder.append(SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date()));
- builder.append("</b></td>");
- builder.append("</tr>");
- builder.append("</table>");
- builder.append("</div>");
- return builder.toString();
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class HtmlTableReport {
+ private static String HTML_HEADER =
+ "<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><head>";
+ private static String HTML_FOOTER = "</body></html>";
+
+ private String reportTitle;
+ private HtmlActiveTable activeTable;
+
+ public HtmlTableReport() {
+ this.activeTable = new HtmlActiveTable();
+ this.reportTitle = "Report";
+ }
+
+ public void setReportTitle(String title) {
+ this.reportTitle = title;
+ }
+
+ public HtmlActiveTable getActiveTable() {
+ return activeTable;
+ }
+
+ public String generate() throws IOException {
+ StringBuilder builder = new StringBuilder();
+ builder.append(HTML_HEADER);
+ builder.append("<title>");
+ builder.append(reportTitle);
+ builder.append("</title>");
+ builder.append(activeTable.generate());
+ builder.append("</head>");
+ builder.append(getReportSummary());
+ builder.append("<br/>");
+ builder.append("<div id=\"");
+ builder.append(activeTable.getElementName());
+ builder.append("\" style=\"width:100%;\">");
+ builder.append("</div>");
+ builder.append(HTML_FOOTER);
+ return builder.toString();
+ }
+
+ private String getReportSummary() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("<div id=\"title\" class=\"x-grid3-hd-text\" style=\"color:#15428b;background:#ebf3fd;border:1px solid #aaccf6;\">");
+ builder.append("<table class=\" x-grid3-summary-row x-grid3-hd-text\" style=\"width:95%;color:#15428b;\">");
+ builder.append("<tr>");
+ builder.append("<td style=\"text-align:left; font-size:14px;\"><b>");
+ builder.append(reportTitle);
+ builder.append("</b></td>");
+ builder.append("<td style=\"text-align:right; font-size:14px;\"><b>");
+ builder.append(SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date()));
+ builder.append("</b></td>");
+ builder.append("</tr>");
+ builder.append("</table>");
+ builder.append("</div>");
+ return builder.toString();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/ExcelReportWriter.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/ExcelReportWriter.java
index eb6ec3089aa..c95182e5f80 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/ExcelReportWriter.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/ExcelReportWriter.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports.output;
-
+package org.eclipse.osee.ote.ui.define.reports.output;
+
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringWriter;
@@ -19,71 +19,71 @@ import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelXmlWriter;
import org.eclipse.osee.framework.jdk.core.util.io.xml.ISheetWriter;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ExcelReportWriter implements IReportWriter {
- private ISheetWriter sheetWriter;
- private StringWriter stringWriter;
- private String result;
- private String title;
-
- public ExcelReportWriter() {
- this.title = Long.toString(new Date().getTime());
- this.stringWriter = new StringWriter();
- try {
- this.sheetWriter = new ExcelXmlWriter(stringWriter);
- } catch (IOException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
-
- public String getReport() throws IOException {
- if (result == null) {
- generate();
- }
- return result;
- }
-
- public int length() throws IOException {
- if (result == null) {
- generate();
- }
- return result.length();
- }
-
- public void writeHeader(String[] headers) {
- try {
- this.sheetWriter.startSheet(title, headers.length);
- this.sheetWriter.writeRow(headers);
- } catch (IOException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
-
- public void writeRow(String... cellData) {
- try {
- this.sheetWriter.writeRow(cellData);
- } catch (IOException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
-
- public void writeTitle(String title) {
- this.title = title;
- }
-
- public void writeToOutput(OutputStream outputStream) throws IOException {
- if (result == null) {
- generate();
- }
- outputStream.write(result.getBytes("UTF-8"));
- }
-
- private void generate() throws IOException {
- this.sheetWriter.endSheet();
- this.sheetWriter.endWorkbook();
- this.result = stringWriter.toString();
- }
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ExcelReportWriter implements IReportWriter {
+ private ISheetWriter sheetWriter;
+ private StringWriter stringWriter;
+ private String result;
+ private String title;
+
+ public ExcelReportWriter() {
+ this.title = Long.toString(new Date().getTime());
+ this.stringWriter = new StringWriter();
+ try {
+ this.sheetWriter = new ExcelXmlWriter(stringWriter);
+ } catch (IOException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public String getReport() throws IOException {
+ if (result == null) {
+ generate();
+ }
+ return result;
+ }
+
+ public int length() throws IOException {
+ if (result == null) {
+ generate();
+ }
+ return result.length();
+ }
+
+ public void writeHeader(String[] headers) {
+ try {
+ this.sheetWriter.startSheet(title, headers.length);
+ this.sheetWriter.writeRow(headers);
+ } catch (IOException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public void writeRow(String... cellData) {
+ try {
+ this.sheetWriter.writeRow(cellData);
+ } catch (IOException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public void writeTitle(String title) {
+ this.title = title;
+ }
+
+ public void writeToOutput(OutputStream outputStream) throws IOException {
+ if (result == null) {
+ generate();
+ }
+ outputStream.write(result.getBytes("UTF-8"));
+ }
+
+ private void generate() throws IOException {
+ this.sheetWriter.endSheet();
+ this.sheetWriter.endWorkbook();
+ this.result = stringWriter.toString();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/HtmlReportWriter.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/HtmlReportWriter.java
index 6ed6c9f8c31..10cf0dbdcc0 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/HtmlReportWriter.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/HtmlReportWriter.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports.output;
-
+package org.eclipse.osee.ote.ui.define.reports.output;
+
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
@@ -17,57 +17,57 @@ import java.util.Date;
import org.eclipse.osee.ote.ui.define.reports.html.HtmlActiveTable;
import org.eclipse.osee.ote.ui.define.reports.html.HtmlActiveTableColumnData;
import org.eclipse.osee.ote.ui.define.reports.html.HtmlTableReport;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HtmlReportWriter implements IReportWriter {
-
- private HtmlTableReport report;
- private String reportHtml;
-
- public HtmlReportWriter() {
- this.report = new HtmlTableReport();
- report.getActiveTable().setTableTitle("Results");
- }
-
- public void writeTitle(String title) {
- report.getActiveTable().setElementName("tbl" + new Date().getTime());
- report.setReportTitle(title);
- }
-
- public void writeHeader(String[] headers) {
- HtmlActiveTable table = report.getActiveTable();
- String[] metadata = new String[headers.length];
- Arrays.fill(metadata, "");
- for (int index = 0; index < headers.length; index++) {
- table.addColumn(new HtmlActiveTableColumnData(headers[index], metadata[index]));
- }
- }
-
- public void writeRow(String... cellData) {
- report.getActiveTable().addDataRow(cellData);
- }
-
- public int length() throws IOException {
- if (reportHtml == null) {
- generate();
- }
- return reportHtml.length();
- }
-
- public String getReport() throws IOException {
- if (reportHtml == null) {
- generate();
- }
- return reportHtml;
- }
-
- public void writeToOutput(OutputStream outputStream) throws IOException {
- outputStream.write(getReport().getBytes("UTF-8"));
- }
-
- private void generate() throws IOException {
- reportHtml = report.generate();
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class HtmlReportWriter implements IReportWriter {
+
+ private HtmlTableReport report;
+ private String reportHtml;
+
+ public HtmlReportWriter() {
+ this.report = new HtmlTableReport();
+ report.getActiveTable().setTableTitle("Results");
+ }
+
+ public void writeTitle(String title) {
+ report.getActiveTable().setElementName("tbl" + new Date().getTime());
+ report.setReportTitle(title);
+ }
+
+ public void writeHeader(String[] headers) {
+ HtmlActiveTable table = report.getActiveTable();
+ String[] metadata = new String[headers.length];
+ Arrays.fill(metadata, "");
+ for (int index = 0; index < headers.length; index++) {
+ table.addColumn(new HtmlActiveTableColumnData(headers[index], metadata[index]));
+ }
+ }
+
+ public void writeRow(String... cellData) {
+ report.getActiveTable().addDataRow(cellData);
+ }
+
+ public int length() throws IOException {
+ if (reportHtml == null) {
+ generate();
+ }
+ return reportHtml.length();
+ }
+
+ public String getReport() throws IOException {
+ if (reportHtml == null) {
+ generate();
+ }
+ return reportHtml;
+ }
+
+ public void writeToOutput(OutputStream outputStream) throws IOException {
+ outputStream.write(getReport().getBytes("UTF-8"));
+ }
+
+ private void generate() throws IOException {
+ reportHtml = report.generate();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/OutputFormat.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/OutputFormat.java
index 91672ea864c..7f66e7a291d 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/OutputFormat.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/reports/output/OutputFormat.java
@@ -8,26 +8,26 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.reports.output;
-
+package org.eclipse.osee.ote.ui.define.reports.output;
+
import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum OutputFormat {
-
- HTML, PDF, RTF, EXCEL;
-
- public static OutputFormat fromString(String value) {
- OutputFormat toReturn = OutputFormat.HTML;
- if (Strings.isValid(value)) {
- try {
- toReturn = OutputFormat.valueOf(value.toUpperCase());
- } catch (Exception ex) {
- toReturn = OutputFormat.HTML;
- }
- }
- return toReturn;
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public enum OutputFormat {
+
+ HTML, PDF, RTF, EXCEL;
+
+ public static OutputFormat fromString(String value) {
+ OutputFormat toReturn = OutputFormat.HTML;
+ if (Strings.isValid(value)) {
+ try {
+ toReturn = OutputFormat.valueOf(value.toUpperCase());
+ } catch (Exception ex) {
+ toReturn = OutputFormat.HTML;
+ }
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/CommitConfiguration.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/CommitConfiguration.java
index 048eb03136a..9e4d5b23ae3 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/CommitConfiguration.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/CommitConfiguration.java
@@ -8,41 +8,41 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.utilities;
-
+package org.eclipse.osee.ote.ui.define.utilities;
+
import java.util.Collection;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.skynet.core.User;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CommitConfiguration {
- private static final CommitConfiguration instance = new CommitConfiguration();
-
- private CommitConfiguration() {
- }
-
- private boolean isUserAllowedToOverride() {
- boolean isAllowed = false;
-
- try {
- User user = UserManager.getUser();
- Collection<Artifact> teams = user.getRelatedArtifacts(CoreRelationTypes.TeamMember_Team);
- for (Artifact team : teams) {
- if (team.getName().equals("OSEE")) {
- isAllowed = true;
- }
- }
- } catch (Exception ex) {
- // Do Nothing!
- }
- return isAllowed;
- }
-
- public static boolean isCommitOverrideAllowed() {
- return instance.isUserAllowedToOverride();
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CommitConfiguration {
+ private static final CommitConfiguration instance = new CommitConfiguration();
+
+ private CommitConfiguration() {
+ }
+
+ private boolean isUserAllowedToOverride() {
+ boolean isAllowed = false;
+
+ try {
+ User user = UserManager.getUser();
+ Collection<Artifact> teams = user.getRelatedArtifacts(CoreRelationTypes.TeamMember_Team);
+ for (Artifact team : teams) {
+ if (team.getName().equals("OSEE")) {
+ isAllowed = true;
+ }
+ }
+ } catch (Exception ex) {
+ // Do Nothing!
+ }
+ return isAllowed;
+ }
+
+ public static boolean isCommitOverrideAllowed() {
+ return instance.isUserAllowedToOverride();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/EditorUtility.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/EditorUtility.java
index 4a02e9e09fe..6d99e874475 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/EditorUtility.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/EditorUtility.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.utilities;
-
+package org.eclipse.osee.ote.ui.define.utilities;
+
import java.io.File;
import java.net.URL;
import org.eclipse.core.resources.IFile;
@@ -25,57 +25,57 @@ import org.eclipse.swt.program.Program;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
-
-/**
- * @author Roberto E. Escobar
- */
-public class EditorUtility {
-
- private EditorUtility() {
- }
-
- public static void openEditor(String reportId, String format) {
- try {
- OutputFormat outputFormat = OutputFormat.fromString(format);
- String url = HttpReportRequest.getUrl(reportId, outputFormat.name(), "local");
- String tempFileName = OutputFactory.getOutputFilename(outputFormat, reportId);
- switch (outputFormat) {
- case HTML:
- openAsHtml(reportId, url);
- break;
- case EXCEL:
- case PDF:
- default:
- openAsNative(tempFileName, url);
- break;
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- private static void openAsHtml(String fileName, String url) throws Exception {
- IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
- IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR, fileName, fileName, "");
- browser.openURL(new URL(url));
- }
-
- private static void openAsNative(String fileName, final String url) throws Exception {
- Job job = new RemoteResourceRequestJob(url, fileName);
- job.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(IJobChangeEvent event) {
- org.eclipse.core.runtime.IStatus status = event.getResult();
- if (status.equals(Status.OK_STATUS) || status.getCode() == Status.OK) {
- IFile file = ((RemoteResourceRequestJob) event.getJob()).getDownloadedFile();
- if (file != null && file.exists()) {
- Program.launch(new File(file.getLocationURI()).getAbsolutePath());
- }
- }
- }
- });
- job.schedule();
- }
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class EditorUtility {
+
+ private EditorUtility() {
+ }
+
+ public static void openEditor(String reportId, String format) {
+ try {
+ OutputFormat outputFormat = OutputFormat.fromString(format);
+ String url = HttpReportRequest.getUrl(reportId, outputFormat.name(), "local");
+ String tempFileName = OutputFactory.getOutputFilename(outputFormat, reportId);
+ switch (outputFormat) {
+ case HTML:
+ openAsHtml(reportId, url);
+ break;
+ case EXCEL:
+ case PDF:
+ default:
+ openAsNative(tempFileName, url);
+ break;
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ private static void openAsHtml(String fileName, String url) throws Exception {
+ IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
+ IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR, fileName, fileName, "");
+ browser.openURL(new URL(url));
+ }
+
+ private static void openAsNative(String fileName, final String url) throws Exception {
+ Job job = new RemoteResourceRequestJob(url, fileName);
+ job.addJobChangeListener(new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ org.eclipse.core.runtime.IStatus status = event.getResult();
+ if (status.equals(Status.OK_STATUS) || status.getCode() == Status.OK) {
+ IFile file = ((RemoteResourceRequestJob) event.getJob()).getDownloadedFile();
+ if (file != null && file.exists()) {
+ Program.launch(new File(file.getLocationURI()).getAbsolutePath());
+ }
+ }
+ }
+ });
+ job.schedule();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/HtmlStringUtils.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/HtmlStringUtils.java
index d2dd0e8a3b3..e4f2ae560f9 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/HtmlStringUtils.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/HtmlStringUtils.java
@@ -8,21 +8,21 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.utilities;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HtmlStringUtils {
- private HtmlStringUtils() {
-
- }
-
- public static String addSingleQuotes(String value) {
- return "'" + value + "'";
- }
-
- public static String escapeString(String value) {
- return value.replaceAll("'", "\\'");
- }
-}
+package org.eclipse.osee.ote.ui.define.utilities;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class HtmlStringUtils {
+ private HtmlStringUtils() {
+
+ }
+
+ public static String addSingleQuotes(String value) {
+ return "'" + value + "'";
+ }
+
+ public static String escapeString(String value) {
+ return value.replaceAll("'", "\\'");
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/SelectionHelper.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/SelectionHelper.java
index 7394a1319b9..b0174431608 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/SelectionHelper.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/utilities/SelectionHelper.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.utilities;
-
+package org.eclipse.osee.ote.ui.define.utilities;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -17,63 +17,63 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
import org.eclipse.osee.ote.ui.define.viewers.data.ArtifactItem;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SelectionHelper {
-
- private static SelectionHelper instance = null;
-
- private SelectionHelper() {
- }
-
- public static SelectionHelper getInstance() {
- if (instance == null) {
- instance = new SelectionHelper();
- }
- return instance;
- }
-
- public TestRunOperator getSelection(StructuredViewer viewer) {
- TestRunOperator toReturn = null;
- if (viewer != null) {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection != null && selection.size() == 1) {
- Object object = selection.getFirstElement();
- TestRunOperator operator = asTestRunOperator(object);
- if (operator != null && operator.hasValidArtifact() != false) {
- toReturn = operator;
- }
- }
- }
- return toReturn;
- }
-
- public TestRunOperator asTestRunOperator(Object object) {
- TestRunOperator operator = null;
- if (object instanceof ArtifactItem) {
- ArtifactItem artItem = (ArtifactItem) object;
- operator = artItem.getOperator();
- }
- return operator;
- }
-
- public List<TestRunOperator> getSelections(StructuredViewer viewer) {
- List<TestRunOperator> toReturn = new ArrayList<TestRunOperator>();
- if (viewer != null) {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection != null && selection.isEmpty() != true) {
- Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- TestRunOperator operator = asTestRunOperator(object);
- if (operator != null && operator.hasValidArtifact() != false) {
- toReturn.add(operator);
- }
- }
- }
- }
- return toReturn;
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SelectionHelper {
+
+ private static SelectionHelper instance = null;
+
+ private SelectionHelper() {
+ }
+
+ public static SelectionHelper getInstance() {
+ if (instance == null) {
+ instance = new SelectionHelper();
+ }
+ return instance;
+ }
+
+ public TestRunOperator getSelection(StructuredViewer viewer) {
+ TestRunOperator toReturn = null;
+ if (viewer != null) {
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ if (selection != null && selection.size() == 1) {
+ Object object = selection.getFirstElement();
+ TestRunOperator operator = asTestRunOperator(object);
+ if (operator != null && operator.hasValidArtifact() != false) {
+ toReturn = operator;
+ }
+ }
+ }
+ return toReturn;
+ }
+
+ public TestRunOperator asTestRunOperator(Object object) {
+ TestRunOperator operator = null;
+ if (object instanceof ArtifactItem) {
+ ArtifactItem artItem = (ArtifactItem) object;
+ operator = artItem.getOperator();
+ }
+ return operator;
+ }
+
+ public List<TestRunOperator> getSelections(StructuredViewer viewer) {
+ List<TestRunOperator> toReturn = new ArrayList<TestRunOperator>();
+ if (viewer != null) {
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ if (selection != null && selection.isEmpty() != true) {
+ Iterator<?> iterator = selection.iterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ TestRunOperator operator = asTestRunOperator(object);
+ if (operator != null && operator.hasValidArtifact() != false) {
+ toReturn.add(operator);
+ }
+ }
+ }
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/DragDropHandler.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/DragDropHandler.java
index 31ddf1499d6..34902d331bb 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/DragDropHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/DragDropHandler.java
@@ -1,213 +1,213 @@
-/*******************************************************************************
- * 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.ote.ui.define.viewers;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
-import org.eclipse.osee.ote.define.jobs.OutfileToArtifactJob;
-import org.eclipse.osee.ote.define.utilities.OutfileParserExtensionManager;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.osee.ote.ui.define.dialogs.BranchComboDialog;
-import org.eclipse.osee.ote.ui.define.jobs.AddArtifactsToViewerJob;
-import org.eclipse.osee.ote.ui.define.jobs.ReportErrorsJob;
-import org.eclipse.osee.ote.ui.define.views.TestRunView;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.Transfer;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DragDropHandler {
-
- private final XViewerDataManager viewerDataManager;
-
- public DragDropHandler(XViewerDataManager viewerDataManager) {
- this.viewerDataManager = viewerDataManager;
- setupDropSupport();
- setupDragSupport();
- }
-
- private void setupDropSupport() {
- DropTarget dropTarget = new DropTarget(viewerDataManager.getControl(), DND.DROP_COPY);
- dropTarget.setTransfer(new Transfer[] {LocalSelectionTransfer.getTransfer(), ArtifactTransfer.getInstance(),});
- dropTarget.addDropListener(new DropTargetAdapter() {
-
- @Override
- public void drop(DropTargetEvent event) {
- try {
- performDrop(event);
- } catch (OseeCoreException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public void dragOver(DropTargetEvent event) {
- event.detail = DND.DROP_COPY;
- }
- });
- }
-
- private void setupDragSupport() {
- DragSource dragSource = new DragSource(viewerDataManager.getControl(), DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] {ArtifactTransfer.getInstance()});
- dragSource.addDragListener(new DragSourceListener() {
-
- public void dragFinished(DragSourceEvent event) {
- }
-
- public void dragSetData(DragSourceEvent event) {
- List<Artifact> artifacts = viewerDataManager.getSelectedArtifacts();
- if (artifacts.size() > 0) {
- event.data =
- new ArtifactData(artifacts.toArray(new Artifact[artifacts.size()]), "", TestRunView.VIEW_ID);
- }
- }
-
- public void dragStart(DragSourceEvent event) {
- event.doit = false;
- List<Artifact> artifacts = viewerDataManager.getSelectedArtifacts();
- if (artifacts.size() > 0) {
- event.doit = true;
- }
- }
- });
-
- }
-
- private void performDrop(DropTargetEvent e) throws OseeCoreException {
- Object object = e.data;
- if (object instanceof ArtifactData) {
- handleArtifactDrops((ArtifactData) object);
- } else if (object instanceof TreeSelection) {
- StructuredSelection selection = (StructuredSelection) object;
- if (selection.size() > 0) {
- URI[] iFiles = toResourceArray(selection.toArray());
- if (iFiles.length > 0) {
- try {
- handleResourceDrops(iFiles);
- } catch (OseeCoreException ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- } else {
- OseeLog.log(OteUiDefinePlugin.class, Level.WARNING, "No valid files dropped");
- }
- }
- }
- }
-
- private URI[] toResourceArray(Object[] objects) {
- List<URI> toReturn = new ArrayList<URI>();
- for (Object object : objects) {
- if (object instanceof IAdaptable) {
- Object resource = ((IAdaptable) object).getAdapter(IResource.class);
- if (resource != null) {
- IResource iResource = (IResource) resource;
- if (isResourceAllowed(iResource)) {
- toReturn.add(iResource.getLocationURI());
- }
- }
- }
- }
- return toReturn.toArray(new URI[toReturn.size()]);
- }
-
- private boolean isResourceAllowed(IResource resource) {
- if (resource.getType() == IResource.FILE && resource.isAccessible()) {
- String toCheck = resource.getFileExtension();
- try {
- for (String extension : OutfileParserExtensionManager.getInstance().getSupportedExtensions()) {
- if (toCheck.equalsIgnoreCase(extension)) {
- return true;
- }
- }
- } catch (OseeCoreException ex) {
- // Do Nothing
- }
- }
- return false;
-
- }
-
- private void handleArtifactDrops(ArtifactData artifactData) throws OseeCoreException {
- Artifact[] artifactsDropped = artifactData.getArtifacts();
- Set<Artifact> artifactsToAdd = new HashSet<Artifact>();
- for (Artifact artifact : artifactsDropped) {
- if (artifact.isOfType(CoreArtifactTypes.TestRun)) {
- artifactsToAdd.add(artifact);
- }
- }
- addArtifactsToTable(new ArrayList<Artifact>(artifactsToAdd));
- }
-
- private void handleResourceDrops(URI[] iFiles) throws OseeCoreException {
- Branch branch = BranchComboDialog.getBranchFromUser();
- if (branch != null) {
- OutfileToArtifactJob artifactJob = new OutfileToArtifactJob(branch, iFiles);
- artifactJob.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(IJobChangeEvent event) {
- IStatus status = event.getResult();
- if (status.equals(Status.OK_STATUS)) {
- OutfileToArtifactJob job = (OutfileToArtifactJob) event.getJob();
- Artifact[] results = job.getResults();
- URI[] unparseable = job.getUnparseableFiles();
- reportUnparseableItems(unparseable);
- addArtifactsToTable(Arrays.asList(results));
- }
- }
- });
- artifactJob.schedule();
- }
- }
-
- private void addArtifactsToTable(final List<Artifact> artifacts) {
- Job job = new AddArtifactsToViewerJob(viewerDataManager, artifacts);
- job.schedule();
- }
-
- private void reportUnparseableItems(final URI[] unparseable) {
- if (unparseable.length > 0) {
- String title = "Artifact Drop Error";
- String message = "The following file(s) had errors during the parsing operation: ";
- ReportErrorsJob.openError(title, message, (Object[]) unparseable);
- }
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.viewers;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
+import org.eclipse.osee.ote.define.jobs.OutfileToArtifactJob;
+import org.eclipse.osee.ote.define.utilities.OutfileParserExtensionManager;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.osee.ote.ui.define.dialogs.BranchComboDialog;
+import org.eclipse.osee.ote.ui.define.jobs.AddArtifactsToViewerJob;
+import org.eclipse.osee.ote.ui.define.jobs.ReportErrorsJob;
+import org.eclipse.osee.ote.ui.define.views.TestRunView;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSource;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.Transfer;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DragDropHandler {
+
+ private final XViewerDataManager viewerDataManager;
+
+ public DragDropHandler(XViewerDataManager viewerDataManager) {
+ this.viewerDataManager = viewerDataManager;
+ setupDropSupport();
+ setupDragSupport();
+ }
+
+ private void setupDropSupport() {
+ DropTarget dropTarget = new DropTarget(viewerDataManager.getControl(), DND.DROP_COPY);
+ dropTarget.setTransfer(new Transfer[] {LocalSelectionTransfer.getTransfer(), ArtifactTransfer.getInstance(),});
+ dropTarget.addDropListener(new DropTargetAdapter() {
+
+ @Override
+ public void drop(DropTargetEvent event) {
+ try {
+ performDrop(event);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public void dragOver(DropTargetEvent event) {
+ event.detail = DND.DROP_COPY;
+ }
+ });
+ }
+
+ private void setupDragSupport() {
+ DragSource dragSource = new DragSource(viewerDataManager.getControl(), DND.DROP_COPY);
+ dragSource.setTransfer(new Transfer[] {ArtifactTransfer.getInstance()});
+ dragSource.addDragListener(new DragSourceListener() {
+
+ public void dragFinished(DragSourceEvent event) {
+ }
+
+ public void dragSetData(DragSourceEvent event) {
+ List<Artifact> artifacts = viewerDataManager.getSelectedArtifacts();
+ if (artifacts.size() > 0) {
+ event.data =
+ new ArtifactData(artifacts.toArray(new Artifact[artifacts.size()]), "", TestRunView.VIEW_ID);
+ }
+ }
+
+ public void dragStart(DragSourceEvent event) {
+ event.doit = false;
+ List<Artifact> artifacts = viewerDataManager.getSelectedArtifacts();
+ if (artifacts.size() > 0) {
+ event.doit = true;
+ }
+ }
+ });
+
+ }
+
+ private void performDrop(DropTargetEvent e) throws OseeCoreException {
+ Object object = e.data;
+ if (object instanceof ArtifactData) {
+ handleArtifactDrops((ArtifactData) object);
+ } else if (object instanceof TreeSelection) {
+ StructuredSelection selection = (StructuredSelection) object;
+ if (selection.size() > 0) {
+ URI[] iFiles = toResourceArray(selection.toArray());
+ if (iFiles.length > 0) {
+ try {
+ handleResourceDrops(iFiles);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ } else {
+ OseeLog.log(OteUiDefinePlugin.class, Level.WARNING, "No valid files dropped");
+ }
+ }
+ }
+ }
+
+ private URI[] toResourceArray(Object[] objects) {
+ List<URI> toReturn = new ArrayList<URI>();
+ for (Object object : objects) {
+ if (object instanceof IAdaptable) {
+ Object resource = ((IAdaptable) object).getAdapter(IResource.class);
+ if (resource != null) {
+ IResource iResource = (IResource) resource;
+ if (isResourceAllowed(iResource)) {
+ toReturn.add(iResource.getLocationURI());
+ }
+ }
+ }
+ }
+ return toReturn.toArray(new URI[toReturn.size()]);
+ }
+
+ private boolean isResourceAllowed(IResource resource) {
+ if (resource.getType() == IResource.FILE && resource.isAccessible()) {
+ String toCheck = resource.getFileExtension();
+ try {
+ for (String extension : OutfileParserExtensionManager.getInstance().getSupportedExtensions()) {
+ if (toCheck.equalsIgnoreCase(extension)) {
+ return true;
+ }
+ }
+ } catch (OseeCoreException ex) {
+ // Do Nothing
+ }
+ }
+ return false;
+
+ }
+
+ private void handleArtifactDrops(ArtifactData artifactData) throws OseeCoreException {
+ Artifact[] artifactsDropped = artifactData.getArtifacts();
+ Set<Artifact> artifactsToAdd = new HashSet<Artifact>();
+ for (Artifact artifact : artifactsDropped) {
+ if (artifact.isOfType(CoreArtifactTypes.TestRun)) {
+ artifactsToAdd.add(artifact);
+ }
+ }
+ addArtifactsToTable(new ArrayList<Artifact>(artifactsToAdd));
+ }
+
+ private void handleResourceDrops(URI[] iFiles) throws OseeCoreException {
+ Branch branch = BranchComboDialog.getBranchFromUser();
+ if (branch != null) {
+ OutfileToArtifactJob artifactJob = new OutfileToArtifactJob(branch, iFiles);
+ artifactJob.addJobChangeListener(new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ IStatus status = event.getResult();
+ if (status.equals(Status.OK_STATUS)) {
+ OutfileToArtifactJob job = (OutfileToArtifactJob) event.getJob();
+ Artifact[] results = job.getResults();
+ URI[] unparseable = job.getUnparseableFiles();
+ reportUnparseableItems(unparseable);
+ addArtifactsToTable(Arrays.asList(results));
+ }
+ }
+ });
+ artifactJob.schedule();
+ }
+ }
+
+ private void addArtifactsToTable(final List<Artifact> artifacts) {
+ Job job = new AddArtifactsToViewerJob(viewerDataManager, artifacts);
+ job.schedule();
+ }
+
+ private void reportUnparseableItems(final URI[] unparseable) {
+ if (unparseable.length > 0) {
+ String title = "Artifact Drop Error";
+ String message = "The following file(s) had errors during the parsing operation: ";
+ ReportErrorsJob.openError(title, message, (Object[]) unparseable);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/IDataChangedListener.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/IDataChangedListener.java
index 74558641fbe..cad28947b48 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/IDataChangedListener.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/IDataChangedListener.java
@@ -8,12 +8,12 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.viewers;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IDataChangedListener {
-
- public abstract void onDataChanged();
-}
+package org.eclipse.osee.ote.ui.define.viewers;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IDataChangedListener {
+
+ public abstract void onDataChanged();
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewer.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewer.java
index c55f62c1bf9..de31d1148ba 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewer.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewer.java
@@ -1,301 +1,301 @@
-/*******************************************************************************
- * 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.ote.ui.define.viewers;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-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.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactPromptChange;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.osee.ote.ui.define.jobs.CommitTestRunJob;
-import org.eclipse.osee.ote.ui.define.utilities.CommitConfiguration;
-import org.eclipse.osee.ote.ui.define.viewers.actions.AbstractActionHandler;
-import org.eclipse.osee.ote.ui.define.viewers.actions.LaunchReportsAction;
-import org.eclipse.osee.ote.ui.define.viewers.actions.OpenAssociatedOutfile;
-import org.eclipse.osee.ote.ui.define.viewers.actions.OpenAssociatedScript;
-import org.eclipse.osee.ote.ui.define.viewers.actions.OpenInArtifactEditor;
-import org.eclipse.osee.ote.ui.define.viewers.data.ArtifactItem;
-import org.eclipse.osee.ote.ui.define.viewers.data.DataItemContentProvider;
-import org.eclipse.osee.ote.ui.define.viewers.data.DataItemLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Roberto E. Escobar
- */
-public class TestRunXViewer extends XViewer {
-
- private static final ImageDescriptor COMMIT_IMAGE = ImageManager.getImageDescriptor(OteDefineImage.COMMIT);
- private static final ImageDescriptor REMOVE_IMAGE = ImageManager.getImageDescriptor(OteDefineImage.REMOVE);
- private static final ImageDescriptor REMOVE_ALL_IMAGE = ImageManager.getImageDescriptor(OteDefineImage.REMOVE_ALL);
- private XViewerDataManager dataManager;
- private final List<AbstractActionHandler> actionList = new ArrayList<AbstractActionHandler>();
- private Action editDisposition;
-
- public TestRunXViewer(Composite parent) {
- super(parent, //SWT.VIRTUAL |
- SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, new TestRunXViewerFactory());
- setSorter(null);
- setContentProvider(new DataItemContentProvider());
- setLabelProvider(new DataItemLabelProvider(this));
- setUseHashlookup(true);
- setupActions();
- getMenuManager().addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- customActions();
- }
- });
- }
-
- private void customActions() {
- MenuManager manager = getMenuManager();
- manager.insertBefore(XViewer.MENU_GROUP_PRE, editDisposition);
- manager.insertBefore(XViewer.MENU_GROUP_PRE, new Separator());
- manager.add(new Separator());
- for (int index = 0; index < actionList.size(); index++) {
- Action action = actionList.get(index);
- if (index + 1 >= actionList.size() || index + 2 >= actionList.size() || index == 3) {
- manager.add(new Separator());
- }
- manager.add(action);
- }
- }
-
- @Override
- protected void createSupportWidgets(Composite parent) {
- super.createSupportWidgets(parent);
- this.dataManager = new XViewerDataManager(this);
- new DragDropHandler(dataManager);
- }
-
- public void registerListener(IDataChangedListener listener) {
- dataManager.registerListener(listener);
- }
-
- public void deRegisterListener(IDataChangedListener listener) {
- dataManager.deRegisterListener(listener);
- }
-
- private void setupActions() {
- try {
- editDisposition = new Action("Edit Disposition", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- handleChangeDisposition();
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- actionList.add(new OpenInArtifactEditor(this, "Open as Artifact"));
- actionList.add(new OpenAssociatedOutfile(this, "Open Outfile"));
- actionList.add(new OpenAssociatedScript(this, "Open Script"));
- actionList.add(new RemoveAction("Remove", REMOVE_IMAGE));
- actionList.add(new RemoveAllAction("Remove All", REMOVE_ALL_IMAGE));
- actionList.add(new LaunchReportsAction(this, "Reports..."));
- actionList.add(new CommitAction("Commit Test Runs...", COMMIT_IMAGE));
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public void refresh() {
- super.refresh();
- try {
- if (getTree() == null || getTree().isDisposed() || actionList == null) {
- return;
- }
- for (AbstractActionHandler action : actionList) {
- action.updateState();
- }
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- private final class CommitAction extends AbstractActionHandler {
-
- public CommitAction(String text, ImageDescriptor image) throws Exception {
- super(TestRunXViewer.this, text, image);
- }
-
- @Override
- public void run() {
- Artifact[] preSelected = dataManager.getSelectedForCommit();
- Artifact[] unSelectable = dataManager.getUnCommitable();
-
- Job job = new CommitTestRunJob(getAllItemsList(), preSelected, unSelectable, isOverrideAllowed());
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- Artifact[] committed = ((CommitTestRunJob) event.getJob()).getCommitted();
- dataManager.removeFromCommitable(Arrays.asList(committed));
- }
- });
- job.schedule();
- }
-
- @Override
- public void updateState() {
- boolean haveUnCommitableItems = dataManager.getUnCommitable().length > 0;
- boolean haveCommitableItems = dataManager.getAllCommitable().length > 0;
- this.setEnabled(haveCommitableItems || CommitConfiguration.isCommitOverrideAllowed() && haveUnCommitableItems);
- }
-
- private boolean isOverrideAllowed() {
- return CommitConfiguration.isCommitOverrideAllowed();
- }
-
- private Artifact[] getAllItemsList() {
- List<Artifact> allItems = new ArrayList<Artifact>();
- allItems.addAll(Arrays.asList(dataManager.getAllCommitable()));
- if (isOverrideAllowed() != false) {
- allItems.addAll(Arrays.asList(dataManager.getUnCommitable()));
- }
- return allItems.toArray(new Artifact[allItems.size()]);
- }
- }
-
- private final class RemoveAllAction extends AbstractActionHandler {
-
- public RemoveAllAction(String text, ImageDescriptor image) throws Exception {
- super(TestRunXViewer.this, text, image);
- }
-
- @Override
- public void run() {
- dataManager.removeAll();
- }
-
- @Override
- public void updateState() {
- this.setEnabled(dataManager.isEmpty() != true);
- }
- }
-
- private final class RemoveAction extends AbstractActionHandler {
-
- public RemoveAction(String text, ImageDescriptor image) throws Exception {
- super(TestRunXViewer.this, text, image);
- }
-
- @Override
- public void run() {
- dataManager.removeSelected();
- }
-
- @Override
- public void updateState() {
- this.setEnabled(getSelection().isEmpty() != true);
- }
- }
-
- public boolean handleChangeDisposition() throws OseeCoreException {
- if (!getSelectedArtifacts().isEmpty()) {
- return setDisposition(getSelectedArtifacts());
- }
- return false;
- }
-
- @Override
- public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
- XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
- Object holder = treeItem.getData();
- boolean returnValue = false;
- if (holder instanceof ArtifactItem) {
- if (xCol.equals(TestRunXViewerFactory.DISPOSITION)) {
- ArrayList<Artifact> list = new ArrayList<Artifact>();
- list.add(((ArtifactItem) holder).getData());
- try {
- returnValue = setDisposition(list);
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- }
- }
- return returnValue;
- }
-
- private boolean setDisposition(ArrayList<Artifact> selectedArtifacts) throws OseeCoreException {
- boolean returnValue = false;
- ArrayList<Artifact> dispositionArtifacts = new ArrayList<Artifact>();
- for (Artifact artifact : selectedArtifacts) {
- if (artifact.isOfType(CoreArtifactTypes.TestRun)) {
- String name = artifact.getSoleAttributeValueAsString("Name", "");
- if (name != "") {
- Artifact dispoArtifact = null;
- try {
- dispoArtifact =
- ArtifactQuery.getArtifactFromTypeAndAttribute("Test Run Disposition", "Name", name,
- artifact.getBranch());
- } catch (ArtifactDoesNotExist ex) {
- ArtifactType artifactType = ArtifactTypeManager.getType("Test Run Disposition");
- dispoArtifact = ArtifactTypeManager.makeNewArtifact(artifactType, artifact.getBranch());
- dispoArtifact.setName(name);
- }
- if (dispoArtifact != null) {
- dispositionArtifacts.add(dispoArtifact);
- }
- }
- }
- }
- try {
- returnValue =
- ArtifactPromptChange.promptChangeStringAttribute("Disposition", "Edit Disposition",
- dispositionArtifacts, true, false);
- refresh();
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- return returnValue;
- }
-
- public ArrayList<Artifact> getSelectedArtifacts() {
- ArrayList<Artifact> arts = new ArrayList<Artifact>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) {
- for (TreeItem item : items) {
- if (item.getData() instanceof ArtifactItem) {
- arts.add(((ArtifactItem) item.getData()).getData());
- }
- }
- }
- return arts;
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.viewers;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+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.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactPromptChange;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.osee.ote.ui.define.jobs.CommitTestRunJob;
+import org.eclipse.osee.ote.ui.define.utilities.CommitConfiguration;
+import org.eclipse.osee.ote.ui.define.viewers.actions.AbstractActionHandler;
+import org.eclipse.osee.ote.ui.define.viewers.actions.LaunchReportsAction;
+import org.eclipse.osee.ote.ui.define.viewers.actions.OpenAssociatedOutfile;
+import org.eclipse.osee.ote.ui.define.viewers.actions.OpenAssociatedScript;
+import org.eclipse.osee.ote.ui.define.viewers.actions.OpenInArtifactEditor;
+import org.eclipse.osee.ote.ui.define.viewers.data.ArtifactItem;
+import org.eclipse.osee.ote.ui.define.viewers.data.DataItemContentProvider;
+import org.eclipse.osee.ote.ui.define.viewers.data.DataItemLabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TestRunXViewer extends XViewer {
+
+ private static final ImageDescriptor COMMIT_IMAGE = ImageManager.getImageDescriptor(OteDefineImage.COMMIT);
+ private static final ImageDescriptor REMOVE_IMAGE = ImageManager.getImageDescriptor(OteDefineImage.REMOVE);
+ private static final ImageDescriptor REMOVE_ALL_IMAGE = ImageManager.getImageDescriptor(OteDefineImage.REMOVE_ALL);
+ private XViewerDataManager dataManager;
+ private final List<AbstractActionHandler> actionList = new ArrayList<AbstractActionHandler>();
+ private Action editDisposition;
+
+ public TestRunXViewer(Composite parent) {
+ super(parent, //SWT.VIRTUAL |
+ SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, new TestRunXViewerFactory());
+ setSorter(null);
+ setContentProvider(new DataItemContentProvider());
+ setLabelProvider(new DataItemLabelProvider(this));
+ setUseHashlookup(true);
+ setupActions();
+ getMenuManager().addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ customActions();
+ }
+ });
+ }
+
+ private void customActions() {
+ MenuManager manager = getMenuManager();
+ manager.insertBefore(XViewer.MENU_GROUP_PRE, editDisposition);
+ manager.insertBefore(XViewer.MENU_GROUP_PRE, new Separator());
+ manager.add(new Separator());
+ for (int index = 0; index < actionList.size(); index++) {
+ Action action = actionList.get(index);
+ if (index + 1 >= actionList.size() || index + 2 >= actionList.size() || index == 3) {
+ manager.add(new Separator());
+ }
+ manager.add(action);
+ }
+ }
+
+ @Override
+ protected void createSupportWidgets(Composite parent) {
+ super.createSupportWidgets(parent);
+ this.dataManager = new XViewerDataManager(this);
+ new DragDropHandler(dataManager);
+ }
+
+ public void registerListener(IDataChangedListener listener) {
+ dataManager.registerListener(listener);
+ }
+
+ public void deRegisterListener(IDataChangedListener listener) {
+ dataManager.deRegisterListener(listener);
+ }
+
+ private void setupActions() {
+ try {
+ editDisposition = new Action("Edit Disposition", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ handleChangeDisposition();
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ actionList.add(new OpenInArtifactEditor(this, "Open as Artifact"));
+ actionList.add(new OpenAssociatedOutfile(this, "Open Outfile"));
+ actionList.add(new OpenAssociatedScript(this, "Open Script"));
+ actionList.add(new RemoveAction("Remove", REMOVE_IMAGE));
+ actionList.add(new RemoveAllAction("Remove All", REMOVE_ALL_IMAGE));
+ actionList.add(new LaunchReportsAction(this, "Reports..."));
+ actionList.add(new CommitAction("Commit Test Runs...", COMMIT_IMAGE));
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public void refresh() {
+ super.refresh();
+ try {
+ if (getTree() == null || getTree().isDisposed() || actionList == null) {
+ return;
+ }
+ for (AbstractActionHandler action : actionList) {
+ action.updateState();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ private final class CommitAction extends AbstractActionHandler {
+
+ public CommitAction(String text, ImageDescriptor image) throws Exception {
+ super(TestRunXViewer.this, text, image);
+ }
+
+ @Override
+ public void run() {
+ Artifact[] preSelected = dataManager.getSelectedForCommit();
+ Artifact[] unSelectable = dataManager.getUnCommitable();
+
+ Job job = new CommitTestRunJob(getAllItemsList(), preSelected, unSelectable, isOverrideAllowed());
+ job.addJobChangeListener(new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ Artifact[] committed = ((CommitTestRunJob) event.getJob()).getCommitted();
+ dataManager.removeFromCommitable(Arrays.asList(committed));
+ }
+ });
+ job.schedule();
+ }
+
+ @Override
+ public void updateState() {
+ boolean haveUnCommitableItems = dataManager.getUnCommitable().length > 0;
+ boolean haveCommitableItems = dataManager.getAllCommitable().length > 0;
+ this.setEnabled(haveCommitableItems || CommitConfiguration.isCommitOverrideAllowed() && haveUnCommitableItems);
+ }
+
+ private boolean isOverrideAllowed() {
+ return CommitConfiguration.isCommitOverrideAllowed();
+ }
+
+ private Artifact[] getAllItemsList() {
+ List<Artifact> allItems = new ArrayList<Artifact>();
+ allItems.addAll(Arrays.asList(dataManager.getAllCommitable()));
+ if (isOverrideAllowed() != false) {
+ allItems.addAll(Arrays.asList(dataManager.getUnCommitable()));
+ }
+ return allItems.toArray(new Artifact[allItems.size()]);
+ }
+ }
+
+ private final class RemoveAllAction extends AbstractActionHandler {
+
+ public RemoveAllAction(String text, ImageDescriptor image) throws Exception {
+ super(TestRunXViewer.this, text, image);
+ }
+
+ @Override
+ public void run() {
+ dataManager.removeAll();
+ }
+
+ @Override
+ public void updateState() {
+ this.setEnabled(dataManager.isEmpty() != true);
+ }
+ }
+
+ private final class RemoveAction extends AbstractActionHandler {
+
+ public RemoveAction(String text, ImageDescriptor image) throws Exception {
+ super(TestRunXViewer.this, text, image);
+ }
+
+ @Override
+ public void run() {
+ dataManager.removeSelected();
+ }
+
+ @Override
+ public void updateState() {
+ this.setEnabled(getSelection().isEmpty() != true);
+ }
+ }
+
+ public boolean handleChangeDisposition() throws OseeCoreException {
+ if (!getSelectedArtifacts().isEmpty()) {
+ return setDisposition(getSelectedArtifacts());
+ }
+ return false;
+ }
+
+ @Override
+ public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
+ XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
+ Object holder = treeItem.getData();
+ boolean returnValue = false;
+ if (holder instanceof ArtifactItem) {
+ if (xCol.equals(TestRunXViewerFactory.DISPOSITION)) {
+ ArrayList<Artifact> list = new ArrayList<Artifact>();
+ list.add(((ArtifactItem) holder).getData());
+ try {
+ returnValue = setDisposition(list);
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ return returnValue;
+ }
+
+ private boolean setDisposition(ArrayList<Artifact> selectedArtifacts) throws OseeCoreException {
+ boolean returnValue = false;
+ ArrayList<Artifact> dispositionArtifacts = new ArrayList<Artifact>();
+ for (Artifact artifact : selectedArtifacts) {
+ if (artifact.isOfType(CoreArtifactTypes.TestRun)) {
+ String name = artifact.getSoleAttributeValueAsString("Name", "");
+ if (name != "") {
+ Artifact dispoArtifact = null;
+ try {
+ dispoArtifact =
+ ArtifactQuery.getArtifactFromTypeAndAttribute("Test Run Disposition", "Name", name,
+ artifact.getBranch());
+ } catch (ArtifactDoesNotExist ex) {
+ ArtifactType artifactType = ArtifactTypeManager.getType("Test Run Disposition");
+ dispoArtifact = ArtifactTypeManager.makeNewArtifact(artifactType, artifact.getBranch());
+ dispoArtifact.setName(name);
+ }
+ if (dispoArtifact != null) {
+ dispositionArtifacts.add(dispoArtifact);
+ }
+ }
+ }
+ }
+ try {
+ returnValue =
+ ArtifactPromptChange.promptChangeStringAttribute("Disposition", "Edit Disposition",
+ dispositionArtifacts, true, false);
+ refresh();
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ return returnValue;
+ }
+
+ public ArrayList<Artifact> getSelectedArtifacts() {
+ ArrayList<Artifact> arts = new ArrayList<Artifact>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ if (item.getData() instanceof ArtifactItem) {
+ arts.add(((ArtifactItem) item.getData()).getData());
+ }
+ }
+ }
+ return arts;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewerFactory.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewerFactory.java
index 67934eb29e3..ee0f4aec9e0 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewerFactory.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/TestRunXViewerFactory.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * 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.ote.ui.define.viewers;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-import org.eclipse.osee.ote.ui.define.views.TestRunView;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Roberto E. Escobar
- */
-public class TestRunXViewerFactory extends SkynetXViewerFactory {
-
- public static final XViewerColumn DISPOSITION =
- new XViewerColumn("ote.test.run.view.Disposition", "Disposition", 300, SWT.LEFT, true, SortDataType.String,
- true, null);
-
- public TestRunXViewerFactory() {
- super(TestRunView.VIEW_ID);
- registerAllAttributeColumns();
- registerColumns(new XViewerColumn("ote.test.run.view.Name", "Name", 150, SWT.LEFT, true, SortDataType.String,
- false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Passed", "Passed", 50, SWT.LEFT, true, SortDataType.Integer,
- false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Failed", "Failed", 50, SWT.LEFT, true, SortDataType.Integer,
- false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Total Test Points", "Total Test Points", 50, SWT.LEFT,
- false, SortDataType.Integer, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Status", "Status", 150, SWT.LEFT, true, SortDataType.String,
- false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Script Aborted", "Script Aborted", 150, SWT.LEFT, false,
- SortDataType.Boolean, false, null));
-
- registerColumns(new XViewerColumn("ote.test.run.view.Ran In Batch Mode", "Ran In Batch Mode", 150, SWT.LEFT,
- false, SortDataType.Boolean, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Is Batch Mode Allowed", "Is Batch Mode Allowed", 150,
- SWT.LEFT, false, SortDataType.Boolean, false, null));
-
- registerColumns(new XViewerColumn("ote.test.run.view.Start Date", "Start Date", 150, SWT.LEFT, false,
- SortDataType.Date, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.End Date", "End Date", 150, SWT.LEFT, false,
- SortDataType.Date, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Elapsed Date", "Elapsed Date", 150, SWT.LEFT, false,
- SortDataType.String, false, null));
-
- registerColumns(new XViewerColumn("ote.test.run.view.Processor ID", "Processor ID", 150, SWT.LEFT, false,
- SortDataType.String, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Build Id", "Build Id", 150, SWT.LEFT, false,
- SortDataType.String, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Qualification Level", "Qualification Level", 150, SWT.LEFT,
- true, SortDataType.String, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Last Author", "Last Author", 150, SWT.LEFT, false,
- SortDataType.String, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Last Modified Date", "Last Modified Date", 150, SWT.LEFT,
- false, SortDataType.Date, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.Revision", "Revision", 150, SWT.LEFT, false,
- SortDataType.String, false, null));
-
- registerColumns(new XViewerColumn("ote.test.run.view.OS Name", "OS Name", 150, SWT.LEFT, false,
- SortDataType.String, false, null));
- registerColumns(new XViewerColumn("ote.test.run.view.User Id", "User Id", 150, SWT.LEFT, false,
- SortDataType.String, false, null));
- registerColumns(DISPOSITION);
- }
-
- @Override
- public CustomizeData getDefaultTableCustomizeData() {
- CustomizeData custData = new CustomizeData();
- custData.getSortingData().setSortingNames("ote.test.run.view.Name");
- custData.getColumnData().setColumns(getColumns());
- custData.setNameSpace(getNamespace());
- custData.setName("Artifacts");
- return custData;
- }
-
-}
+/*******************************************************************************
+ * 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.ote.ui.define.viewers;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+import org.eclipse.osee.ote.ui.define.views.TestRunView;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TestRunXViewerFactory extends SkynetXViewerFactory {
+
+ public static final XViewerColumn DISPOSITION =
+ new XViewerColumn("ote.test.run.view.Disposition", "Disposition", 300, SWT.LEFT, true, SortDataType.String,
+ true, null);
+
+ public TestRunXViewerFactory() {
+ super(TestRunView.VIEW_ID);
+ registerAllAttributeColumns();
+ registerColumns(new XViewerColumn("ote.test.run.view.Name", "Name", 150, SWT.LEFT, true, SortDataType.String,
+ false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Passed", "Passed", 50, SWT.LEFT, true, SortDataType.Integer,
+ false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Failed", "Failed", 50, SWT.LEFT, true, SortDataType.Integer,
+ false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Total Test Points", "Total Test Points", 50, SWT.LEFT,
+ false, SortDataType.Integer, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Status", "Status", 150, SWT.LEFT, true, SortDataType.String,
+ false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Script Aborted", "Script Aborted", 150, SWT.LEFT, false,
+ SortDataType.Boolean, false, null));
+
+ registerColumns(new XViewerColumn("ote.test.run.view.Ran In Batch Mode", "Ran In Batch Mode", 150, SWT.LEFT,
+ false, SortDataType.Boolean, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Is Batch Mode Allowed", "Is Batch Mode Allowed", 150,
+ SWT.LEFT, false, SortDataType.Boolean, false, null));
+
+ registerColumns(new XViewerColumn("ote.test.run.view.Start Date", "Start Date", 150, SWT.LEFT, false,
+ SortDataType.Date, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.End Date", "End Date", 150, SWT.LEFT, false,
+ SortDataType.Date, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Elapsed Date", "Elapsed Date", 150, SWT.LEFT, false,
+ SortDataType.String, false, null));
+
+ registerColumns(new XViewerColumn("ote.test.run.view.Processor ID", "Processor ID", 150, SWT.LEFT, false,
+ SortDataType.String, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Build Id", "Build Id", 150, SWT.LEFT, false,
+ SortDataType.String, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Qualification Level", "Qualification Level", 150, SWT.LEFT,
+ true, SortDataType.String, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Last Author", "Last Author", 150, SWT.LEFT, false,
+ SortDataType.String, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Last Modified Date", "Last Modified Date", 150, SWT.LEFT,
+ false, SortDataType.Date, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.Revision", "Revision", 150, SWT.LEFT, false,
+ SortDataType.String, false, null));
+
+ registerColumns(new XViewerColumn("ote.test.run.view.OS Name", "OS Name", 150, SWT.LEFT, false,
+ SortDataType.String, false, null));
+ registerColumns(new XViewerColumn("ote.test.run.view.User Id", "User Id", 150, SWT.LEFT, false,
+ SortDataType.String, false, null));
+ registerColumns(DISPOSITION);
+ }
+
+ @Override
+ public CustomizeData getDefaultTableCustomizeData() {
+ CustomizeData custData = new CustomizeData();
+ custData.getSortingData().setSortingNames("ote.test.run.view.Name");
+ custData.getColumnData().setColumns(getColumns());
+ custData.setNameSpace(getNamespace());
+ custData.setName("Artifacts");
+ return custData;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/AbstractActionHandler.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/AbstractActionHandler.java
index cb3eed019cf..9a4968177b7 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/AbstractActionHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/AbstractActionHandler.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.viewers.actions;
-
+package org.eclipse.osee.ote.ui.define.viewers.actions;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -18,39 +18,39 @@ import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractActionHandler extends Action implements ISelectionChangedListener {
-
- private final StructuredViewer viewer;
-
- public AbstractActionHandler(StructuredViewer viewer, String text) throws Exception {
- super(text);
- updateState();
- this.viewer = viewer;
- viewer.addSelectionChangedListener(this);
- }
-
- public AbstractActionHandler(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
- super(text, image);
- updateState();
- this.viewer = viewer;
- viewer.addSelectionChangedListener(this);
- }
-
- protected StructuredViewer getViewer() {
- return viewer;
- }
-
- public abstract void updateState() throws Exception;
-
- public void selectionChanged(SelectionChangedEvent event) {
- try {
- updateState();
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- };
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractActionHandler extends Action implements ISelectionChangedListener {
+
+ private final StructuredViewer viewer;
+
+ public AbstractActionHandler(StructuredViewer viewer, String text) throws Exception {
+ super(text);
+ updateState();
+ this.viewer = viewer;
+ viewer.addSelectionChangedListener(this);
+ }
+
+ public AbstractActionHandler(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
+ super(text, image);
+ updateState();
+ this.viewer = viewer;
+ viewer.addSelectionChangedListener(this);
+ }
+
+ protected StructuredViewer getViewer() {
+ return viewer;
+ }
+
+ public abstract void updateState() throws Exception;
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ try {
+ updateState();
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ };
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/EditDispositionAction.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/EditDispositionAction.java
index 63e8207008d..f0cfd56043e 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/EditDispositionAction.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/EditDispositionAction.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * 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.ote.ui.define.viewers.actions;
-
-import java.util.logging.Level;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+/*******************************************************************************
+ * 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.ote.ui.define.viewers.actions;
+
+import java.util.logging.Level;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.osee.ote.ui.define.utilities.SelectionHelper;
-
-/**
- * @author Theron Virgin
- */
-public class EditDispositionAction extends AbstractActionHandler {
-
- public EditDispositionAction(StructuredViewer viewer, String text) throws Exception {
- super(viewer, text);
- }
-
- public EditDispositionAction(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
- super(viewer, text, image);
- }
-
- @Override
- public void run() {
- try {
- TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
- if (isValidSelection(operator)) {
- Artifact artifact = operator.getTestRunArtifact();
- checkPermissions(artifact);
+import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.osee.ote.ui.define.utilities.SelectionHelper;
+
+/**
+ * @author Theron Virgin
+ */
+public class EditDispositionAction extends AbstractActionHandler {
+
+ public EditDispositionAction(StructuredViewer viewer, String text) throws Exception {
+ super(viewer, text);
+ }
+
+ public EditDispositionAction(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
+ super(viewer, text, image);
+ }
+
+ @Override
+ public void run() {
+ try {
+ TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
+ if (isValidSelection(operator)) {
+ Artifact artifact = operator.getTestRunArtifact();
+ checkPermissions(artifact);
RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
- }
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, "Unable to open artifact.", ex);
- }
- }
-
- @Override
- public void updateState() throws OseeCoreException {
- TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
- setEnabled(isValidSelection(operator));
- }
-
- private boolean isValidSelection(TestRunOperator operator) throws OseeCoreException {
- return operator != null && operator.hasValidArtifact() && operator.isFromLocalWorkspace() != true;
- }
-
- private void checkPermissions(Artifact artifact) throws OseeCoreException {
- if (true != AccessControlManager.hasPermission(artifact, PermissionEnum.READ)) {
- throw new OseeArgumentException(String.format("The user %s does not have read access to %s",
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, "Unable to open artifact.", ex);
+ }
+ }
+
+ @Override
+ public void updateState() throws OseeCoreException {
+ TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
+ setEnabled(isValidSelection(operator));
+ }
+
+ private boolean isValidSelection(TestRunOperator operator) throws OseeCoreException {
+ return operator != null && operator.hasValidArtifact() && operator.isFromLocalWorkspace() != true;
+ }
+
+ private void checkPermissions(Artifact artifact) throws OseeCoreException {
+ if (true != AccessControlManager.hasPermission(artifact, PermissionEnum.READ)) {
+ throw new OseeArgumentException(String.format("The user %s does not have read access to %s",
UserManager.getUser(), artifact));
- }
- }
-}
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedScript.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedScript.java
index 0fbb1184181..644c289525d 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedScript.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedScript.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.viewers.actions;
-
+package org.eclipse.osee.ote.ui.define.viewers.actions;
+
import java.net.URL;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -23,60 +23,60 @@ import org.eclipse.osee.ote.ui.define.utilities.SelectionHelper;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OpenAssociatedScript extends AbstractActionHandler {
- private static final SelectionHelper selectionHelper = SelectionHelper.getInstance();
-
- public OpenAssociatedScript(StructuredViewer viewer, String text) throws Exception {
- super(viewer, text);
- }
-
- public OpenAssociatedScript(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
- super(viewer, text, image);
- }
-
- @Override
- public void updateState() {
- TestRunOperator operator = selectionHelper.getSelection(getViewer());
- setEnabled(operator != null);
- }
-
- @Override
- public void run() {
- try {
- TestRunOperator operator = selectionHelper.getSelection(getViewer());
- if (operator.isScriptRevisionValid()) {
- openRemoteScript(operator.getScriptUrl(), operator.getScriptRevision());
- } else {
- handleException();
- }
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- private void handleException() {
- MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Open Script",
- "Unable to open script with invalid url.");
- }
-
- private void openRemoteScript(String scriptUrl, String revision) {
- try {
- VersionControl.getInstance().getLocalFileMatchingRepositoryUrl(scriptUrl, revision);
-
- URL urlToOpen = new URL(scriptUrl);
- if (urlToOpen != null) {
- IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
- IWebBrowser browser =
- browserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR, "org.eclipse.ui.browser.editor",
- scriptUrl, "");
- browser.openURL(urlToOpen);
- }
- } catch (Exception ex) {
- handleException();
- }
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OpenAssociatedScript extends AbstractActionHandler {
+ private static final SelectionHelper selectionHelper = SelectionHelper.getInstance();
+
+ public OpenAssociatedScript(StructuredViewer viewer, String text) throws Exception {
+ super(viewer, text);
+ }
+
+ public OpenAssociatedScript(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
+ super(viewer, text, image);
+ }
+
+ @Override
+ public void updateState() {
+ TestRunOperator operator = selectionHelper.getSelection(getViewer());
+ setEnabled(operator != null);
+ }
+
+ @Override
+ public void run() {
+ try {
+ TestRunOperator operator = selectionHelper.getSelection(getViewer());
+ if (operator.isScriptRevisionValid()) {
+ openRemoteScript(operator.getScriptUrl(), operator.getScriptRevision());
+ } else {
+ handleException();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ private void handleException() {
+ MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Open Script",
+ "Unable to open script with invalid url.");
+ }
+
+ private void openRemoteScript(String scriptUrl, String revision) {
+ try {
+ VersionControl.getInstance().getLocalFileMatchingRepositoryUrl(scriptUrl, revision);
+
+ URL urlToOpen = new URL(scriptUrl);
+ if (urlToOpen != null) {
+ IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
+ IWebBrowser browser =
+ browserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR, "org.eclipse.ui.browser.editor",
+ scriptUrl, "");
+ browser.openURL(urlToOpen);
+ }
+ } catch (Exception ex) {
+ handleException();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenInArtifactEditor.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenInArtifactEditor.java
index 70c9e5632e8..956da2a3f03 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenInArtifactEditor.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenInArtifactEditor.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * 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.ote.ui.define.viewers.actions;
-
-import java.util.logging.Level;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+/*******************************************************************************
+ * 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.ote.ui.define.viewers.actions;
+
+import java.util.logging.Level;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.osee.ote.ui.define.utilities.SelectionHelper;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OpenInArtifactEditor extends AbstractActionHandler {
-
- public OpenInArtifactEditor(StructuredViewer viewer, String text) throws Exception {
- super(viewer, text);
- }
-
- public OpenInArtifactEditor(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
- super(viewer, text, image);
- }
-
- @Override
- public void run() {
- try {
- TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
- if (isValidSelection(operator)) {
- Artifact artifact = operator.getTestRunArtifact();
- checkPermissions(artifact);
+import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.osee.ote.ui.define.utilities.SelectionHelper;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OpenInArtifactEditor extends AbstractActionHandler {
+
+ public OpenInArtifactEditor(StructuredViewer viewer, String text) throws Exception {
+ super(viewer, text);
+ }
+
+ public OpenInArtifactEditor(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
+ super(viewer, text, image);
+ }
+
+ @Override
+ public void run() {
+ try {
+ TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
+ if (isValidSelection(operator)) {
+ Artifact artifact = operator.getTestRunArtifact();
+ checkPermissions(artifact);
RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
- }
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, "Unable to open artifact.", ex);
- }
- }
-
- @Override
- public void updateState() throws OseeCoreException {
- TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
- setEnabled(isValidSelection(operator));
- }
-
- private boolean isValidSelection(TestRunOperator operator) throws OseeCoreException {
- return operator != null && operator.hasValidArtifact() && operator.isFromLocalWorkspace() != true;
- }
-
- private void checkPermissions(Artifact artifact) throws OseeCoreException {
- if (true != AccessControlManager.hasPermission(artifact, PermissionEnum.READ)) {
- throw new OseeArgumentException(String.format("The user %s does not have read access to %s",
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, "Unable to open artifact.", ex);
+ }
+ }
+
+ @Override
+ public void updateState() throws OseeCoreException {
+ TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
+ setEnabled(isValidSelection(operator));
+ }
+
+ private boolean isValidSelection(TestRunOperator operator) throws OseeCoreException {
+ return operator != null && operator.hasValidArtifact() && operator.isFromLocalWorkspace() != true;
+ }
+
+ private void checkPermissions(Artifact artifact) throws OseeCoreException {
+ if (true != AccessControlManager.hasPermission(artifact, PermissionEnum.READ)) {
+ throw new OseeArgumentException(String.format("The user %s does not have read access to %s",
UserManager.getUser(), artifact));
- }
- }
-}
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/ArtifactItem.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/ArtifactItem.java
index bde10c7d19e..ddb92f6d1d6 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/ArtifactItem.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/ArtifactItem.java
@@ -1,326 +1,326 @@
-/*******************************************************************************
- * 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.ote.ui.define.viewers.data;
-
-import java.util.Date;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.DecorationOverlayIcon;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
-import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
-import org.eclipse.osee.framework.skynet.core.event.IFrameworkTransactionEventListener;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event2.ArtifactEvent;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.IArtifactEventListener;
-import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.OverlayImage;
-import org.eclipse.osee.framework.ui.swt.OverlayImage.Location;
-import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.TreeColumn;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactItem extends DataItem implements IXViewerItem, IArtifactEventListener, IFrameworkTransactionEventListener {
- private static Image FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE = null;
- private static Image FROM_DATABASE_IMAGE = null;
- private static Image FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE = null;
- private static Image INVALID_SCRIPT_IMAGE = null;
- private static boolean isFullDescriptionMode = true;
-
- private final XViewer xViewer;
- private Artifact artifact;
- private TestRunOperator operator;
- private String key;
-
- public ArtifactItem(XViewer xViewer, Artifact artifact, DataItem parent) throws OseeArgumentException {
- super(parent);
- this.xViewer = xViewer;
- setArtifact(artifact);
- OseeEventManager.addListener(this);
- }
-
- @Override
- public Artifact getData() {
- return artifact;
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- super.dispose();
- }
-
- private void setArtifact(Artifact artifact) throws OseeArgumentException {
- this.artifact = artifact;
- this.operator = new TestRunOperator(artifact);
- try {
- this.key =
- String.format("%s:%s:%s", getOperator().getChecksum(), getOperator().isFromLocalWorkspace(),
- getOperator().hasNotBeenCommitted());
- } catch (Exception ex) {
- this.key = "";
- }
- }
-
- public XViewer getXViewer() {
- return xViewer;
- }
-
- public TestRunOperator getOperator() {
- return operator;
- }
-
- public String getLabel(int index) {
- String toReturn = "";
- Artifact artifact = getData();
- try {
- if (artifact != null && artifact.isDeleted() != true) {
-
- if (index <= xViewer.getTree().getColumns().length - 1) {
-
- TreeColumn treeCol = xViewer.getTree().getColumns()[index];
- String colName = treeCol.getText();
- if (colName.equals("HRID")) {
- toReturn = artifact.getHumanReadableId();
- } else if (colName.equals("GUID")) {
- toReturn = artifact.getGuid();
- } else if (colName.equals("Artifact_Type")) {
- toReturn = artifact.getArtifactTypeName();
- if (getOperator().isFromLocalWorkspace()) {
- toReturn += " (Local)";
- }
- } else if (colName.equals("Status")) {
- try {
- toReturn = getOperator().getTestResultStatus();
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- toReturn = ex.getLocalizedMessage();
- }
- } else if (colName.equals("Disposition")) {
- //Special case for the Disposition Artifact
- String name = artifact.getSoleAttributeValueAsString("Name", "");
- if (name != "") {
- try {
- Artifact dispoArtifact =
- ArtifactQuery.getArtifactFromTypeAndAttribute("Test Run Disposition", "Name", name,
- artifact.getBranch());
- if (dispoArtifact != null) {
- return dispoArtifact.getSoleAttributeValueAsString("Disposition", "");
- }
- } catch (ArtifactDoesNotExist ex) {
- //ignore if not defined
- }
- }
- return "";
- } else {
- if (artifact.isAttributeTypeValid(colName)) {
- AttributeType attributeType = AttributeTypeManager.getType(colName);
- if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
- Date date = null;
- try {
- date = artifact.getSoleAttributeValue(colName);
- } catch (Exception ex) {
- // Do Nothing;
- }
- if (date != null) {
- toReturn = new DateAttribute().MMDDYYHHMM.format(date);
- } else {
- toReturn = "NOT SET";
- }
- } else {
- toReturn = artifact.getAttributesToString(colName);
- if (colName.equals("Name")) {
- toReturn = getArtifactName(toReturn);
- }
- }
- }
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- toReturn = ex.getLocalizedMessage();
- }
- return toReturn;
- }
-
- private String getArtifactName(String rawName) throws Exception {
- String name = rawName;
- if (isFullDescriptionModeEnabled() != true) {
- String[] qualifiers = rawName.split("\\.");
- name = qualifiers[qualifiers.length - 1];
- }
- return String.format("%s%s [%s]", getOperator().isFromLocalWorkspace() ? "> " : "", name,
- getOperator().getChecksum());
- }
-
- public Image getImage() {
- Image toReturn = null;
- try {
- Artifact artifact = getData();
- if (artifact != null && artifact.isDeleted() != true) {
- if (areImagesInitialized() != true) {
- initializeImages();
- }
- TestRunOperator operator = getOperator();
- if (operator.isFromLocalWorkspace() == true) {
- if (operator.isCommitAllowed() == true) {
- toReturn = FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE;
- } else {
- if (operator.isScriptRevisionValid() != true) {
- toReturn = INVALID_SCRIPT_IMAGE;
- } else {
- toReturn = FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE;
- }
- }
- } else {
- toReturn = FROM_DATABASE_IMAGE;
- }
- }
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
- }
- return toReturn;
- }
-
- private boolean areImagesInitialized() {
- return FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE != null && FROM_DATABASE_IMAGE != null && FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE != null;
- }
-
- private void initializeImages() throws OseeArgumentException {
- Artifact artifact = getData();
- Image defaultImage = ArtifactImageManager.getImage(artifact);
- DecorationOverlayIcon overlay = null;
- if (FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE == null) {
- OverlayImage overlayImage =
- new OverlayImage(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.ADDITION),
- Location.BOT_RIGHT);
- FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE = overlayImage.createImage();
- }
- if (FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE == null) {
- overlay =
- new DecorationOverlayIcon(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.CONFAUTO_OV),
- IDecoration.BOTTOM_RIGHT);
- FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE = overlay.createImage();
- }
- if (FROM_DATABASE_IMAGE == null) {
- overlay =
- new DecorationOverlayIcon(defaultImage,
- ImageManager.getImageDescriptor(OteDefineImage.VERSION_CONTROLLED), IDecoration.BOTTOM_RIGHT);
- FROM_DATABASE_IMAGE = overlay.createImage();
- }
- if (INVALID_SCRIPT_IMAGE == null) {
- overlay =
- new DecorationOverlayIcon(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.OBSTRUCTED),
- IDecoration.BOTTOM_RIGHT);
- INVALID_SCRIPT_IMAGE = overlay.createImage();
- }
- }
-
- @Override
- public Object getKey() {
- return key;
- }
-
- public static void setFullDescriptionModeEnabled(boolean isEnabled) {
- ArtifactItem.isFullDescriptionMode = isEnabled;
- }
-
- public static boolean isFullDescriptionModeEnabled() {
- return ArtifactItem.isFullDescriptionMode;
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
- if (artifact.isDeleted()) {
- return;
- }
- if (transData.isDeleted(artifact)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!xViewer.getTree().isDisposed()) {
- xViewer.remove(this);
- }
- dispose();
- }
- });
- return;
- }
- if (transData.isRelAddedChangedDeleted(artifact) || transData.isChanged(artifact)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!xViewer.getTree().isDisposed()) {
- xViewer.remove(this);
- } else {
- xViewer.update(this, null);
- }
- }
- });
- }
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return null;
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- if (artifact.isDeleted()) {
- return;
- }
- if (artifactEvent.isDeletedPurged(artifact)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!xViewer.getTree().isDisposed()) {
- xViewer.remove(this);
- }
- dispose();
- }
- });
- return;
- }
- if (artifactEvent.isRelAddedChangedDeleted(artifact) || artifactEvent.isModified(artifact)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!xViewer.getTree().isDisposed()) {
- xViewer.remove(this);
- } else {
- xViewer.update(this, null);
- }
- }
- });
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ote.ui.define.viewers.data;
+
+import java.util.Date;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
+import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
+import org.eclipse.osee.framework.skynet.core.event.IFrameworkTransactionEventListener;
+import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
+import org.eclipse.osee.framework.skynet.core.event.Sender;
+import org.eclipse.osee.framework.skynet.core.event2.ArtifactEvent;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.IArtifactEventListener;
+import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.OverlayImage;
+import org.eclipse.osee.framework.ui.swt.OverlayImage.Location;
+import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactItem extends DataItem implements IXViewerItem, IArtifactEventListener, IFrameworkTransactionEventListener {
+ private static Image FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE = null;
+ private static Image FROM_DATABASE_IMAGE = null;
+ private static Image FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE = null;
+ private static Image INVALID_SCRIPT_IMAGE = null;
+ private static boolean isFullDescriptionMode = true;
+
+ private final XViewer xViewer;
+ private Artifact artifact;
+ private TestRunOperator operator;
+ private String key;
+
+ public ArtifactItem(XViewer xViewer, Artifact artifact, DataItem parent) throws OseeArgumentException {
+ super(parent);
+ this.xViewer = xViewer;
+ setArtifact(artifact);
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ public Artifact getData() {
+ return artifact;
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ super.dispose();
+ }
+
+ private void setArtifact(Artifact artifact) throws OseeArgumentException {
+ this.artifact = artifact;
+ this.operator = new TestRunOperator(artifact);
+ try {
+ this.key =
+ String.format("%s:%s:%s", getOperator().getChecksum(), getOperator().isFromLocalWorkspace(),
+ getOperator().hasNotBeenCommitted());
+ } catch (Exception ex) {
+ this.key = "";
+ }
+ }
+
+ public XViewer getXViewer() {
+ return xViewer;
+ }
+
+ public TestRunOperator getOperator() {
+ return operator;
+ }
+
+ public String getLabel(int index) {
+ String toReturn = "";
+ Artifact artifact = getData();
+ try {
+ if (artifact != null && artifact.isDeleted() != true) {
+
+ if (index <= xViewer.getTree().getColumns().length - 1) {
+
+ TreeColumn treeCol = xViewer.getTree().getColumns()[index];
+ String colName = treeCol.getText();
+ if (colName.equals("HRID")) {
+ toReturn = artifact.getHumanReadableId();
+ } else if (colName.equals("GUID")) {
+ toReturn = artifact.getGuid();
+ } else if (colName.equals("Artifact_Type")) {
+ toReturn = artifact.getArtifactTypeName();
+ if (getOperator().isFromLocalWorkspace()) {
+ toReturn += " (Local)";
+ }
+ } else if (colName.equals("Status")) {
+ try {
+ toReturn = getOperator().getTestResultStatus();
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ toReturn = ex.getLocalizedMessage();
+ }
+ } else if (colName.equals("Disposition")) {
+ //Special case for the Disposition Artifact
+ String name = artifact.getSoleAttributeValueAsString("Name", "");
+ if (name != "") {
+ try {
+ Artifact dispoArtifact =
+ ArtifactQuery.getArtifactFromTypeAndAttribute("Test Run Disposition", "Name", name,
+ artifact.getBranch());
+ if (dispoArtifact != null) {
+ return dispoArtifact.getSoleAttributeValueAsString("Disposition", "");
+ }
+ } catch (ArtifactDoesNotExist ex) {
+ //ignore if not defined
+ }
+ }
+ return "";
+ } else {
+ if (artifact.isAttributeTypeValid(colName)) {
+ AttributeType attributeType = AttributeTypeManager.getType(colName);
+ if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
+ Date date = null;
+ try {
+ date = artifact.getSoleAttributeValue(colName);
+ } catch (Exception ex) {
+ // Do Nothing;
+ }
+ if (date != null) {
+ toReturn = new DateAttribute().MMDDYYHHMM.format(date);
+ } else {
+ toReturn = "NOT SET";
+ }
+ } else {
+ toReturn = artifact.getAttributesToString(colName);
+ if (colName.equals("Name")) {
+ toReturn = getArtifactName(toReturn);
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ toReturn = ex.getLocalizedMessage();
+ }
+ return toReturn;
+ }
+
+ private String getArtifactName(String rawName) throws Exception {
+ String name = rawName;
+ if (isFullDescriptionModeEnabled() != true) {
+ String[] qualifiers = rawName.split("\\.");
+ name = qualifiers[qualifiers.length - 1];
+ }
+ return String.format("%s%s [%s]", getOperator().isFromLocalWorkspace() ? "> " : "", name,
+ getOperator().getChecksum());
+ }
+
+ public Image getImage() {
+ Image toReturn = null;
+ try {
+ Artifact artifact = getData();
+ if (artifact != null && artifact.isDeleted() != true) {
+ if (areImagesInitialized() != true) {
+ initializeImages();
+ }
+ TestRunOperator operator = getOperator();
+ if (operator.isFromLocalWorkspace() == true) {
+ if (operator.isCommitAllowed() == true) {
+ toReturn = FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE;
+ } else {
+ if (operator.isScriptRevisionValid() != true) {
+ toReturn = INVALID_SCRIPT_IMAGE;
+ } else {
+ toReturn = FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE;
+ }
+ }
+ } else {
+ toReturn = FROM_DATABASE_IMAGE;
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.SEVERE, ex);
+ }
+ return toReturn;
+ }
+
+ private boolean areImagesInitialized() {
+ return FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE != null && FROM_DATABASE_IMAGE != null && FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE != null;
+ }
+
+ private void initializeImages() throws OseeArgumentException {
+ Artifact artifact = getData();
+ Image defaultImage = ArtifactImageManager.getImage(artifact);
+ DecorationOverlayIcon overlay = null;
+ if (FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE == null) {
+ OverlayImage overlayImage =
+ new OverlayImage(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.ADDITION),
+ Location.BOT_RIGHT);
+ FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE = overlayImage.createImage();
+ }
+ if (FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE == null) {
+ overlay =
+ new DecorationOverlayIcon(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.CONFAUTO_OV),
+ IDecoration.BOTTOM_RIGHT);
+ FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE = overlay.createImage();
+ }
+ if (FROM_DATABASE_IMAGE == null) {
+ overlay =
+ new DecorationOverlayIcon(defaultImage,
+ ImageManager.getImageDescriptor(OteDefineImage.VERSION_CONTROLLED), IDecoration.BOTTOM_RIGHT);
+ FROM_DATABASE_IMAGE = overlay.createImage();
+ }
+ if (INVALID_SCRIPT_IMAGE == null) {
+ overlay =
+ new DecorationOverlayIcon(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.OBSTRUCTED),
+ IDecoration.BOTTOM_RIGHT);
+ INVALID_SCRIPT_IMAGE = overlay.createImage();
+ }
+ }
+
+ @Override
+ public Object getKey() {
+ return key;
+ }
+
+ public static void setFullDescriptionModeEnabled(boolean isEnabled) {
+ ArtifactItem.isFullDescriptionMode = isEnabled;
+ }
+
+ public static boolean isFullDescriptionModeEnabled() {
+ return ArtifactItem.isFullDescriptionMode;
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
+ if (artifact.isDeleted()) {
+ return;
+ }
+ if (transData.isDeleted(artifact)) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (!xViewer.getTree().isDisposed()) {
+ xViewer.remove(this);
+ }
+ dispose();
+ }
+ });
+ return;
+ }
+ if (transData.isRelAddedChangedDeleted(artifact) || transData.isChanged(artifact)) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (!xViewer.getTree().isDisposed()) {
+ xViewer.remove(this);
+ } else {
+ xViewer.update(this, null);
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return null;
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ if (artifact.isDeleted()) {
+ return;
+ }
+ if (artifactEvent.isDeletedPurged(artifact)) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (!xViewer.getTree().isDisposed()) {
+ xViewer.remove(this);
+ }
+ dispose();
+ }
+ });
+ return;
+ }
+ if (artifactEvent.isRelAddedChangedDeleted(artifact) || artifactEvent.isModified(artifact)) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (!xViewer.getTree().isDisposed()) {
+ xViewer.remove(this);
+ } else {
+ xViewer.update(this, null);
+ }
+ }
+ });
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/BranchItem.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/BranchItem.java
index 23a159f4215..4affaccf031 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/BranchItem.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/BranchItem.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * 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.ote.ui.define.viewers.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchItem extends DataItem implements IXViewerItem {
-
- private final Branch branch;
- private static boolean isScriptItemGrouped = true;
-
- public BranchItem(Branch branch, DataItem parentItem) {
- super(parentItem);
- this.branch = branch;
- }
-
- @Override
- public String getData() {
- return branch.getName();
- }
-
- public Image getImage() {
- return ImageManager.getImage(OteDefineImage.CHILD_BRANCH);
- }
-
- public String getLabel(int index) {
- return index == 0 ? getData() : "";
- }
-
- @Override
- public Object getKey() {
- return branch;
- }
-
- @Override
- public DataItem[] getChildren() {
- DataItem[] toReturn = super.getChildren();
- if (isGroupModeEnabled() != true) {
- List<DataItem> tempList = new ArrayList<DataItem>();
- for (DataItem item : toReturn) {
- if (item.hasChildren()) {
- for (DataItem itemX : item.getChildren()) {
- tempList.add(itemX);
- }
- }
- }
- toReturn = tempList.toArray(new DataItem[tempList.size()]);
- }
- return toReturn;
- }
-
- public static void setGroupModeEnabled(boolean isEnabled) {
- BranchItem.isScriptItemGrouped = isEnabled;
- }
-
- public static boolean isGroupModeEnabled() {
- return BranchItem.isScriptItemGrouped;
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.viewers.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchItem extends DataItem implements IXViewerItem {
+
+ private final Branch branch;
+ private static boolean isScriptItemGrouped = true;
+
+ public BranchItem(Branch branch, DataItem parentItem) {
+ super(parentItem);
+ this.branch = branch;
+ }
+
+ @Override
+ public String getData() {
+ return branch.getName();
+ }
+
+ public Image getImage() {
+ return ImageManager.getImage(OteDefineImage.CHILD_BRANCH);
+ }
+
+ public String getLabel(int index) {
+ return index == 0 ? getData() : "";
+ }
+
+ @Override
+ public Object getKey() {
+ return branch;
+ }
+
+ @Override
+ public DataItem[] getChildren() {
+ DataItem[] toReturn = super.getChildren();
+ if (isGroupModeEnabled() != true) {
+ List<DataItem> tempList = new ArrayList<DataItem>();
+ for (DataItem item : toReturn) {
+ if (item.hasChildren()) {
+ for (DataItem itemX : item.getChildren()) {
+ tempList.add(itemX);
+ }
+ }
+ }
+ toReturn = tempList.toArray(new DataItem[tempList.size()]);
+ }
+ return toReturn;
+ }
+
+ public static void setGroupModeEnabled(boolean isEnabled) {
+ BranchItem.isScriptItemGrouped = isEnabled;
+ }
+
+ public static boolean isGroupModeEnabled() {
+ return BranchItem.isScriptItemGrouped;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/DataItemLabelProvider.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/DataItemLabelProvider.java
index 29de87a267d..0e1796898d7 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/DataItemLabelProvider.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/DataItemLabelProvider.java
@@ -8,59 +8,59 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.viewers.data;
-
+package org.eclipse.osee.ote.ui.define.viewers.data;
+
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.nebula.widgets.xviewer.XViewer;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DataItemLabelProvider extends XViewerLabelProvider {
-
- /**
- * @param viewer
- */
- public DataItemLabelProvider(XViewer viewer) {
- super(viewer);
- }
-
- @Override
- public Image getColumnImage(Object element, XViewerColumn col, int columnIndex) {
- Image toReturn = null;
- if (columnIndex == 0) {
- if (element instanceof IXViewerItem) {
- toReturn = ((IXViewerItem) element).getImage();
- }
- }
- return toReturn;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn col, int columnIndex) {
- String toReturn = "";
- if (element instanceof String && columnIndex == 1) {
- toReturn = (String) element;
- } else if (element instanceof IXViewerItem) {
- toReturn = ((IXViewerItem) element).getLabel(columnIndex);
- }
- return toReturn;
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataItemLabelProvider extends XViewerLabelProvider {
+
+ /**
+ * @param viewer
+ */
+ public DataItemLabelProvider(XViewer viewer) {
+ super(viewer);
+ }
+
+ @Override
+ public Image getColumnImage(Object element, XViewerColumn col, int columnIndex) {
+ Image toReturn = null;
+ if (columnIndex == 0) {
+ if (element instanceof IXViewerItem) {
+ toReturn = ((IXViewerItem) element).getImage();
+ }
+ }
+ return toReturn;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn col, int columnIndex) {
+ String toReturn = "";
+ if (element instanceof String && columnIndex == 1) {
+ toReturn = (String) element;
+ } else if (element instanceof IXViewerItem) {
+ toReturn = ((IXViewerItem) element).getLabel(columnIndex);
+ }
+ return toReturn;
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/IXViewerItem.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/IXViewerItem.java
index 66380376872..df02cf28071 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/IXViewerItem.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/data/IXViewerItem.java
@@ -8,17 +8,17 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.viewers.data;
-
+package org.eclipse.osee.ote.ui.define.viewers.data;
+
import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IXViewerItem {
-
- public abstract Image getImage();
-
- public abstract String getLabel(int index);
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IXViewerItem {
+
+ public abstract Image getImage();
+
+ public abstract String getLabel(int index);
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/TestRunView.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/TestRunView.java
index 0728ec1add3..314c996be7c 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/TestRunView.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/TestRunView.java
@@ -1,280 +1,280 @@
-/*******************************************************************************
- * 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.ote.ui.define.views;
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.IActionable;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.ote.ui.define.OteDefineImage;
-import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
-import org.eclipse.osee.ote.ui.define.viewers.IDataChangedListener;
-import org.eclipse.osee.ote.ui.define.viewers.TestRunXViewer;
-import org.eclipse.osee.ote.ui.define.viewers.data.ArtifactItem;
-import org.eclipse.osee.ote.ui.define.viewers.data.BranchItem;
-import org.eclipse.osee.ote.ui.define.viewers.data.ScriptItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @author Roberto E. Escobar
- */
-public class TestRunView extends ViewPart implements IActionable, IDataChangedListener {
- public static final String VIEW_ID = TestRunView.class.getName();
- private static final String BEGIN_MESSAGE =
- "To begin, drag and drop a test run artifact from artifact explorer or from an artifact search result window. Alternatively, you can drag and drop a test outfile onto this view.";
-
- private Action expandAction, collapseAction, refreshAction;
- private static TestRunXViewer viewer = null;
- @SuppressWarnings("unused")
- private IHandlerService handlerService;
- private ShowOnlyLatestRuns latestRunFilter;
- private boolean isFilterOn;
-
- // private static final String FLAT_KEY = "flat";
-
- @Override
- public void createPartControl(Composite parent) {
- parent.setLayout(new GridLayout());
-
- PlatformUI.getWorkbench().getService(IHandlerService.class);
- handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
-
- viewer = new TestRunXViewer(parent);
- Tree tree = viewer.getTree();
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.minimumHeight = 350;
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- tree.setFont(parent.getFont());
-
- parent.layout();
- createActions();
- createMenus();
- createToolbar();
-
- latestRunFilter = new ShowOnlyLatestRuns();
- isFilterOn = false;
- viewer.registerListener(this);
- viewer.getTree().addKeyListener(new KeyAdapter() {
-
- @Override
- public void keyPressed(KeyEvent event) {
- if (event.stateMask == SWT.CTRL && (event.keyCode == 'A' || event.keyCode == 'a')) {
- Object object = event.getSource();
- if (object instanceof Tree) {
- Tree tree = (Tree) object;
- tree.selectAll();
- }
- }
- }
- });
- onDataChanged();
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.osee.ote.ui.define.testRunView");
- }
-
- @Override
- public void setFocus() {
- }
-
- public String getActionDescription() {
- return "";
- }
-
- protected void createActions() {
- expandAction = new Action("Expand All") {
-
- @Override
- public void run() {
- viewer.getTree().setRedraw(false);
- viewer.expandAll();
- viewer.getTree().setRedraw(true);
- }
- };
- expandAction.setImageDescriptor(ImageManager.getImageDescriptor(OteDefineImage.EXPAND_STATE));
- expandAction.setToolTipText("Expand All");
-
- collapseAction = new Action("Collapse All") {
-
- @Override
- public void run() {
- viewer.getTree().setRedraw(false);
- viewer.collapseAll();
- viewer.getTree().setRedraw(true);
- }
- };
- collapseAction.setImageDescriptor(ImageManager.getImageDescriptor(OteDefineImage.COLLAPSE_STATE));
- collapseAction.setToolTipText("Collapse All");
-
- refreshAction = new Action("Refresh") {
-
- @Override
- public void run() {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- viewer.refresh();
- };
- });
- }
- };
- refreshAction.setToolTipText("Refresh Table");
- refreshAction.setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
-
- }
-
- private void createMenus() {
- MenuManager menuManager = new MenuManager();
- getSite().registerContextMenu(VIEW_ID, menuManager, viewer);
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menuManager.setParent(getViewSite().getActionBars().getMenuManager());
- fillMenu(menuManager);
- getSite().setSelectionProvider(viewer);
- OseeUiActions.addBugToViewToolbar(this, this, OteUiDefinePlugin.getInstance(), VIEW_ID, "Test Run View");
- }
-
- private void fillMenu(IMenuManager menuManager) {
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- private void createToolbar() {
- IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager();
- toolbarManager.add(refreshAction);
- toolbarManager.add(expandAction);
- toolbarManager.add(collapseAction);
- }
-
- public void setDescription(final String message) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- setContentDescription(message);
- }
- });
- }
-
- @Override
- public void onDataChanged() {
- String message = BEGIN_MESSAGE;
- Object object = viewer.getInput();
- if (object != null && object instanceof Collection<?>) {
- if (!((Collection<?>) object).isEmpty()) {
- message = "";
- }
- }
- setDescription(message);
- }
-
- public static StructuredViewer getViewer() {
- return viewer;
- }
-
- public void presentGroupedByBranch() {
- BranchItem.setGroupModeEnabled(true);
- viewer.refresh();
- }
-
- public void presentGroupedByScript() {
- BranchItem.setGroupModeEnabled(false);
- viewer.refresh();
- }
-
- public void presentWithShortNames() {
- ScriptItem.setFullDescriptionModeEnabled(false);
- ArtifactItem.setFullDescriptionModeEnabled(false);
- viewer.refresh();
- }
-
- public void presentWithLongNames() {
- ScriptItem.setFullDescriptionModeEnabled(true);
- ArtifactItem.setFullDescriptionModeEnabled(true);
- viewer.refresh();
- }
-
- public void toggleFilter() {
- latestRunFilter.clear();
- if (isFilterOn != true) {
- isFilterOn = true;
- viewer.addFilter(latestRunFilter);
- } else {
- isFilterOn = false;
- viewer.removeFilter(latestRunFilter);
- }
- viewer.refresh();
- }
-
- private final class ShowOnlyLatestRuns extends ViewerFilter {
- private final Map<String, ArtifactItem> latestMap = new HashMap<String, ArtifactItem>();
-
- @Override
- public Object[] filter(Viewer viewer, Object parent, Object[] elements) {
- return super.filter(viewer, parent, elements);
- }
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- boolean toReturn = false;
- if (element instanceof ArtifactItem) {
- ArtifactItem item1 = (ArtifactItem) element;
- String name = item1.getOperator().getDescriptiveName();
-
- ArtifactItem item2 = latestMap.get(name);
- if (item2 == null) {
- latestMap.put(name, item1);
- toReturn = true;
- } else {
- try {
- Date date1 = item1.getOperator().getEndDate();
- Date date2 = item2.getOperator().getEndDate();
- if (date1.after(date2) || date1.equals(date2)) {
- latestMap.put(name, item1);
- toReturn = true;
- }
- } catch (Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.WARNING, "Error comparing run dates.", ex);
- }
- }
- } else {
- toReturn = true;
- }
- return toReturn;
- }
-
- public void clear() {
- latestMap.clear();
- }
- }
-}
+/*******************************************************************************
+ * 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.ote.ui.define.views;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.ote.ui.define.OteDefineImage;
+import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
+import org.eclipse.osee.ote.ui.define.viewers.IDataChangedListener;
+import org.eclipse.osee.ote.ui.define.viewers.TestRunXViewer;
+import org.eclipse.osee.ote.ui.define.viewers.data.ArtifactItem;
+import org.eclipse.osee.ote.ui.define.viewers.data.BranchItem;
+import org.eclipse.osee.ote.ui.define.viewers.data.ScriptItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TestRunView extends ViewPart implements IActionable, IDataChangedListener {
+ public static final String VIEW_ID = TestRunView.class.getName();
+ private static final String BEGIN_MESSAGE =
+ "To begin, drag and drop a test run artifact from artifact explorer or from an artifact search result window. Alternatively, you can drag and drop a test outfile onto this view.";
+
+ private Action expandAction, collapseAction, refreshAction;
+ private static TestRunXViewer viewer = null;
+ @SuppressWarnings("unused")
+ private IHandlerService handlerService;
+ private ShowOnlyLatestRuns latestRunFilter;
+ private boolean isFilterOn;
+
+ // private static final String FLAT_KEY = "flat";
+
+ @Override
+ public void createPartControl(Composite parent) {
+ parent.setLayout(new GridLayout());
+
+ PlatformUI.getWorkbench().getService(IHandlerService.class);
+ handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
+
+ viewer = new TestRunXViewer(parent);
+ Tree tree = viewer.getTree();
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.minimumHeight = 350;
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ tree.setFont(parent.getFont());
+
+ parent.layout();
+ createActions();
+ createMenus();
+ createToolbar();
+
+ latestRunFilter = new ShowOnlyLatestRuns();
+ isFilterOn = false;
+ viewer.registerListener(this);
+ viewer.getTree().addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent event) {
+ if (event.stateMask == SWT.CTRL && (event.keyCode == 'A' || event.keyCode == 'a')) {
+ Object object = event.getSource();
+ if (object instanceof Tree) {
+ Tree tree = (Tree) object;
+ tree.selectAll();
+ }
+ }
+ }
+ });
+ onDataChanged();
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.osee.ote.ui.define.testRunView");
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ public String getActionDescription() {
+ return "";
+ }
+
+ protected void createActions() {
+ expandAction = new Action("Expand All") {
+
+ @Override
+ public void run() {
+ viewer.getTree().setRedraw(false);
+ viewer.expandAll();
+ viewer.getTree().setRedraw(true);
+ }
+ };
+ expandAction.setImageDescriptor(ImageManager.getImageDescriptor(OteDefineImage.EXPAND_STATE));
+ expandAction.setToolTipText("Expand All");
+
+ collapseAction = new Action("Collapse All") {
+
+ @Override
+ public void run() {
+ viewer.getTree().setRedraw(false);
+ viewer.collapseAll();
+ viewer.getTree().setRedraw(true);
+ }
+ };
+ collapseAction.setImageDescriptor(ImageManager.getImageDescriptor(OteDefineImage.COLLAPSE_STATE));
+ collapseAction.setToolTipText("Collapse All");
+
+ refreshAction = new Action("Refresh") {
+
+ @Override
+ public void run() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ viewer.refresh();
+ };
+ });
+ }
+ };
+ refreshAction.setToolTipText("Refresh Table");
+ refreshAction.setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
+
+ }
+
+ private void createMenus() {
+ MenuManager menuManager = new MenuManager();
+ getSite().registerContextMenu(VIEW_ID, menuManager, viewer);
+ menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ menuManager.setParent(getViewSite().getActionBars().getMenuManager());
+ fillMenu(menuManager);
+ getSite().setSelectionProvider(viewer);
+ OseeUiActions.addBugToViewToolbar(this, this, OteUiDefinePlugin.getInstance(), VIEW_ID, "Test Run View");
+ }
+
+ private void fillMenu(IMenuManager menuManager) {
+ menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ private void createToolbar() {
+ IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager();
+ toolbarManager.add(refreshAction);
+ toolbarManager.add(expandAction);
+ toolbarManager.add(collapseAction);
+ }
+
+ public void setDescription(final String message) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ setContentDescription(message);
+ }
+ });
+ }
+
+ @Override
+ public void onDataChanged() {
+ String message = BEGIN_MESSAGE;
+ Object object = viewer.getInput();
+ if (object != null && object instanceof Collection<?>) {
+ if (!((Collection<?>) object).isEmpty()) {
+ message = "";
+ }
+ }
+ setDescription(message);
+ }
+
+ public static StructuredViewer getViewer() {
+ return viewer;
+ }
+
+ public void presentGroupedByBranch() {
+ BranchItem.setGroupModeEnabled(true);
+ viewer.refresh();
+ }
+
+ public void presentGroupedByScript() {
+ BranchItem.setGroupModeEnabled(false);
+ viewer.refresh();
+ }
+
+ public void presentWithShortNames() {
+ ScriptItem.setFullDescriptionModeEnabled(false);
+ ArtifactItem.setFullDescriptionModeEnabled(false);
+ viewer.refresh();
+ }
+
+ public void presentWithLongNames() {
+ ScriptItem.setFullDescriptionModeEnabled(true);
+ ArtifactItem.setFullDescriptionModeEnabled(true);
+ viewer.refresh();
+ }
+
+ public void toggleFilter() {
+ latestRunFilter.clear();
+ if (isFilterOn != true) {
+ isFilterOn = true;
+ viewer.addFilter(latestRunFilter);
+ } else {
+ isFilterOn = false;
+ viewer.removeFilter(latestRunFilter);
+ }
+ viewer.refresh();
+ }
+
+ private final class ShowOnlyLatestRuns extends ViewerFilter {
+ private final Map<String, ArtifactItem> latestMap = new HashMap<String, ArtifactItem>();
+
+ @Override
+ public Object[] filter(Viewer viewer, Object parent, Object[] elements) {
+ return super.filter(viewer, parent, elements);
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ boolean toReturn = false;
+ if (element instanceof ArtifactItem) {
+ ArtifactItem item1 = (ArtifactItem) element;
+ String name = item1.getOperator().getDescriptiveName();
+
+ ArtifactItem item2 = latestMap.get(name);
+ if (item2 == null) {
+ latestMap.put(name, item1);
+ toReturn = true;
+ } else {
+ try {
+ Date date1 = item1.getOperator().getEndDate();
+ Date date2 = item2.getOperator().getEndDate();
+ if (date1.after(date2) || date1.equals(date2)) {
+ latestMap.put(name, item1);
+ toReturn = true;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.WARNING, "Error comparing run dates.", ex);
+ }
+ }
+ } else {
+ toReturn = true;
+ }
+ return toReturn;
+ }
+
+ public void clear() {
+ latestMap.clear();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/FlatPresentationHandler.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/FlatPresentationHandler.java
index 8b2ab2bdaf4..44b3917971a 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/FlatPresentationHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/FlatPresentationHandler.java
@@ -8,19 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.views.handlers;
-
+package org.eclipse.osee.ote.ui.define.views.handlers;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.osee.ote.ui.define.views.TestRunView;
import org.eclipse.ui.handlers.HandlerUtil;
-
-public class FlatPresentationHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ((TestRunView) HandlerUtil.getActivePartChecked(event)).presentGroupedByScript();
- return null;
- }
-}
+
+public class FlatPresentationHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ((TestRunView) HandlerUtil.getActivePartChecked(event)).presentGroupedByScript();
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/GroupedPresentationHandler.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/GroupedPresentationHandler.java
index ce8b165756b..2cca0dca7a9 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/GroupedPresentationHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/GroupedPresentationHandler.java
@@ -8,19 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.views.handlers;
-
+package org.eclipse.osee.ote.ui.define.views.handlers;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.osee.ote.ui.define.views.TestRunView;
import org.eclipse.ui.handlers.HandlerUtil;
-
-public class GroupedPresentationHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ((TestRunView) HandlerUtil.getActivePartChecked(event)).presentGroupedByBranch();
- return null;
- }
-}
+
+public class GroupedPresentationHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ((TestRunView) HandlerUtil.getActivePartChecked(event)).presentGroupedByBranch();
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/LongNamesPresentationHandler.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/LongNamesPresentationHandler.java
index 7b85ac671cb..ad3a08fe2a0 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/LongNamesPresentationHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/LongNamesPresentationHandler.java
@@ -8,19 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.views.handlers;
-
+package org.eclipse.osee.ote.ui.define.views.handlers;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.osee.ote.ui.define.views.TestRunView;
import org.eclipse.ui.handlers.HandlerUtil;
-
-public class LongNamesPresentationHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ((TestRunView) HandlerUtil.getActivePartChecked(event)).presentWithLongNames();
- return null;
- }
-}
+
+public class LongNamesPresentationHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ((TestRunView) HandlerUtil.getActivePartChecked(event)).presentWithLongNames();
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ShortNamesPresentationHandler.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ShortNamesPresentationHandler.java
index 4207d1cd3ab..aea602261d9 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ShortNamesPresentationHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ShortNamesPresentationHandler.java
@@ -8,19 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.views.handlers;
-
+package org.eclipse.osee.ote.ui.define.views.handlers;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.osee.ote.ui.define.views.TestRunView;
import org.eclipse.ui.handlers.HandlerUtil;
-
-public class ShortNamesPresentationHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ((TestRunView) HandlerUtil.getActivePartChecked(event)).presentWithShortNames();
- return null;
- }
-}
+
+public class ShortNamesPresentationHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ((TestRunView) HandlerUtil.getActivePartChecked(event)).presentWithShortNames();
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ToggleFilterHandler.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ToggleFilterHandler.java
index 84dd031e50f..9a6554f952b 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ToggleFilterHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/views/handlers/ToggleFilterHandler.java
@@ -8,28 +8,28 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.views.handlers;
-
+package org.eclipse.osee.ote.ui.define.views.handlers;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.osee.ote.ui.define.views.TestRunView;
import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ToggleFilterHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ((TestRunView) HandlerUtil.getActivePartChecked(event)).toggleFilter();
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- return true;
- }
-
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ToggleFilterHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ((TestRunView) HandlerUtil.getActivePartChecked(event)).toggleFilter();
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+}

Back to the top