Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.ats')
-rw-r--r--plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF170
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java820
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotification.java144
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/CompleteMultipleWorkflows.java176
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSpreadsheet.java290
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java378
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/report/CreateActionArtifactChangeReportJob.java320
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskAction.java26
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java76
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java734
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java810
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java168
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItem.java130
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItemProvider.java138
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java116
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java118
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java758
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java624
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewerFactory.java152
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsArtifactChecks.java292
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java1552
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsEditor.java16
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsFolderUtil.java210
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsNotifyUsers.java606
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPreSaveCacheRemoteEventHandler.java162
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPriority.java144
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsRelationTypes.java210
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java1026
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/DoesNotWorkItemAts.java1336
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java600
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java540
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/OpenInAtsLoopbackCmd.java182
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java636
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/PromptChangeUtil.java956
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAMetrics.java916
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAUtil.java442
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/StateManager.java774
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionMetrics.java228
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionTeamMetrics.java240
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java88
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java94
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/DecisionOption.java356
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/SMAState.java450
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XCurrentStateDam.java160
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XHyperlabelTeamDefinitionSelection.java182
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XStateAssigneesDam.java270
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java642
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java170
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitStatus.java54
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManager.java256
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManagerFactory.java136
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/ICommitConfigArtifact.java34
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitLabelProvider.java328
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java884
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectContentProvider.java204
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectLabelProvider.java188
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectManager.java412
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewer.java1000
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewerFactory.java112
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java1278
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/AtsPriorityDialog.java244
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SimpleTaskResolutionOptionsRule.java96
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/StateListAndTitleDialog.java168
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java302
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRole.java396
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleContentProvider.java204
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java188
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleManager.java456
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java536
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewerFactory.java90
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsAttributeColumn.java132
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java158
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCompletedDateColumn.java126
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCreatedDateColumn.java126
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaStateColumn.java116
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java878
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditorInput.java140
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/EditAction.java194
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramTool.java124
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramToolEntry.java66
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CancelledWorkPageShape.java94
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CompletedWorkPageShape.java96
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/DefaultTransitionConnection.java90
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/ReturnTransitionConnection.java74
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/LeftAnchor.java68
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/RightAnchor.java68
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/WorkPageEditPart.java260
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/DecisionWorkflowDefinition.java216
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/GoalWorkflowDefinition.java152
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/PeerToPeerWorkflowDefinition.java184
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/SimpleWorkflowDefinition.java200
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TaskWorkflowDefinition.java160
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TeamWorkflowDefinition.java286
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddDecisionReviewRule.java312
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddPeerToPeerReviewRule.java252
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewDefectXWidgetWorkItem.java60
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewRolesXWidgetWorkItem.java64
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeSoleComboXWidgetWorkItem.java64
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeXWidgetWorkItem.java88
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancellationReasonStateWorkItem.java80
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancelledFromStateWorkItem.java76
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCompletedFromStateWorkItem.java76
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDecisionReviewRule.java62
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDefaultWorkflowRule.java64
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightPeerToPeerReviewRule.java60
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightRule.java122
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightSimpleWorkflowRule.java60
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsWorkDefinitions.java652
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/StateEventType.java36
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAnalyzeWorkPageDefinition.java84
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAuthorizeWorkPageDefinition.java70
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCancelledWorkPageDefinition.java62
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCompletedWorkPageDefinition.java68
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionCompletedWorkPageDefinition.java76
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionDecisionWorkPageDefinition.java82
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionFollowupWorkPageDefinition.java68
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionPrepareWorkPageDefinition.java82
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsEndorseWorkPageDefinition.java88
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsGoalInWorkPageDefinition.java76
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsImplementWorkPageDefinition.java74
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerPrepareWorkPageDefinition.java86
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerReviewWorkPageDefinition.java76
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsSimpleInWorkWorkPageDefinition.java70
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsTaskInWorkPageDefinition.java88
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/AtsDbConfig.java46
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/Diagram.java204
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramFactory.java102
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramNode.java356
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsMetricsComposite.java794
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java68
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItemBase.java110
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsMetricsProvider.java56
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsWorldEditorItem.java92
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditor.java72
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorConsumer.java22
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorParameterProvider.java74
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java76
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldViewerEventHandler.java30
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java522
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldContentProvider.java338
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java564
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorInput.java168
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorOperationProvider.java134
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItem.java180
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItemProvider.java444
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java116
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorSimpleProvider.java106
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorUISearchItemProvider.java322
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldLabelProvider.java768
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java276
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java232
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java2256
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerEventManager.java282
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerFactory.java656
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java1234
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java456
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GroupWorldSearchItem.java246
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/MultipleHridSearchData.java188
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/NextVersionSearchItem.java280
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java746
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/UserWorldSearchItem.java284
-rw-r--r--plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee1552
162 files changed, 24466 insertions, 24466 deletions
diff --git a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
index d544817c248..9c482d00210 100644
--- a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
@@ -1,85 +1,85 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Ats Plug-in (Incubation)
-Bundle-SymbolicName: org.eclipse.osee.ats;singleton:=true
-Bundle-Version: 0.9.5.qualifier
-Eclipse-ExtensibleAPI: true
-Bundle-Activator: org.eclipse.osee.ats.internal.AtsPlugin
-Bundle-Vendor: Eclipse Open System Engineering Environment
-Require-Bundle: org.eclipse.gef,
- org.eclipse.osee.framework.jdk.core,
- org.eclipse.ui.forms,
- org.eclipse.osee.framework.database,
- org.eclipse.osee.framework.skynet.core,
- org.eclipse.osee.framework.ui.skynet,
- org.eclipse.core.resources,
- org.eclipse.ui.ide,
- org.eclipse.ui,
- org.eclipse.help,
- org.eclipse.osee.framework.ui.plugin,
- org.eclipse.osee.framework.plugin.core,
- org.eclipse.ui.editors,
- org.eclipse.zest.layouts,
- org.eclipse.ui.views,
- org.eclipse.nebula.widgets.xviewer,
- org.eclipse.birt.chart.engine,
- org.eclipse.search,
- org.eclipse.osee.ats.help.ui;resolution:=optional
-Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.osee.ats,
- org.eclipse.osee.ats.actions,
- org.eclipse.osee.ats.actions.wizard,
- org.eclipse.osee.ats.artifact,
- org.eclipse.osee.ats.config,
- org.eclipse.osee.ats.config.wizard,
- org.eclipse.osee.ats.editor,
- org.eclipse.osee.ats.editor.help,
- org.eclipse.osee.ats.editor.stateItem,
- org.eclipse.osee.ats.export,
- org.eclipse.osee.ats.handlers,
- org.eclipse.osee.ats.health,
- org.eclipse.osee.ats.hyper,
- org.eclipse.osee.ats.navigate,
- org.eclipse.osee.ats.notify,
- org.eclipse.osee.ats.operation,
- org.eclipse.osee.ats.report,
- org.eclipse.osee.ats.task,
- org.eclipse.osee.ats.util,
- org.eclipse.osee.ats.util.Import,
- org.eclipse.osee.ats.util.widgets,
- org.eclipse.osee.ats.util.widgets.commit,
- org.eclipse.osee.ats.util.widgets.defect,
- org.eclipse.osee.ats.util.widgets.dialog,
- org.eclipse.osee.ats.util.widgets.role,
- org.eclipse.osee.ats.util.xviewer.column,
- org.eclipse.osee.ats.workflow,
- org.eclipse.osee.ats.workflow.editor,
- org.eclipse.osee.ats.workflow.editor.actions,
- org.eclipse.osee.ats.workflow.editor.model,
- org.eclipse.osee.ats.workflow.editor.model.commands,
- org.eclipse.osee.ats.workflow.editor.parts,
- org.eclipse.osee.ats.workflow.editor.wizard,
- org.eclipse.osee.ats.workflow.flow,
- org.eclipse.osee.ats.workflow.item,
- org.eclipse.osee.ats.workflow.page,
- org.eclipse.osee.ats.workflow.vue,
- org.eclipse.osee.ats.world,
- org.eclipse.osee.ats.world.search
-Import-Package: javax.mail,
- javax.mail.internet,
- org.eclipse.osee.framework.access,
- org.eclipse.osee.framework.core.client,
- org.eclipse.osee.framework.core.client.server,
- org.eclipse.osee.framework.core.data,
- org.eclipse.osee.framework.core.enums,
- org.eclipse.osee.framework.core.exception,
- org.eclipse.osee.framework.core.model,
- org.eclipse.osee.framework.core.model.cache,
- org.eclipse.osee.framework.core.model.event,
- org.eclipse.osee.framework.core.model.type,
- org.eclipse.osee.framework.core.operation,
- org.eclipse.osee.framework.database.init,
- org.eclipse.osee.framework.logging,
- org.eclipse.osee.framework.ui.swt,
- org.eclipse.osee.framework.ui.ws
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Ats Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.ats;singleton:=true
+Bundle-Version: 0.9.5.qualifier
+Eclipse-ExtensibleAPI: true
+Bundle-Activator: org.eclipse.osee.ats.internal.AtsPlugin
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Require-Bundle: org.eclipse.gef,
+ org.eclipse.osee.framework.jdk.core,
+ org.eclipse.ui.forms,
+ org.eclipse.osee.framework.database,
+ org.eclipse.osee.framework.skynet.core,
+ org.eclipse.osee.framework.ui.skynet,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.ui,
+ org.eclipse.help,
+ org.eclipse.osee.framework.ui.plugin,
+ org.eclipse.osee.framework.plugin.core,
+ org.eclipse.ui.editors,
+ org.eclipse.zest.layouts,
+ org.eclipse.ui.views,
+ org.eclipse.nebula.widgets.xviewer,
+ org.eclipse.birt.chart.engine,
+ org.eclipse.search,
+ org.eclipse.osee.ats.help.ui;resolution:=optional
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.osee.ats,
+ org.eclipse.osee.ats.actions,
+ org.eclipse.osee.ats.actions.wizard,
+ org.eclipse.osee.ats.artifact,
+ org.eclipse.osee.ats.config,
+ org.eclipse.osee.ats.config.wizard,
+ org.eclipse.osee.ats.editor,
+ org.eclipse.osee.ats.editor.help,
+ org.eclipse.osee.ats.editor.stateItem,
+ org.eclipse.osee.ats.export,
+ org.eclipse.osee.ats.handlers,
+ org.eclipse.osee.ats.health,
+ org.eclipse.osee.ats.hyper,
+ org.eclipse.osee.ats.navigate,
+ org.eclipse.osee.ats.notify,
+ org.eclipse.osee.ats.operation,
+ org.eclipse.osee.ats.report,
+ org.eclipse.osee.ats.task,
+ org.eclipse.osee.ats.util,
+ org.eclipse.osee.ats.util.Import,
+ org.eclipse.osee.ats.util.widgets,
+ org.eclipse.osee.ats.util.widgets.commit,
+ org.eclipse.osee.ats.util.widgets.defect,
+ org.eclipse.osee.ats.util.widgets.dialog,
+ org.eclipse.osee.ats.util.widgets.role,
+ org.eclipse.osee.ats.util.xviewer.column,
+ org.eclipse.osee.ats.workflow,
+ org.eclipse.osee.ats.workflow.editor,
+ org.eclipse.osee.ats.workflow.editor.actions,
+ org.eclipse.osee.ats.workflow.editor.model,
+ org.eclipse.osee.ats.workflow.editor.model.commands,
+ org.eclipse.osee.ats.workflow.editor.parts,
+ org.eclipse.osee.ats.workflow.editor.wizard,
+ org.eclipse.osee.ats.workflow.flow,
+ org.eclipse.osee.ats.workflow.item,
+ org.eclipse.osee.ats.workflow.page,
+ org.eclipse.osee.ats.workflow.vue,
+ org.eclipse.osee.ats.world,
+ org.eclipse.osee.ats.world.search
+Import-Package: javax.mail,
+ javax.mail.internet,
+ org.eclipse.osee.framework.access,
+ org.eclipse.osee.framework.core.client,
+ org.eclipse.osee.framework.core.client.server,
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.enums,
+ org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.model.cache,
+ org.eclipse.osee.framework.core.model.event,
+ org.eclipse.osee.framework.core.model.type,
+ org.eclipse.osee.framework.core.operation,
+ org.eclipse.osee.framework.database.init,
+ org.eclipse.osee.framework.logging,
+ org.eclipse.osee.framework.ui.swt,
+ org.eclipse.osee.framework.ui.ws
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java
index 064510d2df9..d2140b67509 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/UserSearchWorkflowSearchItem.java
@@ -1,410 +1,410 @@
-/*******************************************************************************
- * 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.ats.navigate;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact.VersionReleaseType;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.XHyperlabelTeamDefinitionSelection;
-import org.eclipse.osee.ats.world.WorldEditor;
-import org.eclipse.osee.ats.world.WorldEditorParameterSearchItem;
-import org.eclipse.osee.ats.world.search.UserWorldSearchItem;
-import org.eclipse.osee.ats.world.search.UserWorldSearchItem.UserSearchOption;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
-import org.eclipse.osee.framework.ui.skynet.widgets.XCombo;
-import org.eclipse.osee.framework.ui.skynet.widgets.XMembersCombo;
-import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Donald G. Dunne
- */
-public class UserSearchWorkflowSearchItem extends WorldEditorParameterSearchItem {
-
- private XHyperlabelTeamDefinitionSelection teamCombo = null;
- private XCombo versionCombo = null;
- private XMembersCombo userCombo;
- private XCheckBox includeCancelledCheckbox;
- private XCheckBox includeCompletedCheckbox;
- private XCheckBox assigneeCheckbox;
- private XCheckBox favoriteCheckbox;
- private XCheckBox subscribedCheckbox;
- private XCheckBox originatorCheckbox;
- private XCheckBox reviewsCheckbox;
- private XCheckBox teamWorkflowsCheckbox;
- private XCheckBox tasksCheckbox;
-
- public UserSearchWorkflowSearchItem() throws OseeArgumentException {
- super("User Search", FrameworkImage.USER);
- }
-
- public UserSearchWorkflowSearchItem(UserSearchWorkflowSearchItem editTeamWorkflowSearchItem) throws OseeArgumentException {
- super(editTeamWorkflowSearchItem, FrameworkImage.USER);
- }
-
- @Override
- public UserSearchWorkflowSearchItem copy() throws OseeArgumentException {
- return new UserSearchWorkflowSearchItem(this);
- }
-
- public UserSearchWorkflowSearchItem copyProvider() throws OseeArgumentException {
- return new UserSearchWorkflowSearchItem(this);
- }
-
- @Override
- public String getParameterXWidgetXml() throws OseeCoreException {
- return "<xWidgets>" +
- //
- "<XWidget xwidgetType=\"XMembersCombo\" beginComposite=\"14\" displayName=\"User\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Assignee\" xwidgetType=\"XCheckBox\" defaultValue=\"true\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Originated\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Subscribed\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Favorites\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Include Team Workflows\" xwidgetType=\"XCheckBox\" defaultValue=\"true\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Include Reviews\" xwidgetType=\"XCheckBox\" defaultValue=\"true\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Include Tasks\" endComposite=\"true\" xwidgetType=\"XCheckBox\" defaultValue=\"true\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Version\" xwidgetType=\"XCombo()\" beginComposite=\"3\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Team Definitions(s)\" endComposite=\"true\" xwidgetType=\"XHyperlabelTeamDefinitionSelection\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Include Completed\" beginComposite=\"4\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget displayName=\"Include Cancelled\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "</xWidgets>";
- }
-
- @Override
- public Collection<? extends Artifact> performSearchGetResults(SearchType searchType) throws OseeCoreException {
- return new UserWorldSearchItem(
- getSelectedUser(),
- getSelectedTeamDefinitions(),
- (getSelectedVersionArtifact() != null ? Collections.singleton(getSelectedVersionArtifact()) : null),
- //
- (isAssigneeCheckbox() ? UserSearchOption.Assignee : UserSearchOption.None),
- (isFavoritesCheckbox() ? UserSearchOption.Favorites : UserSearchOption.None),
- (isOriginatedCheckbox() ? UserSearchOption.Originator : UserSearchOption.None),
- (isSubscribedCheckbox() ? UserSearchOption.Subscribed : UserSearchOption.None),
- (isReviewsCheckbox() ? UserSearchOption.IncludeReviews : UserSearchOption.None),
- (isTeamWorkflowsCheckbox() ? UserSearchOption.IncludeTeamWorkflows : UserSearchOption.None),
- (isTasksCheckbox() ? UserSearchOption.IncludeTasks : UserSearchOption.None),
- (isIncludeCancelledCheckbox() ? UserSearchOption.IncludeCancelled : UserSearchOption.None),
- (isIncludeCompletedCheckbox() ? UserSearchOption.IncludeCompleted : UserSearchOption.None)
-
- //
- ).performSearch();
- }
-
- @Override
- public String getSelectedName(SearchType searchType) throws OseeCoreException {
- StringBuffer sb = new StringBuffer();
- Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
- if (teamDefs.size() > 0) {
- sb.append(" - Teams: " + org.eclipse.osee.framework.jdk.core.util.Collections.toString(",", teamDefs));
- }
- if (getSelectedVersionArtifact() != null) {
- sb.append(" - Version: " + getSelectedVersionArtifact());
- }
- if (getSelectedUser() != null) {
- sb.append(" - User: " + getSelectedUser());
- }
- if (isIncludeCancelledCheckbox()) {
- sb.append(" - Include Cancelled");
- }
- if (isIncludeCompletedCheckbox()) {
- sb.append(" - Include Completed");
- }
- if (isAssigneeCheckbox()) {
- sb.append(" - Assignee");
- }
- if (isOriginatedCheckbox()) {
- sb.append(" - Originated");
- }
- if (isFavoritesCheckbox()) {
- sb.append(" - Favorites");
- }
- if (isSubscribedCheckbox()) {
- sb.append(" - Subscribed");
- }
- if (isReviewsCheckbox()) {
- sb.append(" - Reviews");
- }
- if (isTeamWorkflowsCheckbox()) {
- sb.append(" - Team Workflows");
- }
- if (isTasksCheckbox()) {
- sb.append(" - Tasks");
- }
- return Strings.truncate("User Search" + sb.toString(), WorldEditor.TITLE_MAX_LENGTH, true);
- }
-
- @Override
- public void widgetCreated(XWidget widget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
- if (widget.getLabel().equals("User")) {
- userCombo = (XMembersCombo) widget;
- }
- if (widget.getLabel().equals("Include Completed")) {
- includeCompletedCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Include Cancelled")) {
- includeCancelledCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Assignee")) {
- assigneeCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Favorites")) {
- favoriteCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Subscribed")) {
- subscribedCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Originated")) {
- originatorCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Include Team Workflows")) {
- teamWorkflowsCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Include Reviews")) {
- reviewsCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Include Tasks")) {
- tasksCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Version")) {
- versionCombo = (XCombo) widget;
- versionCombo.getComboBox().setVisibleItemCount(25);
- widget.setToolTip("Select Team to populate Version list");
- }
- if (widget.getLabel().equals("Team Definitions(s)")) {
- teamCombo = (XHyperlabelTeamDefinitionSelection) widget;
- teamCombo.addXModifiedListener(new XModifiedListener() {
- @Override
- public void widgetModified(XWidget widget) {
- if (versionCombo != null) {
- try {
- Collection<TeamDefinitionArtifact> teamDefArts = getSelectedTeamDefinitions();
- if (teamDefArts.isEmpty()) {
- versionCombo.setDataStrings(new String[] {});
- return;
- }
- TeamDefinitionArtifact teamDefHoldingVersions =
- teamDefArts.iterator().next().getTeamDefinitionHoldingVersions();
- if (teamDefHoldingVersions == null) {
- versionCombo.setDataStrings(new String[] {});
- return;
- }
- Collection<String> names =
- Artifacts.artNames(teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both));
- if (names.isEmpty()) {
- versionCombo.setDataStrings(new String[] {});
- return;
- }
- versionCombo.setDataStrings(names.toArray(new String[names.size()]));
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- });
- }
- }
-
- private User getSelectedUser() {
- if (userCombo == null) return null;
- return userCombo.getUser();
- }
-
- public void setSelectedUser(User user) {
- if (userCombo != null) userCombo.set(user);
- }
-
- public void setSelected(UserSearchOption userSearchOption, boolean set) {
- if (userSearchOption == UserSearchOption.Assignee) {
- assigneeCheckbox.set(set);
- } else if (userSearchOption == UserSearchOption.Favorites) {
- favoriteCheckbox.set(set);
- } else if (userSearchOption == UserSearchOption.Subscribed) {
- subscribedCheckbox.set(set);
- } else if (userSearchOption == UserSearchOption.Originator) {
- originatorCheckbox.set(set);
- } else if (userSearchOption == UserSearchOption.IncludeCancelled) {
- includeCancelledCheckbox.set(set);
- } else if (userSearchOption == UserSearchOption.IncludeCompleted) {
- includeCompletedCheckbox.set(set);
- } else if (userSearchOption == UserSearchOption.IncludeReviews) {
- reviewsCheckbox.set(set);
- } else if (userSearchOption == UserSearchOption.IncludeTeamWorkflows) {
- teamWorkflowsCheckbox.set(set);
- } else if (userSearchOption == UserSearchOption.IncludeTasks) {
- tasksCheckbox.set(set);
- } else {
- throw new IllegalStateException(String.format("Unhandled checkbox [%s]", userSearchOption));
- }
- }
-
- private boolean isIncludeCompletedCheckbox() {
- if (includeCompletedCheckbox == null) return false;
- return includeCompletedCheckbox.isSelected();
- }
-
- private boolean isIncludeCancelledCheckbox() {
- if (includeCancelledCheckbox == null) return false;
- return includeCancelledCheckbox.isSelected();
- }
-
- private boolean isAssigneeCheckbox() {
- if (assigneeCheckbox == null) return false;
- return assigneeCheckbox.isSelected();
- }
-
- private boolean isFavoritesCheckbox() {
- if (favoriteCheckbox == null) return false;
- return favoriteCheckbox.isSelected();
- }
-
- private boolean isOriginatedCheckbox() {
- if (originatorCheckbox == null) return false;
- return originatorCheckbox.isSelected();
- }
-
- private boolean isSubscribedCheckbox() {
- if (subscribedCheckbox == null) return false;
- return subscribedCheckbox.isSelected();
- }
-
- private boolean isTeamWorkflowsCheckbox() {
- if (teamWorkflowsCheckbox == null) return false;
- return teamWorkflowsCheckbox.isSelected();
- }
-
- private boolean isReviewsCheckbox() {
- if (reviewsCheckbox == null) return false;
- return reviewsCheckbox.isSelected();
- }
-
- private boolean isTasksCheckbox() {
- if (tasksCheckbox == null) return false;
- return tasksCheckbox.isSelected();
- }
-
- public void includeCompletedCheckbox(boolean selected) {
- if (includeCompletedCheckbox != null) includeCompletedCheckbox.set(selected);
- }
-
- public void includeCancelledCheckbox(boolean selected) {
- if (includeCancelledCheckbox != null) includeCancelledCheckbox.set(selected);
- }
-
- private VersionArtifact getSelectedVersionArtifact() throws OseeCoreException {
- if (versionCombo == null) return null;
- String versionStr = versionCombo.get();
- if (versionStr == null || versionStr.equals("")) return null;
- Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
- if (teamDefs.size() > 0) {
- TeamDefinitionArtifact teamDefHoldingVersions = teamDefs.iterator().next().getTeamDefinitionHoldingVersions();
- if (teamDefHoldingVersions == null) return null;
- for (VersionArtifact versionArtifact : teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both)) {
- if (versionArtifact.getName().equals(versionStr)) {
- return versionArtifact;
- }
- }
- }
- return null;
- }
-
- public void setVersion(String versionStr) {
- if (versionCombo != null && versionCombo.getInDataStrings() != null) {
- // should check if the version combo was populated
- if (versionCombo.getInDataStrings().length > 0) {
- versionCombo.set(versionStr);
- }
- }
- }
-
- public Collection<TeamDefinitionArtifact> getSelectedTeamDefinitions() throws OseeCoreException {
- if (teamCombo == null) return java.util.Collections.emptyList();
- return teamCombo.getSelectedTeamDefintions();
- }
-
- public void setSelectedTeamDefinitions(Set<TeamDefinitionArtifact> selectedTeamDefs) {
- if (teamCombo != null) {
- teamCombo.setSelectedTeamDefs(selectedTeamDefs);
- teamCombo.notifyXModifiedListeners();
- }
- }
-
- @Override
- public void createXWidgetLayoutData(DynamicXWidgetLayoutData layoutData, XWidget widget, FormToolkit toolkit, Artifact art, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
- }
-
- @Override
- public void widgetCreating(XWidget widget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
- }
-
- @Override
- public Result isParameterSelectionValid() throws OseeCoreException {
- try {
- User user = getSelectedUser();
- if (user == null) {
- return new Result("You must select at User.");
- }
- if (!isAssigneeCheckbox() && !isSubscribedCheckbox() && !isOriginatedCheckbox() && !isFavoritesCheckbox()) {
- return new Result("You must select one or more of Assigneed, Originated, Subscribed or Favorites");
- }
- if (!isTeamWorkflowsCheckbox() && !isReviewsCheckbox() && !isTasksCheckbox()) {
- return new Result("You must select one or more of Team Workflows, Reviews or Tasks");
- }
- return Result.TrueResult;
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return new Result("Exception: " + ex.getLocalizedMessage());
- }
- }
-
- @Override
- public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
- return null;
- }
-
- @Override
- public VersionArtifact getTargetedVersionArtifact() throws OseeCoreException {
- if (versionCombo == null) return null;
- return getSelectedVersionArtifact();
- }
-
-}
+/*******************************************************************************
+ * 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.ats.navigate;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact.VersionReleaseType;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.XHyperlabelTeamDefinitionSelection;
+import org.eclipse.osee.ats.world.WorldEditor;
+import org.eclipse.osee.ats.world.WorldEditorParameterSearchItem;
+import org.eclipse.osee.ats.world.search.UserWorldSearchItem;
+import org.eclipse.osee.ats.world.search.UserWorldSearchItem.UserSearchOption;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
+import org.eclipse.osee.framework.ui.skynet.widgets.XCombo;
+import org.eclipse.osee.framework.ui.skynet.widgets.XMembersCombo;
+import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UserSearchWorkflowSearchItem extends WorldEditorParameterSearchItem {
+
+ private XHyperlabelTeamDefinitionSelection teamCombo = null;
+ private XCombo versionCombo = null;
+ private XMembersCombo userCombo;
+ private XCheckBox includeCancelledCheckbox;
+ private XCheckBox includeCompletedCheckbox;
+ private XCheckBox assigneeCheckbox;
+ private XCheckBox favoriteCheckbox;
+ private XCheckBox subscribedCheckbox;
+ private XCheckBox originatorCheckbox;
+ private XCheckBox reviewsCheckbox;
+ private XCheckBox teamWorkflowsCheckbox;
+ private XCheckBox tasksCheckbox;
+
+ public UserSearchWorkflowSearchItem() throws OseeArgumentException {
+ super("User Search", FrameworkImage.USER);
+ }
+
+ public UserSearchWorkflowSearchItem(UserSearchWorkflowSearchItem editTeamWorkflowSearchItem) throws OseeArgumentException {
+ super(editTeamWorkflowSearchItem, FrameworkImage.USER);
+ }
+
+ @Override
+ public UserSearchWorkflowSearchItem copy() throws OseeArgumentException {
+ return new UserSearchWorkflowSearchItem(this);
+ }
+
+ public UserSearchWorkflowSearchItem copyProvider() throws OseeArgumentException {
+ return new UserSearchWorkflowSearchItem(this);
+ }
+
+ @Override
+ public String getParameterXWidgetXml() throws OseeCoreException {
+ return "<xWidgets>" +
+ //
+ "<XWidget xwidgetType=\"XMembersCombo\" beginComposite=\"14\" displayName=\"User\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Assignee\" xwidgetType=\"XCheckBox\" defaultValue=\"true\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Originated\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Subscribed\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Favorites\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Include Team Workflows\" xwidgetType=\"XCheckBox\" defaultValue=\"true\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Include Reviews\" xwidgetType=\"XCheckBox\" defaultValue=\"true\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Include Tasks\" endComposite=\"true\" xwidgetType=\"XCheckBox\" defaultValue=\"true\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Version\" xwidgetType=\"XCombo()\" beginComposite=\"3\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Team Definitions(s)\" endComposite=\"true\" xwidgetType=\"XHyperlabelTeamDefinitionSelection\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Include Completed\" beginComposite=\"4\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget displayName=\"Include Cancelled\" xwidgetType=\"XCheckBox\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "</xWidgets>";
+ }
+
+ @Override
+ public Collection<? extends Artifact> performSearchGetResults(SearchType searchType) throws OseeCoreException {
+ return new UserWorldSearchItem(
+ getSelectedUser(),
+ getSelectedTeamDefinitions(),
+ (getSelectedVersionArtifact() != null ? Collections.singleton(getSelectedVersionArtifact()) : null),
+ //
+ (isAssigneeCheckbox() ? UserSearchOption.Assignee : UserSearchOption.None),
+ (isFavoritesCheckbox() ? UserSearchOption.Favorites : UserSearchOption.None),
+ (isOriginatedCheckbox() ? UserSearchOption.Originator : UserSearchOption.None),
+ (isSubscribedCheckbox() ? UserSearchOption.Subscribed : UserSearchOption.None),
+ (isReviewsCheckbox() ? UserSearchOption.IncludeReviews : UserSearchOption.None),
+ (isTeamWorkflowsCheckbox() ? UserSearchOption.IncludeTeamWorkflows : UserSearchOption.None),
+ (isTasksCheckbox() ? UserSearchOption.IncludeTasks : UserSearchOption.None),
+ (isIncludeCancelledCheckbox() ? UserSearchOption.IncludeCancelled : UserSearchOption.None),
+ (isIncludeCompletedCheckbox() ? UserSearchOption.IncludeCompleted : UserSearchOption.None)
+
+ //
+ ).performSearch();
+ }
+
+ @Override
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
+ StringBuffer sb = new StringBuffer();
+ Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
+ if (teamDefs.size() > 0) {
+ sb.append(" - Teams: " + org.eclipse.osee.framework.jdk.core.util.Collections.toString(",", teamDefs));
+ }
+ if (getSelectedVersionArtifact() != null) {
+ sb.append(" - Version: " + getSelectedVersionArtifact());
+ }
+ if (getSelectedUser() != null) {
+ sb.append(" - User: " + getSelectedUser());
+ }
+ if (isIncludeCancelledCheckbox()) {
+ sb.append(" - Include Cancelled");
+ }
+ if (isIncludeCompletedCheckbox()) {
+ sb.append(" - Include Completed");
+ }
+ if (isAssigneeCheckbox()) {
+ sb.append(" - Assignee");
+ }
+ if (isOriginatedCheckbox()) {
+ sb.append(" - Originated");
+ }
+ if (isFavoritesCheckbox()) {
+ sb.append(" - Favorites");
+ }
+ if (isSubscribedCheckbox()) {
+ sb.append(" - Subscribed");
+ }
+ if (isReviewsCheckbox()) {
+ sb.append(" - Reviews");
+ }
+ if (isTeamWorkflowsCheckbox()) {
+ sb.append(" - Team Workflows");
+ }
+ if (isTasksCheckbox()) {
+ sb.append(" - Tasks");
+ }
+ return Strings.truncate("User Search" + sb.toString(), WorldEditor.TITLE_MAX_LENGTH, true);
+ }
+
+ @Override
+ public void widgetCreated(XWidget widget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
+ if (widget.getLabel().equals("User")) {
+ userCombo = (XMembersCombo) widget;
+ }
+ if (widget.getLabel().equals("Include Completed")) {
+ includeCompletedCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Include Cancelled")) {
+ includeCancelledCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Assignee")) {
+ assigneeCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Favorites")) {
+ favoriteCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Subscribed")) {
+ subscribedCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Originated")) {
+ originatorCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Include Team Workflows")) {
+ teamWorkflowsCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Include Reviews")) {
+ reviewsCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Include Tasks")) {
+ tasksCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Version")) {
+ versionCombo = (XCombo) widget;
+ versionCombo.getComboBox().setVisibleItemCount(25);
+ widget.setToolTip("Select Team to populate Version list");
+ }
+ if (widget.getLabel().equals("Team Definitions(s)")) {
+ teamCombo = (XHyperlabelTeamDefinitionSelection) widget;
+ teamCombo.addXModifiedListener(new XModifiedListener() {
+ @Override
+ public void widgetModified(XWidget widget) {
+ if (versionCombo != null) {
+ try {
+ Collection<TeamDefinitionArtifact> teamDefArts = getSelectedTeamDefinitions();
+ if (teamDefArts.isEmpty()) {
+ versionCombo.setDataStrings(new String[] {});
+ return;
+ }
+ TeamDefinitionArtifact teamDefHoldingVersions =
+ teamDefArts.iterator().next().getTeamDefinitionHoldingVersions();
+ if (teamDefHoldingVersions == null) {
+ versionCombo.setDataStrings(new String[] {});
+ return;
+ }
+ Collection<String> names =
+ Artifacts.artNames(teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both));
+ if (names.isEmpty()) {
+ versionCombo.setDataStrings(new String[] {});
+ return;
+ }
+ versionCombo.setDataStrings(names.toArray(new String[names.size()]));
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ private User getSelectedUser() {
+ if (userCombo == null) return null;
+ return userCombo.getUser();
+ }
+
+ public void setSelectedUser(User user) {
+ if (userCombo != null) userCombo.set(user);
+ }
+
+ public void setSelected(UserSearchOption userSearchOption, boolean set) {
+ if (userSearchOption == UserSearchOption.Assignee) {
+ assigneeCheckbox.set(set);
+ } else if (userSearchOption == UserSearchOption.Favorites) {
+ favoriteCheckbox.set(set);
+ } else if (userSearchOption == UserSearchOption.Subscribed) {
+ subscribedCheckbox.set(set);
+ } else if (userSearchOption == UserSearchOption.Originator) {
+ originatorCheckbox.set(set);
+ } else if (userSearchOption == UserSearchOption.IncludeCancelled) {
+ includeCancelledCheckbox.set(set);
+ } else if (userSearchOption == UserSearchOption.IncludeCompleted) {
+ includeCompletedCheckbox.set(set);
+ } else if (userSearchOption == UserSearchOption.IncludeReviews) {
+ reviewsCheckbox.set(set);
+ } else if (userSearchOption == UserSearchOption.IncludeTeamWorkflows) {
+ teamWorkflowsCheckbox.set(set);
+ } else if (userSearchOption == UserSearchOption.IncludeTasks) {
+ tasksCheckbox.set(set);
+ } else {
+ throw new IllegalStateException(String.format("Unhandled checkbox [%s]", userSearchOption));
+ }
+ }
+
+ private boolean isIncludeCompletedCheckbox() {
+ if (includeCompletedCheckbox == null) return false;
+ return includeCompletedCheckbox.isSelected();
+ }
+
+ private boolean isIncludeCancelledCheckbox() {
+ if (includeCancelledCheckbox == null) return false;
+ return includeCancelledCheckbox.isSelected();
+ }
+
+ private boolean isAssigneeCheckbox() {
+ if (assigneeCheckbox == null) return false;
+ return assigneeCheckbox.isSelected();
+ }
+
+ private boolean isFavoritesCheckbox() {
+ if (favoriteCheckbox == null) return false;
+ return favoriteCheckbox.isSelected();
+ }
+
+ private boolean isOriginatedCheckbox() {
+ if (originatorCheckbox == null) return false;
+ return originatorCheckbox.isSelected();
+ }
+
+ private boolean isSubscribedCheckbox() {
+ if (subscribedCheckbox == null) return false;
+ return subscribedCheckbox.isSelected();
+ }
+
+ private boolean isTeamWorkflowsCheckbox() {
+ if (teamWorkflowsCheckbox == null) return false;
+ return teamWorkflowsCheckbox.isSelected();
+ }
+
+ private boolean isReviewsCheckbox() {
+ if (reviewsCheckbox == null) return false;
+ return reviewsCheckbox.isSelected();
+ }
+
+ private boolean isTasksCheckbox() {
+ if (tasksCheckbox == null) return false;
+ return tasksCheckbox.isSelected();
+ }
+
+ public void includeCompletedCheckbox(boolean selected) {
+ if (includeCompletedCheckbox != null) includeCompletedCheckbox.set(selected);
+ }
+
+ public void includeCancelledCheckbox(boolean selected) {
+ if (includeCancelledCheckbox != null) includeCancelledCheckbox.set(selected);
+ }
+
+ private VersionArtifact getSelectedVersionArtifact() throws OseeCoreException {
+ if (versionCombo == null) return null;
+ String versionStr = versionCombo.get();
+ if (versionStr == null || versionStr.equals("")) return null;
+ Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
+ if (teamDefs.size() > 0) {
+ TeamDefinitionArtifact teamDefHoldingVersions = teamDefs.iterator().next().getTeamDefinitionHoldingVersions();
+ if (teamDefHoldingVersions == null) return null;
+ for (VersionArtifact versionArtifact : teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both)) {
+ if (versionArtifact.getName().equals(versionStr)) {
+ return versionArtifact;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void setVersion(String versionStr) {
+ if (versionCombo != null && versionCombo.getInDataStrings() != null) {
+ // should check if the version combo was populated
+ if (versionCombo.getInDataStrings().length > 0) {
+ versionCombo.set(versionStr);
+ }
+ }
+ }
+
+ public Collection<TeamDefinitionArtifact> getSelectedTeamDefinitions() throws OseeCoreException {
+ if (teamCombo == null) return java.util.Collections.emptyList();
+ return teamCombo.getSelectedTeamDefintions();
+ }
+
+ public void setSelectedTeamDefinitions(Set<TeamDefinitionArtifact> selectedTeamDefs) {
+ if (teamCombo != null) {
+ teamCombo.setSelectedTeamDefs(selectedTeamDefs);
+ teamCombo.notifyXModifiedListeners();
+ }
+ }
+
+ @Override
+ public void createXWidgetLayoutData(DynamicXWidgetLayoutData layoutData, XWidget widget, FormToolkit toolkit, Artifact art, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
+ }
+
+ @Override
+ public void widgetCreating(XWidget widget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
+ }
+
+ @Override
+ public Result isParameterSelectionValid() throws OseeCoreException {
+ try {
+ User user = getSelectedUser();
+ if (user == null) {
+ return new Result("You must select at User.");
+ }
+ if (!isAssigneeCheckbox() && !isSubscribedCheckbox() && !isOriginatedCheckbox() && !isFavoritesCheckbox()) {
+ return new Result("You must select one or more of Assigneed, Originated, Subscribed or Favorites");
+ }
+ if (!isTeamWorkflowsCheckbox() && !isReviewsCheckbox() && !isTasksCheckbox()) {
+ return new Result("You must select one or more of Team Workflows, Reviews or Tasks");
+ }
+ return Result.TrueResult;
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return new Result("Exception: " + ex.getLocalizedMessage());
+ }
+ }
+
+ @Override
+ public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
+ return null;
+ }
+
+ @Override
+ public VersionArtifact getTargetedVersionArtifact() throws OseeCoreException {
+ if (versionCombo == null) return null;
+ return getSelectedVersionArtifact();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotification.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotification.java
index aadaab2dc1c..d91dfa69e3c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotification.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/notify/AtsNotification.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.ats.notify;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.osgi.framework.Bundle;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNotification {
-
- private static Set<IAtsNotification> atsNotificationItems = new HashSet<IAtsNotification>();
- private static AtsNotification instance = new AtsNotification();
-
- private AtsNotification() {
- instance = this;
-
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.osee.ats.AtsNotification");
- if (point == null) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't access AtsNotification extension point");
- return;
- }
- IExtension[] extensions = point.getExtensions();
- for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- String classname = null;
- String bundleName = null;
- for (IConfigurationElement el : elements) {
- if (el.getName().equals("AtsNotification")) {
- classname = el.getAttribute("classname");
- bundleName = el.getContributor().getName();
- if (classname != null && bundleName != null) {
- Bundle bundle = Platform.getBundle(bundleName);
- try {
- Class<?> taskClass = bundle.loadClass(classname);
- Object obj = taskClass.newInstance();
- atsNotificationItems.add((IAtsNotification) obj);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Error loading AtsNotification extension", ex);
- }
- }
- }
- }
- }
- }
-
- public static AtsNotification getInstance() {
- return instance;
- }
-
- public Set<IAtsNotification> getAtsNotifications() {
- return atsNotificationItems;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.notify;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNotification {
+
+ private static Set<IAtsNotification> atsNotificationItems = new HashSet<IAtsNotification>();
+ private static AtsNotification instance = new AtsNotification();
+
+ private AtsNotification() {
+ instance = this;
+
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.osee.ats.AtsNotification");
+ if (point == null) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't access AtsNotification extension point");
+ return;
+ }
+ IExtension[] extensions = point.getExtensions();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ String classname = null;
+ String bundleName = null;
+ for (IConfigurationElement el : elements) {
+ if (el.getName().equals("AtsNotification")) {
+ classname = el.getAttribute("classname");
+ bundleName = el.getContributor().getName();
+ if (classname != null && bundleName != null) {
+ Bundle bundle = Platform.getBundle(bundleName);
+ try {
+ Class<?> taskClass = bundle.loadClass(classname);
+ Object obj = taskClass.newInstance();
+ atsNotificationItems.add((IAtsNotification) obj);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Error loading AtsNotification extension", ex);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public static AtsNotification getInstance() {
+ return instance;
+ }
+
+ public Set<IAtsNotification> getAtsNotifications() {
+ return atsNotificationItems;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/CompleteMultipleWorkflows.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/CompleteMultipleWorkflows.java
index 50cff53807e..144ce248315 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/CompleteMultipleWorkflows.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/CompleteMultipleWorkflows.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * 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.ats.operation;
-
-import java.util.Collection;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact.TransitionOption;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.world.WorldEditor;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class CompleteMultipleWorkflows extends Action {
-
- private static final boolean enableEmail = false;
- private final WorldEditor worldEditor;
-
- public CompleteMultipleWorkflows(WorldEditor worldEditor) {
- this.worldEditor = worldEditor;
- setText("Complete Selected Workflows");
- }
-
- @Override
- public void run() {
- try {
- Collection<StateMachineArtifact> smas = worldEditor.getWorldComposite().getXViewer().getSelectedSMAArtifacts();
- if (smas.isEmpty()) {
- AWorkbench.popup("ERROR", "Must select one or more workflows");
- return;
- }
- for (StateMachineArtifact sma : smas) {
- Result result = sma.isTransitionValid(DefaultTeamState.Completed.name(), null, TransitionOption.None);
- if (result.isFalse()) {
- result.popup();
- return;
- }
- }
- EntryDialog ed = new EntryDialog("Complete Workflows", "Enter Completion Reson");
- if (ed.open() == 0) {
- try {
- AtsUtil.setEmailEnabled(enableEmail);
- SkynetTransaction transaction =
- new SkynetTransaction(AtsUtil.getAtsBranch(), "Complete Multiple Workflows");
- for (StateMachineArtifact sma : smas) {
- Result result = sma.transitionToCompleted(ed.getEntry(), transaction, TransitionOption.Persist);
- if (result.isFalse()) {
- result.popup();
- return;
- }
- }
- transaction.execute();
- AWorkbench.popup("Complete", "Workflows Completed");
- } finally {
- AtsUtil.setEmailEnabled(true);
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS);
- }
-}
+/*******************************************************************************
+ * 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.ats.operation;
+
+import java.util.Collection;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact.TransitionOption;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.world.WorldEditor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CompleteMultipleWorkflows extends Action {
+
+ private static final boolean enableEmail = false;
+ private final WorldEditor worldEditor;
+
+ public CompleteMultipleWorkflows(WorldEditor worldEditor) {
+ this.worldEditor = worldEditor;
+ setText("Complete Selected Workflows");
+ }
+
+ @Override
+ public void run() {
+ try {
+ Collection<StateMachineArtifact> smas = worldEditor.getWorldComposite().getXViewer().getSelectedSMAArtifacts();
+ if (smas.isEmpty()) {
+ AWorkbench.popup("ERROR", "Must select one or more workflows");
+ return;
+ }
+ for (StateMachineArtifact sma : smas) {
+ Result result = sma.isTransitionValid(DefaultTeamState.Completed.name(), null, TransitionOption.None);
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ }
+ EntryDialog ed = new EntryDialog("Complete Workflows", "Enter Completion Reson");
+ if (ed.open() == 0) {
+ try {
+ AtsUtil.setEmailEnabled(enableEmail);
+ SkynetTransaction transaction =
+ new SkynetTransaction(AtsUtil.getAtsBranch(), "Complete Multiple Workflows");
+ for (StateMachineArtifact sma : smas) {
+ Result result = sma.transitionToCompleted(ed.getEntry(), transaction, TransitionOption.Persist);
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ }
+ transaction.execute();
+ AWorkbench.popup("Complete", "Workflows Completed");
+ } finally {
+ AtsUtil.setEmailEnabled(true);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSpreadsheet.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSpreadsheet.java
index cd1f74cf7a5..b0e54aa3423 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSpreadsheet.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ImportTasksFromSpreadsheet.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * 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.ats.operation;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.editor.SMAEditor;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.Import.ExcelAtsTaskArtifactExtractor;
-import org.eclipse.osee.ats.util.Import.TaskImportJob;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.Jobs;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer;
-import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Donald G. Dunne
- */
-public class ImportTasksFromSpreadsheet extends AbstractBlam {
-
- public static String TASK_IMPORT_SPREADSHEET = "Task Import Spreadsheet";
- public static String TEAM_WORKFLOW = "Taskable Workflow (drop here)";
- public static String EMAIL_POCS = "Email POCs";
- private TaskableStateMachineArtifact taskableStateMachineArtifact;
-
- @Override
- public String getName() {
- return "Import Tasks From Spreadsheet";
- }
-
- @Override
- public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
- super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, modListener, isEditable);
- if (xWidget.getLabel().equals(TEAM_WORKFLOW) && taskableStateMachineArtifact != null) {
- XListDropViewer viewer = (XListDropViewer) xWidget;
- viewer.setInput(Arrays.asList(taskableStateMachineArtifact));
- }
- }
-
- @Override
- public String getXWidgetsXml() {
- StringBuffer buffer = new StringBuffer("<xWidgets>");
- buffer.append("<XWidget xwidgetType=\"XListDropViewer\" displayName=\"" + TEAM_WORKFLOW + "\" />");
- buffer.append("<XWidget xwidgetType=\"XFileSelectionDialog\" displayName=\"" + TASK_IMPORT_SPREADSHEET + "\" />");
- buffer.append("<XWidget xwidgetType=\"XCheckBox\" displayName=\"" + EMAIL_POCS + "\" labelAfter=\"true\" horizontalLabel=\"true\"/>");
- buffer.append("</xWidgets>");
- return buffer.toString();
- }
-
- @Override
- public String getDescriptionUsage() {
- return "Import tasks from spreadsheet into given Team Workflow";
- }
-
- /**
- * @return the TaskableStateMachineArtifact
- */
- public TaskableStateMachineArtifact getTaskableStateMachineArtifact() {
- return taskableStateMachineArtifact;
- }
-
- /**
- * @param taskableStateMachineArtifact the TaskableStateMachineArtifact to set
- */
- public void setTaskableStateMachineArtifact(TaskableStateMachineArtifact taskableStateMachineArtifact) {
- this.taskableStateMachineArtifact = taskableStateMachineArtifact;
- }
-
- @Override
- public void runOperation(final VariableMap variableMap, IProgressMonitor monitor) throws Exception {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- List<Artifact> artifacts = variableMap.getArtifacts(TEAM_WORKFLOW);
- String filename = variableMap.getString(TASK_IMPORT_SPREADSHEET);
- boolean emailPocs = variableMap.getBoolean(EMAIL_POCS);
-
- if (artifacts.isEmpty()) {
- AWorkbench.popup("ERROR", "Must drag in Team Workflow to add tasks.");
- return;
- }
- if (artifacts.size() > 1) {
- AWorkbench.popup("ERROR", "Only drag ONE Team Workflow.");
- return;
- }
- Artifact artifact = artifacts.iterator().next();
- if (!(artifact instanceof TeamWorkFlowArtifact)) {
- AWorkbench.popup("ERROR", "Artifact MUST be Team Workflow");
- return;
- }
- if (filename == null || filename.equals("")) {
- AWorkbench.popup("ERROR", "Must enter valid filename.");
- return;
- }
- File file = new File(filename);
- try {
- SkynetTransaction transaction =
- new SkynetTransaction(AtsUtil.getAtsBranch(), "Import Tasks from Spreadsheet");
- Job job =
- Jobs.startJob(new TaskImportJob(file, new ExcelAtsTaskArtifactExtractor(
- (TeamWorkFlowArtifact) artifact, emailPocs, transaction)));
- job.join();
- transaction.execute();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
-
- SMAEditor.editArtifact(artifact);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- };
- });
- }
-
- public Collection<String> getCategories() {
- return Arrays.asList("ATS");
- }
+/*******************************************************************************
+ * 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.ats.operation;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.editor.SMAEditor;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.Import.ExcelAtsTaskArtifactExtractor;
+import org.eclipse.osee.ats.util.Import.TaskImportJob;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ImportTasksFromSpreadsheet extends AbstractBlam {
+
+ public static String TASK_IMPORT_SPREADSHEET = "Task Import Spreadsheet";
+ public static String TEAM_WORKFLOW = "Taskable Workflow (drop here)";
+ public static String EMAIL_POCS = "Email POCs";
+ private TaskableStateMachineArtifact taskableStateMachineArtifact;
+
+ @Override
+ public String getName() {
+ return "Import Tasks From Spreadsheet";
+ }
+
+ @Override
+ public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
+ super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, modListener, isEditable);
+ if (xWidget.getLabel().equals(TEAM_WORKFLOW) && taskableStateMachineArtifact != null) {
+ XListDropViewer viewer = (XListDropViewer) xWidget;
+ viewer.setInput(Arrays.asList(taskableStateMachineArtifact));
+ }
+ }
+
+ @Override
+ public String getXWidgetsXml() {
+ StringBuffer buffer = new StringBuffer("<xWidgets>");
+ buffer.append("<XWidget xwidgetType=\"XListDropViewer\" displayName=\"" + TEAM_WORKFLOW + "\" />");
+ buffer.append("<XWidget xwidgetType=\"XFileSelectionDialog\" displayName=\"" + TASK_IMPORT_SPREADSHEET + "\" />");
+ buffer.append("<XWidget xwidgetType=\"XCheckBox\" displayName=\"" + EMAIL_POCS + "\" labelAfter=\"true\" horizontalLabel=\"true\"/>");
+ buffer.append("</xWidgets>");
+ return buffer.toString();
+ }
+
+ @Override
+ public String getDescriptionUsage() {
+ return "Import tasks from spreadsheet into given Team Workflow";
+ }
+
+ /**
+ * @return the TaskableStateMachineArtifact
+ */
+ public TaskableStateMachineArtifact getTaskableStateMachineArtifact() {
+ return taskableStateMachineArtifact;
+ }
+
+ /**
+ * @param taskableStateMachineArtifact the TaskableStateMachineArtifact to set
+ */
+ public void setTaskableStateMachineArtifact(TaskableStateMachineArtifact taskableStateMachineArtifact) {
+ this.taskableStateMachineArtifact = taskableStateMachineArtifact;
+ }
+
+ @Override
+ public void runOperation(final VariableMap variableMap, IProgressMonitor monitor) throws Exception {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ List<Artifact> artifacts = variableMap.getArtifacts(TEAM_WORKFLOW);
+ String filename = variableMap.getString(TASK_IMPORT_SPREADSHEET);
+ boolean emailPocs = variableMap.getBoolean(EMAIL_POCS);
+
+ if (artifacts.isEmpty()) {
+ AWorkbench.popup("ERROR", "Must drag in Team Workflow to add tasks.");
+ return;
+ }
+ if (artifacts.size() > 1) {
+ AWorkbench.popup("ERROR", "Only drag ONE Team Workflow.");
+ return;
+ }
+ Artifact artifact = artifacts.iterator().next();
+ if (!(artifact instanceof TeamWorkFlowArtifact)) {
+ AWorkbench.popup("ERROR", "Artifact MUST be Team Workflow");
+ return;
+ }
+ if (filename == null || filename.equals("")) {
+ AWorkbench.popup("ERROR", "Must enter valid filename.");
+ return;
+ }
+ File file = new File(filename);
+ try {
+ SkynetTransaction transaction =
+ new SkynetTransaction(AtsUtil.getAtsBranch(), "Import Tasks from Spreadsheet");
+ Job job =
+ Jobs.startJob(new TaskImportJob(file, new ExcelAtsTaskArtifactExtractor(
+ (TeamWorkFlowArtifact) artifact, emailPocs, transaction)));
+ job.join();
+ transaction.execute();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+
+ SMAEditor.editArtifact(artifact);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ };
+ });
+ }
+
+ public Collection<String> getCategories() {
+ return Arrays.asList("ATS");
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java
index 1782e4f9335..e673546571d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/PurgeUser.java
@@ -1,190 +1,190 @@
-/*******************************************************************************
- * 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.ats.operation;
-
-import java.util.Arrays;
-import java.util.Collection;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.DbTransaction;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Megumi Telles
- */
-public class PurgeUser extends AbstractBlam {
-
- public static String FROM_USER = "From User";
- public static String TO_USER = "To User";
- private static int numOfAuthoredTransactions = 0;
- private static int numOfASideRelations = 0;
- private static int numOfBSideRelations = 0;
- private static int numOfUpdatedAuthoredTransactions = 0;
- private static int numOfUpdatedASideRelations = 0;
- private static int numOfUpdatedBSideRelations = 0;
-
- private static final int defaultUpdateValue = -1;
-
- private static final String GET_AUTHORED_TRANSACTIONS = "SELECT count(1) from osee_tx_details where author=?";
- private static final String GET_RELATIONS_ASIDE = "SELECT count(1) from osee_relation_link where a_art_id=?";
- private static final String GET_RELATIONS_BSIDE = "SELECT count(1) from osee_relation_link where b_art_id=?";
- private static final String UPDATE_AUTHORED_TRANSACTIONS = "update osee_tx_details set author=? where author=?";
- private static final String UPDATE_RELATIONS_ASIDE = "update osee_relation_link set a_art_id=? where a_art_id=?";
- private static final String UPDATE_RELATIONS_BSIDE = "update osee_relation_link set b_art_id=? where b_art_id=?";
-
- @Override
- public String getName() {
- return "Purge User";
- }
-
- @Override
- public void runOperation(final VariableMap variableMap, IProgressMonitor monitor) throws OseeCoreException {
- final IProgressMonitor mon = monitor;
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- //TODO Allow for multiple users to be selected at one time.
- final User fromUser = variableMap.getUser(FROM_USER);
- if (fromUser == null) {
- AWorkbench.popup("ERROR", "Please select From User");
- return;
- }
-
- final User toUser = variableMap.getUser(TO_USER);
- if (toUser == null) {
- AWorkbench.popup("ERROR", "Please select To User");
- return;
- }
- //handle roll-backs and exception handling
- new DbTransaction() {
- @Override
- protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
- // start replacing all transactions, relations, etc.
- findAndUpdateAuthoredTransactions(connection, fromUser, toUser);
- findAndUpdateRelations(connection, fromUser, toUser);
- }
- }.execute();
- // confirm deletion of artifact
- confirmDeletionOfArtifact(fromUser);
- // output results
- displayReport(mon, toUser, fromUser);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- } finally {
- numOfAuthoredTransactions = 0;
- numOfASideRelations = 0;
- numOfBSideRelations = 0;
- numOfUpdatedAuthoredTransactions = 0;
- numOfUpdatedASideRelations = 0;
- numOfUpdatedBSideRelations = 0;
- }
- };
- });
- }
-
- private void confirmDeletionOfArtifact(final User fromUser) throws OseeCoreException {
- if (MessageDialog.openConfirm(Displays.getActiveShell(), "Persist Confirmation",
- "Do you wish to delete the duplicate User: " + fromUser.getName() + "?")) {
- deleteArtifact(fromUser);
- }
- }
-
- private void findAndUpdateAuthoredTransactions(OseeConnection connection, final User fromUser, final User toUser) throws OseeDataStoreException {
- numOfAuthoredTransactions =
- ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_AUTHORED_TRANSACTIONS,
- new Object[] {fromUser.getArtId()});
- numOfUpdatedAuthoredTransactions =
- ConnectionHandler.runPreparedUpdate(connection, UPDATE_AUTHORED_TRANSACTIONS, new Object[] {
- toUser.getArtId(), fromUser.getArtId()});
- }
-
- private void findAndUpdateRelations(OseeConnection connection, final User fromUser, final User toUser) throws OseeDataStoreException {
- updateRelationA(connection, fromUser, toUser);
- updateRelationB(connection, fromUser, toUser);
- }
-
- private void updateRelationA(OseeConnection connection, final User fromUser, final User toUser) throws OseeDataStoreException {
- numOfASideRelations =
- ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_RELATIONS_ASIDE,
- new Object[] {fromUser.getArtId()});
- numOfUpdatedASideRelations =
- ConnectionHandler.runPreparedUpdate(connection, UPDATE_RELATIONS_ASIDE, new Object[] {toUser.getArtId(),
- fromUser.getArtId()});
- }
-
- private void updateRelationB(OseeConnection connection, final User fromUser, final User toUser) throws OseeDataStoreException {
- numOfBSideRelations =
- ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_RELATIONS_BSIDE,
- new Object[] {fromUser.getArtId()});
- numOfUpdatedBSideRelations =
- ConnectionHandler.runPreparedUpdate(connection, UPDATE_RELATIONS_BSIDE, new Object[] {toUser.getArtId(),
- fromUser.getArtId()});
- }
-
- private void deleteArtifact(final User fromUser) throws OseeCoreException {
- Artifact art = ArtifactQuery.getArtifactFromId(fromUser.getArtId(), fromUser.getBranch());
- art.purgeFromBranch();
- }
-
- private void displayReport(IProgressMonitor monitor, User toUser, User fromUser) throws OseeCoreException {
- XResultData rd = new XResultData();
- try {
- String[] columnHeaders =
- new String[] {"FromUser", "FromUser ArtId", "ToUser", "ToUser ArtId", "Authored Transaction Hits",
- "Relation ASide Hits", "Relation BSide Hits", "Authored Transaction Updated",
- "Relation ASide Update", "Relation BSide Updated"};
- rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
- rd.addRaw(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {fromUser.getName(),
- Integer.toString(fromUser.getArtId()), toUser.getName(), Integer.toString(toUser.getArtId()),
- Integer.toString(numOfAuthoredTransactions), Integer.toString(numOfASideRelations),
- Integer.toString(numOfBSideRelations), Integer.toString(numOfUpdatedAuthoredTransactions),
- Integer.toString(numOfUpdatedASideRelations), Integer.toString(numOfUpdatedBSideRelations)}));
- rd.addRaw(AHTML.endMultiColumnTable());
- } finally {
- rd.report(getName());
- }
- }
-
- @Override
- public String getXWidgetsXml() {
- StringBuffer buffer = new StringBuffer("<xWidgets>");
- buffer.append("<XWidget xwidgetType=\"XMembersComboAll\" displayName=\"" + FROM_USER + "\" />");
- buffer.append("<XWidget xwidgetType=\"XMembersComboAll\" displayName=\"" + TO_USER + "\" />");
- buffer.append("</xWidgets>");
- return buffer.toString();
- }
-
- @Override
- public String getDescriptionUsage() {
- return "Purge the specified User. You will be prompted to choose which user to re-assign existing transactions and relations.";
- }
-
- @Override
- public Collection<String> getCategories() {
- return Arrays.asList("Admin");
- }
+/*******************************************************************************
+ * 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.ats.operation;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.DbTransaction;
+import org.eclipse.osee.framework.database.core.OseeConnection;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Megumi Telles
+ */
+public class PurgeUser extends AbstractBlam {
+
+ public static String FROM_USER = "From User";
+ public static String TO_USER = "To User";
+ private static int numOfAuthoredTransactions = 0;
+ private static int numOfASideRelations = 0;
+ private static int numOfBSideRelations = 0;
+ private static int numOfUpdatedAuthoredTransactions = 0;
+ private static int numOfUpdatedASideRelations = 0;
+ private static int numOfUpdatedBSideRelations = 0;
+
+ private static final int defaultUpdateValue = -1;
+
+ private static final String GET_AUTHORED_TRANSACTIONS = "SELECT count(1) from osee_tx_details where author=?";
+ private static final String GET_RELATIONS_ASIDE = "SELECT count(1) from osee_relation_link where a_art_id=?";
+ private static final String GET_RELATIONS_BSIDE = "SELECT count(1) from osee_relation_link where b_art_id=?";
+ private static final String UPDATE_AUTHORED_TRANSACTIONS = "update osee_tx_details set author=? where author=?";
+ private static final String UPDATE_RELATIONS_ASIDE = "update osee_relation_link set a_art_id=? where a_art_id=?";
+ private static final String UPDATE_RELATIONS_BSIDE = "update osee_relation_link set b_art_id=? where b_art_id=?";
+
+ @Override
+ public String getName() {
+ return "Purge User";
+ }
+
+ @Override
+ public void runOperation(final VariableMap variableMap, IProgressMonitor monitor) throws OseeCoreException {
+ final IProgressMonitor mon = monitor;
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ //TODO Allow for multiple users to be selected at one time.
+ final User fromUser = variableMap.getUser(FROM_USER);
+ if (fromUser == null) {
+ AWorkbench.popup("ERROR", "Please select From User");
+ return;
+ }
+
+ final User toUser = variableMap.getUser(TO_USER);
+ if (toUser == null) {
+ AWorkbench.popup("ERROR", "Please select To User");
+ return;
+ }
+ //handle roll-backs and exception handling
+ new DbTransaction() {
+ @Override
+ protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
+ // start replacing all transactions, relations, etc.
+ findAndUpdateAuthoredTransactions(connection, fromUser, toUser);
+ findAndUpdateRelations(connection, fromUser, toUser);
+ }
+ }.execute();
+ // confirm deletion of artifact
+ confirmDeletionOfArtifact(fromUser);
+ // output results
+ displayReport(mon, toUser, fromUser);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ } finally {
+ numOfAuthoredTransactions = 0;
+ numOfASideRelations = 0;
+ numOfBSideRelations = 0;
+ numOfUpdatedAuthoredTransactions = 0;
+ numOfUpdatedASideRelations = 0;
+ numOfUpdatedBSideRelations = 0;
+ }
+ };
+ });
+ }
+
+ private void confirmDeletionOfArtifact(final User fromUser) throws OseeCoreException {
+ if (MessageDialog.openConfirm(Displays.getActiveShell(), "Persist Confirmation",
+ "Do you wish to delete the duplicate User: " + fromUser.getName() + "?")) {
+ deleteArtifact(fromUser);
+ }
+ }
+
+ private void findAndUpdateAuthoredTransactions(OseeConnection connection, final User fromUser, final User toUser) throws OseeDataStoreException {
+ numOfAuthoredTransactions =
+ ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_AUTHORED_TRANSACTIONS,
+ new Object[] {fromUser.getArtId()});
+ numOfUpdatedAuthoredTransactions =
+ ConnectionHandler.runPreparedUpdate(connection, UPDATE_AUTHORED_TRANSACTIONS, new Object[] {
+ toUser.getArtId(), fromUser.getArtId()});
+ }
+
+ private void findAndUpdateRelations(OseeConnection connection, final User fromUser, final User toUser) throws OseeDataStoreException {
+ updateRelationA(connection, fromUser, toUser);
+ updateRelationB(connection, fromUser, toUser);
+ }
+
+ private void updateRelationA(OseeConnection connection, final User fromUser, final User toUser) throws OseeDataStoreException {
+ numOfASideRelations =
+ ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_RELATIONS_ASIDE,
+ new Object[] {fromUser.getArtId()});
+ numOfUpdatedASideRelations =
+ ConnectionHandler.runPreparedUpdate(connection, UPDATE_RELATIONS_ASIDE, new Object[] {toUser.getArtId(),
+ fromUser.getArtId()});
+ }
+
+ private void updateRelationB(OseeConnection connection, final User fromUser, final User toUser) throws OseeDataStoreException {
+ numOfBSideRelations =
+ ConnectionHandler.runPreparedQueryFetchInt(defaultUpdateValue, GET_RELATIONS_BSIDE,
+ new Object[] {fromUser.getArtId()});
+ numOfUpdatedBSideRelations =
+ ConnectionHandler.runPreparedUpdate(connection, UPDATE_RELATIONS_BSIDE, new Object[] {toUser.getArtId(),
+ fromUser.getArtId()});
+ }
+
+ private void deleteArtifact(final User fromUser) throws OseeCoreException {
+ Artifact art = ArtifactQuery.getArtifactFromId(fromUser.getArtId(), fromUser.getBranch());
+ art.purgeFromBranch();
+ }
+
+ private void displayReport(IProgressMonitor monitor, User toUser, User fromUser) throws OseeCoreException {
+ XResultData rd = new XResultData();
+ try {
+ String[] columnHeaders =
+ new String[] {"FromUser", "FromUser ArtId", "ToUser", "ToUser ArtId", "Authored Transaction Hits",
+ "Relation ASide Hits", "Relation BSide Hits", "Authored Transaction Updated",
+ "Relation ASide Update", "Relation BSide Updated"};
+ rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
+ rd.addRaw(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {fromUser.getName(),
+ Integer.toString(fromUser.getArtId()), toUser.getName(), Integer.toString(toUser.getArtId()),
+ Integer.toString(numOfAuthoredTransactions), Integer.toString(numOfASideRelations),
+ Integer.toString(numOfBSideRelations), Integer.toString(numOfUpdatedAuthoredTransactions),
+ Integer.toString(numOfUpdatedASideRelations), Integer.toString(numOfUpdatedBSideRelations)}));
+ rd.addRaw(AHTML.endMultiColumnTable());
+ } finally {
+ rd.report(getName());
+ }
+ }
+
+ @Override
+ public String getXWidgetsXml() {
+ StringBuffer buffer = new StringBuffer("<xWidgets>");
+ buffer.append("<XWidget xwidgetType=\"XMembersComboAll\" displayName=\"" + FROM_USER + "\" />");
+ buffer.append("<XWidget xwidgetType=\"XMembersComboAll\" displayName=\"" + TO_USER + "\" />");
+ buffer.append("</xWidgets>");
+ return buffer.toString();
+ }
+
+ @Override
+ public String getDescriptionUsage() {
+ return "Purge the specified User. You will be prompted to choose which user to re-assign existing transactions and relations.";
+ }
+
+ @Override
+ public Collection<String> getCategories() {
+ return Arrays.asList("Admin");
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/report/CreateActionArtifactChangeReportJob.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/report/CreateActionArtifactChangeReportJob.java
index a4b7782003f..30b351275b3 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/report/CreateActionArtifactChangeReportJob.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/report/CreateActionArtifactChangeReportJob.java
@@ -1,160 +1,160 @@
-/*******************************************************************************
- * 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.ats.report;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-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.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.commit.ICommitConfigArtifact;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeData.KindType;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-import org.eclipse.osee.framework.ui.skynet.util.HtmlExportTable;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Donald G. Dunne
- */
-public class CreateActionArtifactChangeReportJob extends Job {
- private final Set<TeamWorkFlowArtifact> teamArts;
- private final String byAttribute;
-
- public CreateActionArtifactChangeReportJob(String jobName, Set<TeamWorkFlowArtifact> teamArts, String byAttribute) {
- super(jobName);
- this.teamArts = teamArts;
- this.byAttribute = byAttribute;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- return runIt(monitor, getName(), teamArts, byAttribute);
- }
-
- public static IStatus runIt(IProgressMonitor monitor, String jobName, Collection<TeamWorkFlowArtifact> teamArts, String byAttribute) {
- XResultData rd = new XResultData();
- try {
- if (teamArts.isEmpty()) {
- throw new OseeStateException("No Actions/Workflows Specified");
- }
- retrieveData(monitor, teamArts, byAttribute, rd);
- if (rd.toString().equals("")) {
- rd.log("No Problems Found");
- }
- final String html = rd.getReport(jobName).getManipulatedHtml(Arrays.asList(Manipulations.NONE));
- final String title = jobName;
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- Result result = (new HtmlExportTable(title, html, true, false)).exportCsv();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- AWorkbench.popup(
- title,
- "Completed " + title + "\n\nFile saved to " + System.getProperty("user.home") + File.separator + "table.csv");
- }
- });
- monitor.done();
- return Status.OK_STATUS;
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, "Failed", ex);
- }
- }
-
- /**
- * used recursively when originally passed a directory, thus an array of files is accepted
- *
- * @throws Exception
- */
- private static void retrieveData(IProgressMonitor monitor, Collection<TeamWorkFlowArtifact> teamArts, String byAttribute, XResultData rd) throws OseeCoreException {
- monitor.subTask("Retrieving Actions");
-
- int x = 1;
- rd.addRaw(AHTML.beginMultiColumnTable(95));
- rd.addRaw(AHTML.addHeaderRowMultiColumnTable(new String[] {"HRID", "Bulld", "UI", byAttribute, "RPCR", "Change"}));
- for (TeamWorkFlowArtifact teamArt : teamArts) {
- String rcprId = teamArt.getSoleAttributeValue(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE.getStoreName(), "");
- String result =
- (String.format("Processing %s/%s RPCR %s for \"%s\"", x, teamArts.size(), rcprId,
- teamArt.getTeamDefinition().getName()));
- monitor.subTask(result);
- rd.log("\nRPCR " + rcprId);
- for (ICommitConfigArtifact commitConfigArt : teamArt.getBranchMgr().getConfigArtifactsConfiguredToCommitTo()) {
- processTeam(teamArt, commitConfigArt.getParentBranch().getShortName(), byAttribute, commitConfigArt, rd);
- }
- x++;
-
- // System.err.println("Developmental purposes only, don't release with this");
- // if (x >= 5)
- // break;
- }
- rd.addRaw(AHTML.endMultiColumnTable());
- }
-
- private static void processTeam(TeamWorkFlowArtifact teamArt, String buildId, String byAttribute, ICommitConfigArtifact commitConfigArt, XResultData rd) throws OseeCoreException {
- String rpcrNum = teamArt.getSoleAttributeValue(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE.getStoreName(), "");
- ChangeData changeData = teamArt.getBranchMgr().getChangeData(commitConfigArt);
- for (Artifact modArt : changeData.getArtifacts(KindType.Artifact, ModificationType.NEW, ModificationType.MODIFIED)) {
- List<String> attrStrs = modArt.getAttributesToStringList(byAttribute);
- if (attrStrs.isEmpty()) {
- attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
- }
- for (String attrStr : attrStrs) {
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {teamArt.getHumanReadableId(), buildId,
- modArt.getName(), attrStr, rpcrNum, "Content"}));
- }
- }
- for (Artifact artChg : changeData.getArtifacts(KindType.Artifact, ModificationType.DELETED)) {
- List<String> attrStrs = artChg.getAttributesToStringList(byAttribute);
- if (attrStrs.isEmpty()) {
- attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
- }
- for (String attrStr : attrStrs) {
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {teamArt.getHumanReadableId(), buildId,
- artChg.getName(), attrStr, rpcrNum, "Deleted"}));
- }
- }
- for (Artifact artChg : changeData.getArtifacts(KindType.RelationOnly, ModificationType.NEW,
- ModificationType.MODIFIED)) {
- List<String> attrStrs = artChg.getAttributesToStringList(byAttribute);
- if (attrStrs.isEmpty()) {
- attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
- }
- for (String attrStr : attrStrs) {
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {teamArt.getHumanReadableId(), buildId,
- artChg.getName(), attrStr, rpcrNum, "Relation"}));
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.report;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+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.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.commit.ICommitConfigArtifact;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeData.KindType;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
+import org.eclipse.osee.framework.ui.skynet.util.HtmlExportTable;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CreateActionArtifactChangeReportJob extends Job {
+ private final Set<TeamWorkFlowArtifact> teamArts;
+ private final String byAttribute;
+
+ public CreateActionArtifactChangeReportJob(String jobName, Set<TeamWorkFlowArtifact> teamArts, String byAttribute) {
+ super(jobName);
+ this.teamArts = teamArts;
+ this.byAttribute = byAttribute;
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ return runIt(monitor, getName(), teamArts, byAttribute);
+ }
+
+ public static IStatus runIt(IProgressMonitor monitor, String jobName, Collection<TeamWorkFlowArtifact> teamArts, String byAttribute) {
+ XResultData rd = new XResultData();
+ try {
+ if (teamArts.isEmpty()) {
+ throw new OseeStateException("No Actions/Workflows Specified");
+ }
+ retrieveData(monitor, teamArts, byAttribute, rd);
+ if (rd.toString().equals("")) {
+ rd.log("No Problems Found");
+ }
+ final String html = rd.getReport(jobName).getManipulatedHtml(Arrays.asList(Manipulations.NONE));
+ final String title = jobName;
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ Result result = (new HtmlExportTable(title, html, true, false)).exportCsv();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ AWorkbench.popup(
+ title,
+ "Completed " + title + "\n\nFile saved to " + System.getProperty("user.home") + File.separator + "table.csv");
+ }
+ });
+ monitor.done();
+ return Status.OK_STATUS;
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, "Failed", ex);
+ }
+ }
+
+ /**
+ * used recursively when originally passed a directory, thus an array of files is accepted
+ *
+ * @throws Exception
+ */
+ private static void retrieveData(IProgressMonitor monitor, Collection<TeamWorkFlowArtifact> teamArts, String byAttribute, XResultData rd) throws OseeCoreException {
+ monitor.subTask("Retrieving Actions");
+
+ int x = 1;
+ rd.addRaw(AHTML.beginMultiColumnTable(95));
+ rd.addRaw(AHTML.addHeaderRowMultiColumnTable(new String[] {"HRID", "Bulld", "UI", byAttribute, "RPCR", "Change"}));
+ for (TeamWorkFlowArtifact teamArt : teamArts) {
+ String rcprId = teamArt.getSoleAttributeValue(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE.getStoreName(), "");
+ String result =
+ (String.format("Processing %s/%s RPCR %s for \"%s\"", x, teamArts.size(), rcprId,
+ teamArt.getTeamDefinition().getName()));
+ monitor.subTask(result);
+ rd.log("\nRPCR " + rcprId);
+ for (ICommitConfigArtifact commitConfigArt : teamArt.getBranchMgr().getConfigArtifactsConfiguredToCommitTo()) {
+ processTeam(teamArt, commitConfigArt.getParentBranch().getShortName(), byAttribute, commitConfigArt, rd);
+ }
+ x++;
+
+ // System.err.println("Developmental purposes only, don't release with this");
+ // if (x >= 5)
+ // break;
+ }
+ rd.addRaw(AHTML.endMultiColumnTable());
+ }
+
+ private static void processTeam(TeamWorkFlowArtifact teamArt, String buildId, String byAttribute, ICommitConfigArtifact commitConfigArt, XResultData rd) throws OseeCoreException {
+ String rpcrNum = teamArt.getSoleAttributeValue(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE.getStoreName(), "");
+ ChangeData changeData = teamArt.getBranchMgr().getChangeData(commitConfigArt);
+ for (Artifact modArt : changeData.getArtifacts(KindType.Artifact, ModificationType.NEW, ModificationType.MODIFIED)) {
+ List<String> attrStrs = modArt.getAttributesToStringList(byAttribute);
+ if (attrStrs.isEmpty()) {
+ attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
+ }
+ for (String attrStr : attrStrs) {
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {teamArt.getHumanReadableId(), buildId,
+ modArt.getName(), attrStr, rpcrNum, "Content"}));
+ }
+ }
+ for (Artifact artChg : changeData.getArtifacts(KindType.Artifact, ModificationType.DELETED)) {
+ List<String> attrStrs = artChg.getAttributesToStringList(byAttribute);
+ if (attrStrs.isEmpty()) {
+ attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
+ }
+ for (String attrStr : attrStrs) {
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {teamArt.getHumanReadableId(), buildId,
+ artChg.getName(), attrStr, rpcrNum, "Deleted"}));
+ }
+ }
+ for (Artifact artChg : changeData.getArtifacts(KindType.RelationOnly, ModificationType.NEW,
+ ModificationType.MODIFIED)) {
+ List<String> attrStrs = artChg.getAttributesToStringList(byAttribute);
+ if (attrStrs.isEmpty()) {
+ attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
+ }
+ for (String attrStr : attrStrs) {
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {teamArt.getHumanReadableId(), buildId,
+ artChg.getName(), attrStr, rpcrNum, "Relation"}));
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskAction.java
index 1b2ba6dc721..dacfefba73d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskAction.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskAction.java
@@ -8,18 +8,18 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.task;
-
+package org.eclipse.osee.ats.task;
+
import java.util.Collection;
import org.eclipse.osee.ats.artifact.TaskArtifact;
-
-/**
- * @author Megumi Telles
- */
-public interface ITaskAction {
-
- public abstract boolean isValid(Collection<TaskArtifact> tasks);
-
- public abstract void setXViewer(TaskXViewer viewer);
-
-}
+
+/**
+ * @author Megumi Telles
+ */
+public interface ITaskAction {
+
+ public abstract boolean isValid(Collection<TaskArtifact> tasks);
+
+ public abstract void setXViewer(TaskXViewer viewer);
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java
index 70f2665c764..696d5b24c54 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/ITaskEditorProvider.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.ats.task;
-
-import java.util.Collection;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ITaskEditorProvider {
-
- public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException;
-
- public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException;
-
- public String getName() throws OseeCoreException;
-
- public Collection<TableLoadOption> getTableLoadOptions() throws OseeCoreException;
-
- public void setCustomizeData(CustomizeData customizeData);
-
- public void setTableLoadOptions(TableLoadOption... tableLoadOptions);
-
- public ITaskEditorProvider copyProvider();
-}
+/*******************************************************************************
+ * 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.ats.task;
+
+import java.util.Collection;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ITaskEditorProvider {
+
+ public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException;
+
+ public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException;
+
+ public String getName() throws OseeCoreException;
+
+ public Collection<TableLoadOption> getTableLoadOptions() throws OseeCoreException;
+
+ public void setCustomizeData(CustomizeData customizeData);
+
+ public void setTableLoadOptions(TableLoadOption... tableLoadOptions);
+
+ public ITaskEditorProvider copyProvider();
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
index 9e7f3056334..0e3bc3c628c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
@@ -1,367 +1,367 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction.IOpenNewAtsTaskEditorHandler;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected.IOpenNewAtsTaskEditorSelectedHandler;
-import org.eclipse.osee.ats.actions.TaskAddAction.ITaskAddActionHandler;
-import org.eclipse.osee.ats.actions.TaskDeleteAction.ITaskDeleteActionHandler;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
-import org.eclipse.osee.ats.config.AtsBulkLoad;
-import org.eclipse.osee.ats.editor.SMAEditor;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsRelationTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.world.IWorldViewerEventHandler;
-import org.eclipse.osee.ats.world.WorldContentProvider;
-import org.eclipse.osee.ats.world.WorldLabelProvider;
-import org.eclipse.osee.ats.world.WorldXViewer;
-import org.eclipse.osee.ats.world.WorldXViewerEventManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
-import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction.IRefreshActionHandler;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
-import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-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.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskComposite extends Composite implements IWorldViewerEventHandler, IOpenNewAtsTaskEditorSelectedHandler, ITaskDeleteActionHandler, ITaskAddActionHandler, IOpenNewAtsTaskEditorHandler, IRefreshActionHandler {
-
- private TaskXViewer taskXViewer;
- private final IXTaskViewer iXTaskViewer;
- protected Label showReleaseMetricsLabel;
- private final Set<TaskArtifact> taskArts = new HashSet<TaskArtifact>(200);
-
- public TaskComposite(IXTaskViewer iXTaskViewer, Composite parent, int style) throws OseeCoreException {
- this(iXTaskViewer, parent, style, null);
- }
-
- public TaskComposite(IXTaskViewer iXTaskViewer, Composite parent, int style, ToolBar toolBar) throws OseeCoreException {
- super(parent, style);
- this.iXTaskViewer = iXTaskViewer;
- AtsBulkLoad.loadConfig(false);
-
- setLayout(ALayout.getZeroMarginLayout(1, true));
- setLayoutData(new GridData(GridData.FILL_BOTH));
-
- if (!DbConnectionExceptionComposite.dbConnectionIsOk(this)) {
- return;
- }
-
- try {
-
- showReleaseMetricsLabel = new Label(this, SWT.NONE);
- showReleaseMetricsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- taskXViewer =
- new TaskXViewer(this, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, iXTaskViewer.getEditor(), this);
- taskXViewer.setTasksEditable(iXTaskViewer.isTasksEditable());
- taskXViewer.setAddDeleteTaskEnabled(iXTaskViewer.isTaskable());
- taskXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- taskXViewer.setContentProvider(new WorldContentProvider(taskXViewer));
- taskXViewer.setLabelProvider(new WorldLabelProvider(taskXViewer));
-
- Tree tree = taskXViewer.getTree();
- GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL);
- gridData.heightHint = 100;
- gridData.widthHint = 100;
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- setupDragAndDropSupport();
- parent.layout();
-
- WorldXViewerEventManager.add(this);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void disposeComposite() {
- if (taskXViewer != null && !taskXViewer.getTree().isDisposed()) {
- taskXViewer.dispose();
- }
- WorldXViewerEventManager.remove(this);
- }
-
- public IXTaskViewer getIXTaskViewer() {
- return iXTaskViewer;
- }
-
- public void add(Collection<TaskArtifact> newTasks) {
- this.taskArts.addAll(newTasks);
- if (getTaskXViewer().getInput() != this.taskArts) {
- getTaskXViewer().setInput(this.taskArts);
- }
- taskXViewer.refresh();
- taskXViewer.getTree().setFocus();
- }
-
- public void loadTable() throws OseeCoreException {
- this.taskArts.clear();
- add(iXTaskViewer.getTaskArtifacts(""));
- }
-
- public void handleDeleteTask() {
- final ArrayList<TaskArtifact> items = getSelectedTaskArtifactItems();
- if (items.isEmpty()) {
- AWorkbench.popup("ERROR", "No Tasks Selected");
- return;
- }
- StringBuilder builder = new StringBuilder();
- if (items.size() > 15) {
- builder.append("Are you sure you wish to delete " + items.size() + " Tasks?\n\n");
- } else {
- builder.append("Are you sure you wish to delete ");
- if (items.size() == 1) {
- builder.append("this Task?\n\n");
- } else {
- builder.append("these Tasks?\n\n");
- }
- for (TaskArtifact taskItem : items) {
- builder.append("\"" + taskItem.getName() + "\"\n");
- }
-
- builder.append("\n\nNote: Workflow will be saved.");
-
- }
- boolean delete =
- MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Delete Task",
- builder.toString());
- if (delete) {
- try {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Delete Tasks");
- // Done for concurrent modification purposes
- ArrayList<TaskArtifact> delItems = new ArrayList<TaskArtifact>();
- ArrayList<TaskArtifact> tasksNotInDb = new ArrayList<TaskArtifact>();
- delItems.addAll(items);
- for (TaskArtifact taskArt : delItems) {
- SMAEditor.close(Collections.singleton(taskArt), false);
- if (taskArt.isInDb()) {
- taskArt.deleteAndPersist(transaction);
- } else {
- tasksNotInDb.add(taskArt);
- }
- }
- transaction.execute();
- taskXViewer.remove(items.toArray(new Object[items.size()]));
- taskArts.removeAll(items);
-
- if (tasksNotInDb.size() > 0) {
- new PurgeArtifacts(tasksNotInDb).execute();
- refreshActionHandler();
- }
- iXTaskViewer.getEditor().onDirtied();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- public TaskArtifact handleNewTask() {
- TaskArtifact taskArt = null;
- EntryDialog ed =
- new EntryDialog(Displays.getActiveShell(), "Create New Task", null,
- "Enter Task Title/Description", MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
- if (ed.open() == 0) {
- try {
- taskArt = ((TaskableStateMachineArtifact) iXTaskViewer.getSma()).createNewTask(ed.getEntry());
- iXTaskViewer.getEditor().onDirtied();
- add(Collections.singleton(taskArt));
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return taskArt;
- }
-
- public ArrayList<TaskArtifact> getSelectedTaskArtifactItems() {
- Iterator<?> i = ((IStructuredSelection) taskXViewer.getSelection()).iterator();
- ArrayList<TaskArtifact> items = new ArrayList<TaskArtifact>();
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof TaskArtifact) {
- items.add((TaskArtifact) obj);
- }
- }
- return items;
- }
-
- public TaskXViewer getTaskXViewer() {
- return taskXViewer;
- }
-
- @Override
- public Object getData() {
- return taskXViewer.getInput();
- }
-
- private void setupDragAndDropSupport() {
- DragSource source = new DragSource(taskXViewer.getTree(), DND.DROP_COPY);
- source.setTransfer(new Transfer[] {ArtifactTransfer.getInstance()});
- source.addDragListener(new DragSourceListener() {
-
- public void dragFinished(DragSourceEvent event) {
- }
-
- public void dragSetData(DragSourceEvent event) {
- Collection<TaskArtifact> arts = taskXViewer.getSelectedTaskArtifacts();
- if (arts.size() > 0) {
- event.data = new ArtifactData(arts.toArray(new Artifact[arts.size()]), "", SMAEditor.EDITOR_ID);
- }
- }
-
- public void dragStart(DragSourceEvent event) {
- }
- });
-
- DropTarget target = new DropTarget(taskXViewer.getTree(), DND.DROP_COPY);
- target.setTransfer(new Transfer[] {FileTransfer.getInstance(), TextTransfer.getInstance(),
- ArtifactTransfer.getInstance()});
- target.addDropListener(new DropTargetAdapter() {
-
- @Override
- public void drop(DropTargetEvent event) {
- performDrop(event);
- }
-
- @Override
- public void dragOver(DropTargetEvent event) {
- event.detail = DND.DROP_COPY;
- }
-
- @Override
- public void dropAccept(DropTargetEvent event) {
- }
- });
- }
-
- private void performDrop(DropTargetEvent e) {
- if (e.data instanceof ArtifactData) {
- try {
- if (iXTaskViewer.getSma() == null) {
- return;
- }
- final Artifact[] artsToRelate = ((ArtifactData) e.data).getArtifacts();
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Drop Add Tasks");
- for (Artifact art : artsToRelate) {
- if (art instanceof TaskArtifact) {
- TaskArtifact taskArt = (TaskArtifact) art;
- // task dropped on same sma as current parent; do nothing
- if (taskArt.getParentSMA().equals(iXTaskViewer.getSma())) {
- return;
- }
- if (taskArt.getParentSMA() != null) {
- taskArt.deleteRelation(AtsRelationTypes.SmaToTask_Sma, taskArt.getParentSMA());
- }
- taskArt.addRelation(AtsRelationTypes.SmaToTask_Sma, iXTaskViewer.getSma());
- taskArt.persist(transaction);
- }
- }
- transaction.execute();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- public String getActionDescription() {
- return null;
- }
-
- @Override
- public void refreshActionHandler() {
- try {
- if (iXTaskViewer.isRefreshActionHandled()) {
- iXTaskViewer.handleRefreshAction();
- } else {
- loadTable();
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public CustomizeData getCustomizeDataCopy() throws OseeCoreException {
- return taskXViewer.getCustomizeMgr().generateCustDataFromTable();
- }
-
- @Override
- public ITaskEditorProvider getTaskEditorProviderCopy() throws OseeCoreException {
- return ((TaskEditorInput) ((TaskEditor) iXTaskViewer.getEditor()).getEditorInput()).getItaskEditorProvider().copyProvider();
- }
-
- @Override
- public ArrayList<? extends Artifact> getSelectedArtifacts() throws OseeCoreException {
- return getSelectedTaskArtifactItems();
- }
-
- @Override
- public void taskAddActionHandler() {
- handleNewTask();
- }
-
- @Override
- public void taskDeleteActionHandler() {
- handleDeleteTask();
- }
-
- @Override
- public WorldXViewer getWorldXViewer() {
- return taskXViewer;
- }
-
- @Override
- public void removeItems(Collection<? extends Object> objects) {
- taskArts.removeAll(objects);
- }
-}
+/*******************************************************************************
+ * 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.ats.task;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction.IOpenNewAtsTaskEditorHandler;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected.IOpenNewAtsTaskEditorSelectedHandler;
+import org.eclipse.osee.ats.actions.TaskAddAction.ITaskAddActionHandler;
+import org.eclipse.osee.ats.actions.TaskDeleteAction.ITaskDeleteActionHandler;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
+import org.eclipse.osee.ats.config.AtsBulkLoad;
+import org.eclipse.osee.ats.editor.SMAEditor;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsRelationTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.world.IWorldViewerEventHandler;
+import org.eclipse.osee.ats.world.WorldContentProvider;
+import org.eclipse.osee.ats.world.WorldLabelProvider;
+import org.eclipse.osee.ats.world.WorldXViewer;
+import org.eclipse.osee.ats.world.WorldXViewerEventManager;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
+import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.action.RefreshAction.IRefreshActionHandler;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
+import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+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.FileTransfer;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskComposite extends Composite implements IWorldViewerEventHandler, IOpenNewAtsTaskEditorSelectedHandler, ITaskDeleteActionHandler, ITaskAddActionHandler, IOpenNewAtsTaskEditorHandler, IRefreshActionHandler {
+
+ private TaskXViewer taskXViewer;
+ private final IXTaskViewer iXTaskViewer;
+ protected Label showReleaseMetricsLabel;
+ private final Set<TaskArtifact> taskArts = new HashSet<TaskArtifact>(200);
+
+ public TaskComposite(IXTaskViewer iXTaskViewer, Composite parent, int style) throws OseeCoreException {
+ this(iXTaskViewer, parent, style, null);
+ }
+
+ public TaskComposite(IXTaskViewer iXTaskViewer, Composite parent, int style, ToolBar toolBar) throws OseeCoreException {
+ super(parent, style);
+ this.iXTaskViewer = iXTaskViewer;
+ AtsBulkLoad.loadConfig(false);
+
+ setLayout(ALayout.getZeroMarginLayout(1, true));
+ setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ if (!DbConnectionExceptionComposite.dbConnectionIsOk(this)) {
+ return;
+ }
+
+ try {
+
+ showReleaseMetricsLabel = new Label(this, SWT.NONE);
+ showReleaseMetricsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ taskXViewer =
+ new TaskXViewer(this, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, iXTaskViewer.getEditor(), this);
+ taskXViewer.setTasksEditable(iXTaskViewer.isTasksEditable());
+ taskXViewer.setAddDeleteTaskEnabled(iXTaskViewer.isTaskable());
+ taskXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ taskXViewer.setContentProvider(new WorldContentProvider(taskXViewer));
+ taskXViewer.setLabelProvider(new WorldLabelProvider(taskXViewer));
+
+ Tree tree = taskXViewer.getTree();
+ GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL);
+ gridData.heightHint = 100;
+ gridData.widthHint = 100;
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ setupDragAndDropSupport();
+ parent.layout();
+
+ WorldXViewerEventManager.add(this);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void disposeComposite() {
+ if (taskXViewer != null && !taskXViewer.getTree().isDisposed()) {
+ taskXViewer.dispose();
+ }
+ WorldXViewerEventManager.remove(this);
+ }
+
+ public IXTaskViewer getIXTaskViewer() {
+ return iXTaskViewer;
+ }
+
+ public void add(Collection<TaskArtifact> newTasks) {
+ this.taskArts.addAll(newTasks);
+ if (getTaskXViewer().getInput() != this.taskArts) {
+ getTaskXViewer().setInput(this.taskArts);
+ }
+ taskXViewer.refresh();
+ taskXViewer.getTree().setFocus();
+ }
+
+ public void loadTable() throws OseeCoreException {
+ this.taskArts.clear();
+ add(iXTaskViewer.getTaskArtifacts(""));
+ }
+
+ public void handleDeleteTask() {
+ final ArrayList<TaskArtifact> items = getSelectedTaskArtifactItems();
+ if (items.isEmpty()) {
+ AWorkbench.popup("ERROR", "No Tasks Selected");
+ return;
+ }
+ StringBuilder builder = new StringBuilder();
+ if (items.size() > 15) {
+ builder.append("Are you sure you wish to delete " + items.size() + " Tasks?\n\n");
+ } else {
+ builder.append("Are you sure you wish to delete ");
+ if (items.size() == 1) {
+ builder.append("this Task?\n\n");
+ } else {
+ builder.append("these Tasks?\n\n");
+ }
+ for (TaskArtifact taskItem : items) {
+ builder.append("\"" + taskItem.getName() + "\"\n");
+ }
+
+ builder.append("\n\nNote: Workflow will be saved.");
+
+ }
+ boolean delete =
+ MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Delete Task",
+ builder.toString());
+ if (delete) {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Delete Tasks");
+ // Done for concurrent modification purposes
+ ArrayList<TaskArtifact> delItems = new ArrayList<TaskArtifact>();
+ ArrayList<TaskArtifact> tasksNotInDb = new ArrayList<TaskArtifact>();
+ delItems.addAll(items);
+ for (TaskArtifact taskArt : delItems) {
+ SMAEditor.close(Collections.singleton(taskArt), false);
+ if (taskArt.isInDb()) {
+ taskArt.deleteAndPersist(transaction);
+ } else {
+ tasksNotInDb.add(taskArt);
+ }
+ }
+ transaction.execute();
+ taskXViewer.remove(items.toArray(new Object[items.size()]));
+ taskArts.removeAll(items);
+
+ if (tasksNotInDb.size() > 0) {
+ new PurgeArtifacts(tasksNotInDb).execute();
+ refreshActionHandler();
+ }
+ iXTaskViewer.getEditor().onDirtied();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ public TaskArtifact handleNewTask() {
+ TaskArtifact taskArt = null;
+ EntryDialog ed =
+ new EntryDialog(Displays.getActiveShell(), "Create New Task", null,
+ "Enter Task Title/Description", MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
+ if (ed.open() == 0) {
+ try {
+ taskArt = ((TaskableStateMachineArtifact) iXTaskViewer.getSma()).createNewTask(ed.getEntry());
+ iXTaskViewer.getEditor().onDirtied();
+ add(Collections.singleton(taskArt));
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return taskArt;
+ }
+
+ public ArrayList<TaskArtifact> getSelectedTaskArtifactItems() {
+ Iterator<?> i = ((IStructuredSelection) taskXViewer.getSelection()).iterator();
+ ArrayList<TaskArtifact> items = new ArrayList<TaskArtifact>();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof TaskArtifact) {
+ items.add((TaskArtifact) obj);
+ }
+ }
+ return items;
+ }
+
+ public TaskXViewer getTaskXViewer() {
+ return taskXViewer;
+ }
+
+ @Override
+ public Object getData() {
+ return taskXViewer.getInput();
+ }
+
+ private void setupDragAndDropSupport() {
+ DragSource source = new DragSource(taskXViewer.getTree(), DND.DROP_COPY);
+ source.setTransfer(new Transfer[] {ArtifactTransfer.getInstance()});
+ source.addDragListener(new DragSourceListener() {
+
+ public void dragFinished(DragSourceEvent event) {
+ }
+
+ public void dragSetData(DragSourceEvent event) {
+ Collection<TaskArtifact> arts = taskXViewer.getSelectedTaskArtifacts();
+ if (arts.size() > 0) {
+ event.data = new ArtifactData(arts.toArray(new Artifact[arts.size()]), "", SMAEditor.EDITOR_ID);
+ }
+ }
+
+ public void dragStart(DragSourceEvent event) {
+ }
+ });
+
+ DropTarget target = new DropTarget(taskXViewer.getTree(), DND.DROP_COPY);
+ target.setTransfer(new Transfer[] {FileTransfer.getInstance(), TextTransfer.getInstance(),
+ ArtifactTransfer.getInstance()});
+ target.addDropListener(new DropTargetAdapter() {
+
+ @Override
+ public void drop(DropTargetEvent event) {
+ performDrop(event);
+ }
+
+ @Override
+ public void dragOver(DropTargetEvent event) {
+ event.detail = DND.DROP_COPY;
+ }
+
+ @Override
+ public void dropAccept(DropTargetEvent event) {
+ }
+ });
+ }
+
+ private void performDrop(DropTargetEvent e) {
+ if (e.data instanceof ArtifactData) {
+ try {
+ if (iXTaskViewer.getSma() == null) {
+ return;
+ }
+ final Artifact[] artsToRelate = ((ArtifactData) e.data).getArtifacts();
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Drop Add Tasks");
+ for (Artifact art : artsToRelate) {
+ if (art instanceof TaskArtifact) {
+ TaskArtifact taskArt = (TaskArtifact) art;
+ // task dropped on same sma as current parent; do nothing
+ if (taskArt.getParentSMA().equals(iXTaskViewer.getSma())) {
+ return;
+ }
+ if (taskArt.getParentSMA() != null) {
+ taskArt.deleteRelation(AtsRelationTypes.SmaToTask_Sma, taskArt.getParentSMA());
+ }
+ taskArt.addRelation(AtsRelationTypes.SmaToTask_Sma, iXTaskViewer.getSma());
+ taskArt.persist(transaction);
+ }
+ }
+ transaction.execute();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ public String getActionDescription() {
+ return null;
+ }
+
+ @Override
+ public void refreshActionHandler() {
+ try {
+ if (iXTaskViewer.isRefreshActionHandled()) {
+ iXTaskViewer.handleRefreshAction();
+ } else {
+ loadTable();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public CustomizeData getCustomizeDataCopy() throws OseeCoreException {
+ return taskXViewer.getCustomizeMgr().generateCustDataFromTable();
+ }
+
+ @Override
+ public ITaskEditorProvider getTaskEditorProviderCopy() throws OseeCoreException {
+ return ((TaskEditorInput) ((TaskEditor) iXTaskViewer.getEditor()).getEditorInput()).getItaskEditorProvider().copyProvider();
+ }
+
+ @Override
+ public ArrayList<? extends Artifact> getSelectedArtifacts() throws OseeCoreException {
+ return getSelectedTaskArtifactItems();
+ }
+
+ @Override
+ public void taskAddActionHandler() {
+ handleNewTask();
+ }
+
+ @Override
+ public void taskDeleteActionHandler() {
+ handleDeleteTask();
+ }
+
+ @Override
+ public WorldXViewer getWorldXViewer() {
+ return taskXViewer;
+ }
+
+ @Override
+ public void removeItems(Collection<? extends Object> objects) {
+ taskArts.removeAll(objects);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java
index 94e33304000..ba2116b7156 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditor.java
@@ -1,405 +1,405 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-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.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.world.AtsMetricsComposite;
-import org.eclipse.osee.ats.world.IAtsMetricsProvider;
-import org.eclipse.osee.ats.world.WorldEditor;
-import org.eclipse.osee.ats.world.WorldEditorParameterSearchItemProvider;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.IActionable;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
-import org.eclipse.osee.framework.ui.skynet.artifact.editor.AbstractArtifactEditor;
-import org.eclipse.osee.framework.ui.swt.CursorManager;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskEditor extends AbstractArtifactEditor implements IDirtiableEditor, IActionable, IAtsMetricsProvider, IXTaskViewer {
- public static final String EDITOR_ID = "org.eclipse.osee.ats.editor.TaskEditor";
- private int mainPageIndex, metricsPageIndex;
- private TaskEditorXWidgetActionPage taskActionPage;
- private final Collection<TaskArtifact> tasks = new HashSet<TaskArtifact>();
- private AtsMetricsComposite metricsComposite;
- private boolean loading = false;
- public static int TITLE_MAX_LENGTH = WorldEditor.TITLE_MAX_LENGTH;
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- try {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Task Editor Save");
- for (TaskArtifact taskArt : tasks) {
- taskArt.saveSMA(transaction);
- }
- transaction.execute();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- onDirtied();
- }
-
- public ArrayList<Artifact> getLoadedArtifacts() {
- return taskActionPage.getTaskComposite().getTaskXViewer().getLoadedArtifacts();
- }
-
- @Override
- public boolean isSaveOnCloseNeeded() {
- return isDirty();
- }
-
- public static Collection<TaskEditor> getEditors() {
- final List<TaskEditor> editors = new ArrayList<TaskEditor>();
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
- editors.add((TaskEditor) editor.getEditor(false));
- }
- }
- });
- return editors;
- }
-
- public static void closeAll() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
- AWorkbench.getActivePage().closeEditor((editor.getEditor(false)), false);
- }
- }
- });
- }
-
- public void setTableTitle(final String title, final boolean warning) {
- taskActionPage.setTableTitle(title, warning);
- }
-
- @Override
- public void dispose() {
- for (TaskArtifact taskArt : tasks) {
- if (taskArt != null && !taskArt.isDeleted() && taskArt.isSMAEditorDirty().isTrue()) {
- taskArt.revertSMA();
- }
- }
- if (taskActionPage != null && taskActionPage.getTaskComposite() != null) {
- taskActionPage.getTaskComposite().disposeComposite();
- }
- if (metricsComposite != null) {
- metricsComposite.disposeComposite();
- }
-
- super.dispose();
- }
-
- @Override
- public boolean isDirty() {
- for (TaskArtifact taskArt : new CopyOnWriteArrayList<TaskArtifact>(tasks)) {
- if (taskArt.isDeleted()) {
- continue;
- } else if (taskArt.isSMAEditorDirty().isTrue()) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String toString() {
- return "TaskEditor";
- }
-
- /**
- * @return the taskActionPage
- */
- public TaskEditorXWidgetActionPage getTaskActionPage() {
- return taskActionPage;
- }
-
- @Override
- protected void addPages() {
-
- try {
- OseeContributionItem.addTo(this, true);
-
- IEditorInput editorInput = getEditorInput();
- if (!(editorInput instanceof TaskEditorInput)) {
- throw new OseeArgumentException("Editor Input not TaskEditorInput");
- }
-
- createMainTab();
- createMetricsTab();
-
- setActivePage(mainPageIndex);
- loadTable();
-
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- } catch (PartInitException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- private void createMainTab() throws OseeCoreException, PartInitException {
- taskActionPage = new TaskEditorXWidgetActionPage(this);
- mainPageIndex = addPage(taskActionPage);
- }
-
- private void createMetricsTab() throws OseeCoreException {
- Composite comp = AtsUtil.createCommonPageComposite(getContainer());
- AtsUtil.createCommonToolBar(comp);
- metricsComposite = new AtsMetricsComposite(this, comp, SWT.NONE);
- metricsPageIndex = addPage(comp);
- setPageText(metricsPageIndex, "Metrics");
- }
-
- public ITaskEditorProvider getTaskEditorProvider() {
- TaskEditorInput aei = (TaskEditorInput) getEditorInput();
- return aei.getItaskEditorProvider();
- }
-
- private void loadTable() throws OseeCoreException {
- ITaskEditorProvider provider = getTaskEditorProvider();
- setPartName(provider.getTaskEditorLabel(SearchType.Search));
-
- if (provider instanceof TaskEditorParameterSearchItemProvider && ((TaskEditorParameterSearchItemProvider) provider).isFirstTime()) {
- setPartName(provider.getName());
- setTableTitle(WorldEditorParameterSearchItemProvider.ENTER_OPTIONS_AND_SELECT_SEARCH, false);
- return;
- }
- if (provider instanceof TaskEditorParameterSearchItemProvider) {
- Result result =
- ((TaskEditorParameterSearchItemProvider) provider).getWorldSearchItem().isParameterSelectionValid();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- }
- if (loading) {
- AWorkbench.popup("Already Loading, Please Wait");
- return;
- }
- LoadTableJob job = null;
- job = new LoadTableJob(provider, SearchType.ReSearch, this);
- job.setUser(false);
- job.setPriority(Job.LONG);
- job.schedule();
- if (provider.getTableLoadOptions() != null && provider.getTableLoadOptions().contains(TableLoadOption.ForcePend)) {
- try {
- job.join();
- } catch (InterruptedException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
-
- @Override
- public void onDirtied() {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- firePropertyChange(PROP_DIRTY);
- }
- });
- }
-
- public static void open(final ITaskEditorProvider provider) throws OseeCoreException {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- IWorkbenchPage page = AWorkbench.getActivePage();
- try {
- page.openEditor(new TaskEditorInput(provider), EDITOR_ID);
- } catch (PartInitException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }, (provider.getTableLoadOptions() != null && provider.getTableLoadOptions().contains(TableLoadOption.ForcePend)));
- }
-
- private static class LoadTableJob extends Job {
-
- private final ITaskEditorProvider itaskEditorProvider;
- private final TaskEditor taskEditor;
- private final SearchType searchType;
-
- public LoadTableJob(ITaskEditorProvider itaskEditorProvider, SearchType searchType, TaskEditor taskEditor) throws OseeCoreException {
- super("Loading \"" + itaskEditorProvider.getTaskEditorLabel(searchType) + "\"");
- this.searchType = searchType;
- this.taskEditor = taskEditor;
- taskEditor.setPartName(itaskEditorProvider.getTaskEditorLabel(searchType));
- taskEditor.setTableTitle("Loading \"" + itaskEditorProvider.getTaskEditorLabel(searchType) + "\"", false);
- this.itaskEditorProvider = itaskEditorProvider;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (taskEditor.isLoading()) {
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, "Already Loading, Please Wait", null);
- }
- try {
- taskEditor.setLoading(true);
- final List<TaskArtifact> taskArts = new ArrayList<TaskArtifact>();
- for (Artifact artifact : itaskEditorProvider.getTaskEditorTaskArtifacts()) {
- if (artifact instanceof TaskArtifact) {
- taskArts.add((TaskArtifact) artifact);
- }
- }
- taskEditor.tasks.clear();
- taskEditor.tasks.addAll(taskArts);
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- taskEditor.setPartName(itaskEditorProvider.getTaskEditorLabel(searchType));
- if (taskArts.isEmpty()) {
- taskEditor.setTableTitle(
- "No Results Found - " + itaskEditorProvider.getTaskEditorLabel(searchType), true);
- } else {
- taskEditor.setTableTitle(itaskEditorProvider.getTaskEditorLabel(searchType), false);
- }
- taskEditor.getTaskActionPage().getTaskComposite().loadTable();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- } catch (final Exception ex) {
- monitor.done();
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, "Can't load tasks", ex);
- } finally {
- taskEditor.setLoading(false);
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- }
-
- @Override
- public Collection<? extends Artifact> getMetricsArtifacts() throws OseeCoreException {
- return tasks;
- }
-
- @Override
- public VersionArtifact getMetricsVersionArtifact() throws OseeCoreException {
- for (TaskArtifact taskArt : tasks) {
- if (taskArt.getWorldViewTargetedVersion() != null) {
- return taskArt.getWorldViewTargetedVersion();
- }
- }
- return null;
- }
-
- public String getCurrentStateName() throws OseeCoreException {
- return "";
- }
-
- public IDirtiableEditor getEditor() throws OseeCoreException {
- return this;
- }
-
- public StateMachineArtifact getSma() throws OseeCoreException {
- return null;
- }
-
- public String getTabName() throws OseeCoreException {
- return "Tasks";
- }
-
- public Collection<TaskArtifact> getTaskArtifacts(String stateName) throws OseeCoreException {
- return tasks;
- }
-
- public boolean isTaskable() throws OseeCoreException {
- return false;
- }
-
- public boolean isTasksEditable() throws OseeCoreException {
- return true;
- }
-
- @Override
- public boolean isRefreshActionHandled() throws OseeCoreException {
- return true;
- }
-
- @Override
- public void handleRefreshAction() throws OseeCoreException {
- loadTable();
- }
-
- @Override
- public double getManHoursPerDayPreference() throws OseeCoreException {
- if (tasks.isEmpty()) {
- return StateMachineArtifact.DEFAULT_HOURS_PER_WORK_DAY;
- }
- return tasks.iterator().next().getManHrsPerDayPreference();
- }
-
- @Override
- public String getActionDescription() {
- return taskActionPage.getActionDescription();
- }
-
- @Override
- public IActionable getActionable() throws OseeCoreException {
- return this;
- }
-
- public boolean isLoading() {
- return loading;
- }
-
- public void setLoading(final boolean loading) {
- this.loading = loading;
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (loading) {
- taskActionPage.getTaskComposite().setCursor(CursorManager.getCursor(SWT.CURSOR_WAIT));
- } else {
- taskActionPage.getTaskComposite().setCursor(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.ats.task;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+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.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.world.AtsMetricsComposite;
+import org.eclipse.osee.ats.world.IAtsMetricsProvider;
+import org.eclipse.osee.ats.world.WorldEditor;
+import org.eclipse.osee.ats.world.WorldEditorParameterSearchItemProvider;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
+import org.eclipse.osee.framework.ui.skynet.artifact.editor.AbstractArtifactEditor;
+import org.eclipse.osee.framework.ui.swt.CursorManager;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskEditor extends AbstractArtifactEditor implements IDirtiableEditor, IActionable, IAtsMetricsProvider, IXTaskViewer {
+ public static final String EDITOR_ID = "org.eclipse.osee.ats.editor.TaskEditor";
+ private int mainPageIndex, metricsPageIndex;
+ private TaskEditorXWidgetActionPage taskActionPage;
+ private final Collection<TaskArtifact> tasks = new HashSet<TaskArtifact>();
+ private AtsMetricsComposite metricsComposite;
+ private boolean loading = false;
+ public static int TITLE_MAX_LENGTH = WorldEditor.TITLE_MAX_LENGTH;
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Task Editor Save");
+ for (TaskArtifact taskArt : tasks) {
+ taskArt.saveSMA(transaction);
+ }
+ transaction.execute();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ onDirtied();
+ }
+
+ public ArrayList<Artifact> getLoadedArtifacts() {
+ return taskActionPage.getTaskComposite().getTaskXViewer().getLoadedArtifacts();
+ }
+
+ @Override
+ public boolean isSaveOnCloseNeeded() {
+ return isDirty();
+ }
+
+ public static Collection<TaskEditor> getEditors() {
+ final List<TaskEditor> editors = new ArrayList<TaskEditor>();
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
+ editors.add((TaskEditor) editor.getEditor(false));
+ }
+ }
+ });
+ return editors;
+ }
+
+ public static void closeAll() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
+ AWorkbench.getActivePage().closeEditor((editor.getEditor(false)), false);
+ }
+ }
+ });
+ }
+
+ public void setTableTitle(final String title, final boolean warning) {
+ taskActionPage.setTableTitle(title, warning);
+ }
+
+ @Override
+ public void dispose() {
+ for (TaskArtifact taskArt : tasks) {
+ if (taskArt != null && !taskArt.isDeleted() && taskArt.isSMAEditorDirty().isTrue()) {
+ taskArt.revertSMA();
+ }
+ }
+ if (taskActionPage != null && taskActionPage.getTaskComposite() != null) {
+ taskActionPage.getTaskComposite().disposeComposite();
+ }
+ if (metricsComposite != null) {
+ metricsComposite.disposeComposite();
+ }
+
+ super.dispose();
+ }
+
+ @Override
+ public boolean isDirty() {
+ for (TaskArtifact taskArt : new CopyOnWriteArrayList<TaskArtifact>(tasks)) {
+ if (taskArt.isDeleted()) {
+ continue;
+ } else if (taskArt.isSMAEditorDirty().isTrue()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "TaskEditor";
+ }
+
+ /**
+ * @return the taskActionPage
+ */
+ public TaskEditorXWidgetActionPage getTaskActionPage() {
+ return taskActionPage;
+ }
+
+ @Override
+ protected void addPages() {
+
+ try {
+ OseeContributionItem.addTo(this, true);
+
+ IEditorInput editorInput = getEditorInput();
+ if (!(editorInput instanceof TaskEditorInput)) {
+ throw new OseeArgumentException("Editor Input not TaskEditorInput");
+ }
+
+ createMainTab();
+ createMetricsTab();
+
+ setActivePage(mainPageIndex);
+ loadTable();
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ } catch (PartInitException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ private void createMainTab() throws OseeCoreException, PartInitException {
+ taskActionPage = new TaskEditorXWidgetActionPage(this);
+ mainPageIndex = addPage(taskActionPage);
+ }
+
+ private void createMetricsTab() throws OseeCoreException {
+ Composite comp = AtsUtil.createCommonPageComposite(getContainer());
+ AtsUtil.createCommonToolBar(comp);
+ metricsComposite = new AtsMetricsComposite(this, comp, SWT.NONE);
+ metricsPageIndex = addPage(comp);
+ setPageText(metricsPageIndex, "Metrics");
+ }
+
+ public ITaskEditorProvider getTaskEditorProvider() {
+ TaskEditorInput aei = (TaskEditorInput) getEditorInput();
+ return aei.getItaskEditorProvider();
+ }
+
+ private void loadTable() throws OseeCoreException {
+ ITaskEditorProvider provider = getTaskEditorProvider();
+ setPartName(provider.getTaskEditorLabel(SearchType.Search));
+
+ if (provider instanceof TaskEditorParameterSearchItemProvider && ((TaskEditorParameterSearchItemProvider) provider).isFirstTime()) {
+ setPartName(provider.getName());
+ setTableTitle(WorldEditorParameterSearchItemProvider.ENTER_OPTIONS_AND_SELECT_SEARCH, false);
+ return;
+ }
+ if (provider instanceof TaskEditorParameterSearchItemProvider) {
+ Result result =
+ ((TaskEditorParameterSearchItemProvider) provider).getWorldSearchItem().isParameterSelectionValid();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ }
+ if (loading) {
+ AWorkbench.popup("Already Loading, Please Wait");
+ return;
+ }
+ LoadTableJob job = null;
+ job = new LoadTableJob(provider, SearchType.ReSearch, this);
+ job.setUser(false);
+ job.setPriority(Job.LONG);
+ job.schedule();
+ if (provider.getTableLoadOptions() != null && provider.getTableLoadOptions().contains(TableLoadOption.ForcePend)) {
+ try {
+ job.join();
+ } catch (InterruptedException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ @Override
+ public void onDirtied() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ firePropertyChange(PROP_DIRTY);
+ }
+ });
+ }
+
+ public static void open(final ITaskEditorProvider provider) throws OseeCoreException {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ IWorkbenchPage page = AWorkbench.getActivePage();
+ try {
+ page.openEditor(new TaskEditorInput(provider), EDITOR_ID);
+ } catch (PartInitException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }, (provider.getTableLoadOptions() != null && provider.getTableLoadOptions().contains(TableLoadOption.ForcePend)));
+ }
+
+ private static class LoadTableJob extends Job {
+
+ private final ITaskEditorProvider itaskEditorProvider;
+ private final TaskEditor taskEditor;
+ private final SearchType searchType;
+
+ public LoadTableJob(ITaskEditorProvider itaskEditorProvider, SearchType searchType, TaskEditor taskEditor) throws OseeCoreException {
+ super("Loading \"" + itaskEditorProvider.getTaskEditorLabel(searchType) + "\"");
+ this.searchType = searchType;
+ this.taskEditor = taskEditor;
+ taskEditor.setPartName(itaskEditorProvider.getTaskEditorLabel(searchType));
+ taskEditor.setTableTitle("Loading \"" + itaskEditorProvider.getTaskEditorLabel(searchType) + "\"", false);
+ this.itaskEditorProvider = itaskEditorProvider;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (taskEditor.isLoading()) {
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, "Already Loading, Please Wait", null);
+ }
+ try {
+ taskEditor.setLoading(true);
+ final List<TaskArtifact> taskArts = new ArrayList<TaskArtifact>();
+ for (Artifact artifact : itaskEditorProvider.getTaskEditorTaskArtifacts()) {
+ if (artifact instanceof TaskArtifact) {
+ taskArts.add((TaskArtifact) artifact);
+ }
+ }
+ taskEditor.tasks.clear();
+ taskEditor.tasks.addAll(taskArts);
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ taskEditor.setPartName(itaskEditorProvider.getTaskEditorLabel(searchType));
+ if (taskArts.isEmpty()) {
+ taskEditor.setTableTitle(
+ "No Results Found - " + itaskEditorProvider.getTaskEditorLabel(searchType), true);
+ } else {
+ taskEditor.setTableTitle(itaskEditorProvider.getTaskEditorLabel(searchType), false);
+ }
+ taskEditor.getTaskActionPage().getTaskComposite().loadTable();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ } catch (final Exception ex) {
+ monitor.done();
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, "Can't load tasks", ex);
+ } finally {
+ taskEditor.setLoading(false);
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ }
+
+ @Override
+ public Collection<? extends Artifact> getMetricsArtifacts() throws OseeCoreException {
+ return tasks;
+ }
+
+ @Override
+ public VersionArtifact getMetricsVersionArtifact() throws OseeCoreException {
+ for (TaskArtifact taskArt : tasks) {
+ if (taskArt.getWorldViewTargetedVersion() != null) {
+ return taskArt.getWorldViewTargetedVersion();
+ }
+ }
+ return null;
+ }
+
+ public String getCurrentStateName() throws OseeCoreException {
+ return "";
+ }
+
+ public IDirtiableEditor getEditor() throws OseeCoreException {
+ return this;
+ }
+
+ public StateMachineArtifact getSma() throws OseeCoreException {
+ return null;
+ }
+
+ public String getTabName() throws OseeCoreException {
+ return "Tasks";
+ }
+
+ public Collection<TaskArtifact> getTaskArtifacts(String stateName) throws OseeCoreException {
+ return tasks;
+ }
+
+ public boolean isTaskable() throws OseeCoreException {
+ return false;
+ }
+
+ public boolean isTasksEditable() throws OseeCoreException {
+ return true;
+ }
+
+ @Override
+ public boolean isRefreshActionHandled() throws OseeCoreException {
+ return true;
+ }
+
+ @Override
+ public void handleRefreshAction() throws OseeCoreException {
+ loadTable();
+ }
+
+ @Override
+ public double getManHoursPerDayPreference() throws OseeCoreException {
+ if (tasks.isEmpty()) {
+ return StateMachineArtifact.DEFAULT_HOURS_PER_WORK_DAY;
+ }
+ return tasks.iterator().next().getManHrsPerDayPreference();
+ }
+
+ @Override
+ public String getActionDescription() {
+ return taskActionPage.getActionDescription();
+ }
+
+ @Override
+ public IActionable getActionable() throws OseeCoreException {
+ return this;
+ }
+
+ public boolean isLoading() {
+ return loading;
+ }
+
+ public void setLoading(final boolean loading) {
+ this.loading = loading;
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (loading) {
+ taskActionPage.getTaskComposite().setCursor(CursorManager.getCursor(SWT.CURSOR_WAIT));
+ } else {
+ taskActionPage.getTaskComposite().setCursor(null);
+ }
+ }
+ });
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java
index 4897b09f989..8d4d3de9d16 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorInput.java
@@ -1,84 +1,84 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import java.util.logging.Level;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskEditorInput implements IEditorInput {
-
- private ITaskEditorProvider itaskEditorProvider;
-
- @Override
- public int hashCode() {
- return itaskEditorProvider.hashCode();
- }
-
- public ITaskEditorProvider getItaskEditorProvider() {
- return itaskEditorProvider;
- }
-
- public TaskEditorInput(ITaskEditorProvider itaskEditorProvider) {
- this.itaskEditorProvider = itaskEditorProvider;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof TaskEditorInput)) return false;
- TaskEditorInput castObj = (TaskEditorInput) obj;
- return castObj.itaskEditorProvider.equals(this.itaskEditorProvider);
- }
-
- public boolean exists() {
- return false;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getToolTipText() {
- try {
- return itaskEditorProvider.getName();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return "Exception getting name: " + ex.getLocalizedMessage();
- }
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public String getName() {
- try {
- return itaskEditorProvider.getName();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return "Exception getting name: " + ex.getLocalizedMessage();
- }
- }
-}
+/*******************************************************************************
+ * 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.ats.task;
+
+import java.util.logging.Level;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskEditorInput implements IEditorInput {
+
+ private ITaskEditorProvider itaskEditorProvider;
+
+ @Override
+ public int hashCode() {
+ return itaskEditorProvider.hashCode();
+ }
+
+ public ITaskEditorProvider getItaskEditorProvider() {
+ return itaskEditorProvider;
+ }
+
+ public TaskEditorInput(ITaskEditorProvider itaskEditorProvider) {
+ this.itaskEditorProvider = itaskEditorProvider;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof TaskEditorInput)) return false;
+ TaskEditorInput castObj = (TaskEditorInput) obj;
+ return castObj.itaskEditorProvider.equals(this.itaskEditorProvider);
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public String getToolTipText() {
+ try {
+ return itaskEditorProvider.getName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return "Exception getting name: " + ex.getLocalizedMessage();
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ try {
+ return itaskEditorProvider.getName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return "Exception getting name: " + ex.getLocalizedMessage();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItem.java
index 36e7ebb209f..3a78b51587d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItem.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import java.util.Collection;
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.ats.world.search.WorldSearchItem;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetOptionResolver;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class TaskEditorParameterSearchItem extends WorldSearchItem implements ITaskEditorProvider, IDynamicWidgetLayoutListener, IXWidgetOptionResolver {
-
- boolean firstTime = true;
-
- public TaskEditorParameterSearchItem(String name) {
- super(name, LoadView.TaskEditor, AtsImage.TASK);
- }
-
- public TaskEditorParameterSearchItem(WorldSearchItem worldSearchItem) {
- super(worldSearchItem, AtsImage.TASK);
- }
-
- @Override
- public WorldSearchItem copy() {
- return null;
- }
-
- public abstract String getParameterXWidgetXml() throws OseeCoreException;
-
- public abstract Result isParameterSelectionValid() throws OseeCoreException;
-
- public abstract Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException;
-
- @Override
- public String[] getWidgetOptions(DynamicXWidgetLayoutData widgetData) {
- return null;
- }
-
- /**
- * @return the firstTime
- */
- public boolean isFirstTime() {
- if (firstTime) {
- firstTime = false;
- return true;
- }
- return firstTime;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.task;
+
+import java.util.Collection;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.world.search.WorldSearchItem;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetOptionResolver;
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class TaskEditorParameterSearchItem extends WorldSearchItem implements ITaskEditorProvider, IDynamicWidgetLayoutListener, IXWidgetOptionResolver {
+
+ boolean firstTime = true;
+
+ public TaskEditorParameterSearchItem(String name) {
+ super(name, LoadView.TaskEditor, AtsImage.TASK);
+ }
+
+ public TaskEditorParameterSearchItem(WorldSearchItem worldSearchItem) {
+ super(worldSearchItem, AtsImage.TASK);
+ }
+
+ @Override
+ public WorldSearchItem copy() {
+ return null;
+ }
+
+ public abstract String getParameterXWidgetXml() throws OseeCoreException;
+
+ public abstract Result isParameterSelectionValid() throws OseeCoreException;
+
+ public abstract Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException;
+
+ @Override
+ public String[] getWidgetOptions(DynamicXWidgetLayoutData widgetData) {
+ return null;
+ }
+
+ /**
+ * @return the firstTime
+ */
+ public boolean isFirstTime() {
+ if (firstTime) {
+ firstTime = false;
+ return true;
+ }
+ return firstTime;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItemProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItemProvider.java
index c04f1b0b75f..33dca020602 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItemProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorParameterSearchItemProvider.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import java.util.Collection;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskEditorParameterSearchItemProvider extends TaskEditorProvider {
-
- private final TaskEditorParameterSearchItem taskParameterSearchItem;
-
- public TaskEditorParameterSearchItemProvider(TaskEditorParameterSearchItem worldParameterSearchItem) {
- this(worldParameterSearchItem, null, TableLoadOption.None);
- }
-
- public TaskEditorParameterSearchItemProvider(TaskEditorParameterSearchItem taskParameterSearchItem, CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
- super(customizeData, tableLoadOptions);
- this.taskParameterSearchItem = taskParameterSearchItem;
- }
-
- @Override
- public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException {
- return Strings.truncate(taskParameterSearchItem.getTaskEditorLabel(searchType), TaskEditor.TITLE_MAX_LENGTH, true);
- }
-
- @Override
- public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
- return taskParameterSearchItem.getTaskEditorTaskArtifacts();
- }
-
- public boolean isFirstTime() {
- return taskParameterSearchItem.isFirstTime();
- }
-
- @Override
- public String getName() throws OseeCoreException {
- return taskParameterSearchItem.getName();
- }
-
- /**
- * @return the worldSearchItem
- */
- public TaskEditorParameterSearchItem getWorldSearchItem() {
- return taskParameterSearchItem;
- }
-
- @Override
- public ITaskEditorProvider copyProvider() {
- return new TaskEditorParameterSearchItemProvider((TaskEditorParameterSearchItem) taskParameterSearchItem.copy(),
- customizeData, tableLoadOptions);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.task;
+
+import java.util.Collection;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskEditorParameterSearchItemProvider extends TaskEditorProvider {
+
+ private final TaskEditorParameterSearchItem taskParameterSearchItem;
+
+ public TaskEditorParameterSearchItemProvider(TaskEditorParameterSearchItem worldParameterSearchItem) {
+ this(worldParameterSearchItem, null, TableLoadOption.None);
+ }
+
+ public TaskEditorParameterSearchItemProvider(TaskEditorParameterSearchItem taskParameterSearchItem, CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
+ super(customizeData, tableLoadOptions);
+ this.taskParameterSearchItem = taskParameterSearchItem;
+ }
+
+ @Override
+ public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException {
+ return Strings.truncate(taskParameterSearchItem.getTaskEditorLabel(searchType), TaskEditor.TITLE_MAX_LENGTH, true);
+ }
+
+ @Override
+ public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
+ return taskParameterSearchItem.getTaskEditorTaskArtifacts();
+ }
+
+ public boolean isFirstTime() {
+ return taskParameterSearchItem.isFirstTime();
+ }
+
+ @Override
+ public String getName() throws OseeCoreException {
+ return taskParameterSearchItem.getName();
+ }
+
+ /**
+ * @return the worldSearchItem
+ */
+ public TaskEditorParameterSearchItem getWorldSearchItem() {
+ return taskParameterSearchItem;
+ }
+
+ @Override
+ public ITaskEditorProvider copyProvider() {
+ return new TaskEditorParameterSearchItemProvider((TaskEditorParameterSearchItem) taskParameterSearchItem.copy(),
+ customizeData, tableLoadOptions);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java
index 85e7a793828..52d17ab7350 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorProvider.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import java.util.Collection;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class TaskEditorProvider implements ITaskEditorProvider {
-
- protected TableLoadOption[] tableLoadOptions;
- protected CustomizeData customizeData;
-
- public TaskEditorProvider(CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
- this.customizeData = customizeData;
- this.tableLoadOptions = tableLoadOptions;
- }
-
- /**
- * @return the customizeData
- */
- public CustomizeData getCustomizeData() {
- return customizeData;
- }
-
- @Override
- public Collection<TableLoadOption> getTableLoadOptions() throws OseeCoreException {
- return Collections.getAggregate(tableLoadOptions);
- }
-
- /**
- * @param tableLoadOptions the tableLoadOptions to set
- */
- public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
- this.tableLoadOptions = tableLoadOptions;
- }
-
- /**
- * @param customizeData the customizeData to set
- */
- public void setCustomizeData(CustomizeData customizeData) {
- this.customizeData = customizeData;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.task;
+
+import java.util.Collection;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class TaskEditorProvider implements ITaskEditorProvider {
+
+ protected TableLoadOption[] tableLoadOptions;
+ protected CustomizeData customizeData;
+
+ public TaskEditorProvider(CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
+ this.customizeData = customizeData;
+ this.tableLoadOptions = tableLoadOptions;
+ }
+
+ /**
+ * @return the customizeData
+ */
+ public CustomizeData getCustomizeData() {
+ return customizeData;
+ }
+
+ @Override
+ public Collection<TableLoadOption> getTableLoadOptions() throws OseeCoreException {
+ return Collections.getAggregate(tableLoadOptions);
+ }
+
+ /**
+ * @param tableLoadOptions the tableLoadOptions to set
+ */
+ public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
+ this.tableLoadOptions = tableLoadOptions;
+ }
+
+ /**
+ * @param customizeData the customizeData to set
+ */
+ public void setCustomizeData(CustomizeData customizeData) {
+ this.customizeData = customizeData;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java
index 5051f58ee7a..57a4de910ae 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorSimpleProvider.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import java.util.Collection;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskEditorSimpleProvider extends TaskEditorProvider {
-
- private final String name;
- private final Collection<? extends Artifact> artifacts;
-
- public TaskEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts) {
- this(name, artifacts, null, TableLoadOption.None);
- }
-
- public TaskEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts, CustomizeData customizeData, TableLoadOption... tableLoadOption) {
- super(customizeData, tableLoadOption);
- this.name = name;
- this.artifacts = artifacts;
- }
-
- @Override
- public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException {
- return Strings.truncate(name, TaskEditor.TITLE_MAX_LENGTH, true);
- }
-
- @Override
- public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
- return artifacts;
- }
-
- @Override
- public String getName() throws OseeCoreException {
- return name;
- }
-
- @Override
- public ITaskEditorProvider copyProvider() {
- return new TaskEditorSimpleProvider(name, artifacts, customizeData, tableLoadOptions);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.task;
+
+import java.util.Collection;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskEditorSimpleProvider extends TaskEditorProvider {
+
+ private final String name;
+ private final Collection<? extends Artifact> artifacts;
+
+ public TaskEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts) {
+ this(name, artifacts, null, TableLoadOption.None);
+ }
+
+ public TaskEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts, CustomizeData customizeData, TableLoadOption... tableLoadOption) {
+ super(customizeData, tableLoadOption);
+ this.name = name;
+ this.artifacts = artifacts;
+ }
+
+ @Override
+ public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException {
+ return Strings.truncate(name, TaskEditor.TITLE_MAX_LENGTH, true);
+ }
+
+ @Override
+ public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
+ return artifacts;
+ }
+
+ @Override
+ public String getName() throws OseeCoreException {
+ return name;
+ }
+
+ @Override
+ public ITaskEditorProvider copyProvider() {
+ return new TaskEditorSimpleProvider(name, artifacts, customizeData, tableLoadOptions);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java
index 103d8ff553c..77a351c2276 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java
@@ -1,379 +1,379 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.ats.actions.ImportTasksViaSimpleList;
-import org.eclipse.osee.ats.actions.ImportTasksViaSpreadsheet;
-import org.eclipse.osee.ats.actions.NewAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected;
-import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
-import org.eclipse.osee.ats.export.AtsExportManager;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.SMAMetrics;
-import org.eclipse.osee.ats.world.AtsXWidgetActionFormPage;
-import org.eclipse.osee.ats.world.WorldAssigneeFilter;
-import org.eclipse.osee.ats.world.WorldCompletedFilter;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.IActionable;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskEditorXWidgetActionPage extends AtsXWidgetActionFormPage implements IActionable {
-
- private final TaskEditor taskEditor;
- private TaskComposite taskComposite;
- private static String HELP_CONTEXT_ID = "atsWorkflowEditorTaskTab";
- private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
- private WorldAssigneeFilter worldAssigneeFilter = null;
- private Action filterCompletedAction, filterMyAssigneeAction, selectionMetricsAction;
-
- public TaskEditorXWidgetActionPage(TaskEditor taskEditor) {
- super(taskEditor, "org.eclipse.osee.ats.actionPage", "Actions");
- this.taskEditor = taskEditor;
- }
-
- @Override
- public Section createResultsSection(Composite body) throws OseeCoreException {
- resultsSection = toolkit.createSection(body, Section.NO_TITLE);
- resultsSection.setText("Results");
- resultsSection.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- resultsContainer = toolkit.createClientContainer(resultsSection, 1);
- taskComposite = new TaskComposite(taskEditor, resultsContainer, SWT.BORDER, null);
- AtsPlugin.getInstance().setHelp(taskComposite, HELP_CONTEXT_ID, "org.eclipse.osee.ats.help.ui");
- return resultsSection;
- }
-
- public TaskComposite getTaskComposite() {
- return taskComposite;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- scrolledForm.setImage(ImageManager.getImage(AtsImage.TASK));
-
- Result result = AtsPlugin.areOSEEServicesAvailable();
- if (result.isFalse()) {
- AWorkbench.popup("ERROR", "DB Connection Unavailable");
- return;
- }
- }
-
- @Override
- public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
- if (taskEditor.getTaskEditorProvider() instanceof TaskEditorParameterSearchItemProvider) {
- return ((TaskEditorParameterSearchItemProvider) taskEditor.getTaskEditorProvider()).getWorldSearchItem();
- }
- return null;
- }
-
- @Override
- public Result isResearchSearchValid() throws OseeCoreException {
- return taskEditor.isDirty() ? new Result("Changes un-saved. Save first.") : Result.TrueResult;
- }
-
- public void reSearch() throws OseeCoreException {
- Result result = isResearchSearchValid();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- taskEditor.handleRefreshAction();
- }
-
- @Override
- public String getXWidgetsXml() throws OseeCoreException {
- if (taskEditor.getTaskEditorProvider() instanceof TaskEditorParameterSearchItemProvider) {
- return ((TaskEditorParameterSearchItemProvider) taskEditor.getTaskEditorProvider()).getWorldSearchItem().getParameterXWidgetXml();
- }
- return null;
- }
-
- @Override
- public void handleSearchButtonPressed() {
- try {
- reSearch();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public String getActionDescription() {
- return taskComposite.getActionDescription();
- }
-
- @Override
- protected void createToolBar(IToolBarManager toolBarManager) {
- super.createToolBar(toolBarManager);
-
- toolBarManager.add(taskComposite.getTaskXViewer().getCustomizeAction());
- toolBarManager.add(new Separator());
- toolBarManager.add(new OpenNewAtsTaskEditorAction(taskComposite));
- toolBarManager.add(new OpenNewAtsTaskEditorSelected(taskComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new RefreshAction(taskComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new NewAction());
- OseeUiActions.addButtonToEditorToolBar(taskEditor, taskEditor, AtsPlugin.getInstance(), toolBarManager,
- TaskEditor.EDITOR_ID, "ATS Task Tab");
- toolBarManager.add(new Separator());
- createDropDownMenuActions();
- toolBarManager.add(new DropDownAction());
- }
- public class DropDownAction extends Action implements IMenuCreator {
- private Menu fMenu;
-
- public DropDownAction() {
- setText("Other");
- setMenuCreator(this);
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
- addKeyListener();
- addSelectionListener();
- }
-
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu = new Menu(parent);
- addActionToMenu(fMenu, selectionMetricsAction);
- addActionToMenu(fMenu, filterCompletedAction);
- addActionToMenu(fMenu, filterMyAssigneeAction);
- new MenuItem(fMenu, SWT.SEPARATOR);
- addActionToMenu(fMenu, new AtsExportManager(taskComposite.getTaskXViewer()));
- try {
- if (taskComposite.getIXTaskViewer().isTaskable()) {
- addActionToMenu(fMenu, new ImportTasksViaSpreadsheet(
- (TaskableStateMachineArtifact) taskComposite.getIXTaskViewer().getSma(), new Listener() {
- @Override
- public void handleEvent(Event event) {
- try {
- taskComposite.loadTable();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }));
- addActionToMenu(fMenu, new ImportTasksViaSimpleList(
- (TaskableStateMachineArtifact) taskComposite.getIXTaskViewer().getSma(), new Listener() {
- @Override
- public void handleEvent(Event event) {
- try {
- taskComposite.loadTable();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }));
-
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- return fMenu;
- }
-
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- fMenu = null;
- }
- }
-
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- @Override
- public void run() {
-
- }
-
- void clear() {
- dispose();
- }
-
- private void addKeyListener() {
- taskComposite.getTaskXViewer().getTree().addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- }
-
- public void keyReleased(KeyEvent event) {
- if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
- if (event.keyCode == 'a') {
- taskComposite.getTaskXViewer().getTree().setSelection(
- taskComposite.getTaskXViewer().getTree().getItems());
- } else if (event.keyCode == 'x') {
- selectionMetricsAction.setChecked(!selectionMetricsAction.isChecked());
- selectionMetricsAction.run();
- } else if (event.keyCode == 'f') {
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- } else if (event.keyCode == 'g') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterMyAssigneeAction.run();
- } else if (event.keyCode == 'd') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- filterMyAssigneeAction.run();
- }
- }
- }
- });
- }
-
- private void addSelectionListener() {
- taskComposite.getTaskXViewer().getTree().addSelectionListener(new SelectionListener() {
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (selectionMetricsAction != null) {
- if (selectionMetricsAction.isChecked()) {
- selectionMetricsAction.run();
- } else {
- if (taskComposite != null) {
- taskComposite.showReleaseMetricsLabel.setText("");
- }
- }
- }
- }
- });
- }
- }
-
- public void updateExtraInfoLine() throws OseeCoreException {
- if (selectionMetricsAction != null && selectionMetricsAction.isChecked()) {
- if (taskComposite.getTaskXViewer() != null && taskComposite.getTaskXViewer().getSelectedSMAArtifacts() != null && !taskComposite.getTaskXViewer().getSelectedSMAArtifacts().isEmpty()) {
- taskComposite.showReleaseMetricsLabel.setText(SMAMetrics.getEstRemainMetrics(
- taskComposite.getTaskXViewer().getSelectedSMAArtifacts(),
- null,
- taskComposite.getTaskXViewer().getSelectedSMAArtifacts().iterator().next().getManHrsPerDayPreference(),
- null));
- } else {
- taskComposite.showReleaseMetricsLabel.setText("");
- }
- }
- taskComposite.showReleaseMetricsLabel.getParent().layout();
- }
-
- public void updateExtendedStatusString() {
- taskComposite.getTaskXViewer().setExtendedStatusString(
- //
- (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
- //
- (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
- }
-
- protected void createDropDownMenuActions() {
- try {
- worldAssigneeFilter = new WorldAssigneeFilter();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- selectionMetricsAction = new Action("Show Release Metrics by Selection - Ctrl-X", Action.AS_CHECK_BOX) {
- @Override
- public void run() {
- try {
- updateExtraInfoLine();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
- selectionMetricsAction.setToolTipText("Show Release Metrics by Selection - Ctrl-X");
- selectionMetricsAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PAGE));
-
- filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", Action.AS_CHECK_BOX) {
- @Override
- public void run() {
- if (filterCompletedAction.isChecked()) {
- taskComposite.getTaskXViewer().addFilter(worldCompletedFilter);
- } else {
- taskComposite.getTaskXViewer().removeFilter(worldCompletedFilter);
- }
- updateExtendedStatusString();
- taskComposite.getTaskXViewer().refresh();
- }
- };
- filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
- filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
-
- filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", Action.AS_CHECK_BOX) {
-
- @Override
- public void run() {
- if (filterMyAssigneeAction.isChecked()) {
- taskComposite.getTaskXViewer().addFilter(worldAssigneeFilter);
- } else {
- taskComposite.getTaskXViewer().removeFilter(worldAssigneeFilter);
- }
- updateExtendedStatusString();
- taskComposite.getTaskXViewer().refresh();
- }
- };
- filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
- filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
- }
-
- @Override
- public void handleSaveButtonPressed() {
- }
-
- @Override
- public boolean isSaveButtonAvailable() {
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.task;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.actions.ImportTasksViaSimpleList;
+import org.eclipse.osee.ats.actions.ImportTasksViaSpreadsheet;
+import org.eclipse.osee.ats.actions.NewAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected;
+import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
+import org.eclipse.osee.ats.export.AtsExportManager;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.SMAMetrics;
+import org.eclipse.osee.ats.world.AtsXWidgetActionFormPage;
+import org.eclipse.osee.ats.world.WorldAssigneeFilter;
+import org.eclipse.osee.ats.world.WorldCompletedFilter;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskEditorXWidgetActionPage extends AtsXWidgetActionFormPage implements IActionable {
+
+ private final TaskEditor taskEditor;
+ private TaskComposite taskComposite;
+ private static String HELP_CONTEXT_ID = "atsWorkflowEditorTaskTab";
+ private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
+ private WorldAssigneeFilter worldAssigneeFilter = null;
+ private Action filterCompletedAction, filterMyAssigneeAction, selectionMetricsAction;
+
+ public TaskEditorXWidgetActionPage(TaskEditor taskEditor) {
+ super(taskEditor, "org.eclipse.osee.ats.actionPage", "Actions");
+ this.taskEditor = taskEditor;
+ }
+
+ @Override
+ public Section createResultsSection(Composite body) throws OseeCoreException {
+ resultsSection = toolkit.createSection(body, Section.NO_TITLE);
+ resultsSection.setText("Results");
+ resultsSection.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ resultsContainer = toolkit.createClientContainer(resultsSection, 1);
+ taskComposite = new TaskComposite(taskEditor, resultsContainer, SWT.BORDER, null);
+ AtsPlugin.getInstance().setHelp(taskComposite, HELP_CONTEXT_ID, "org.eclipse.osee.ats.help.ui");
+ return resultsSection;
+ }
+
+ public TaskComposite getTaskComposite() {
+ return taskComposite;
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
+ scrolledForm.setImage(ImageManager.getImage(AtsImage.TASK));
+
+ Result result = AtsPlugin.areOSEEServicesAvailable();
+ if (result.isFalse()) {
+ AWorkbench.popup("ERROR", "DB Connection Unavailable");
+ return;
+ }
+ }
+
+ @Override
+ public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
+ if (taskEditor.getTaskEditorProvider() instanceof TaskEditorParameterSearchItemProvider) {
+ return ((TaskEditorParameterSearchItemProvider) taskEditor.getTaskEditorProvider()).getWorldSearchItem();
+ }
+ return null;
+ }
+
+ @Override
+ public Result isResearchSearchValid() throws OseeCoreException {
+ return taskEditor.isDirty() ? new Result("Changes un-saved. Save first.") : Result.TrueResult;
+ }
+
+ public void reSearch() throws OseeCoreException {
+ Result result = isResearchSearchValid();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ taskEditor.handleRefreshAction();
+ }
+
+ @Override
+ public String getXWidgetsXml() throws OseeCoreException {
+ if (taskEditor.getTaskEditorProvider() instanceof TaskEditorParameterSearchItemProvider) {
+ return ((TaskEditorParameterSearchItemProvider) taskEditor.getTaskEditorProvider()).getWorldSearchItem().getParameterXWidgetXml();
+ }
+ return null;
+ }
+
+ @Override
+ public void handleSearchButtonPressed() {
+ try {
+ reSearch();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public String getActionDescription() {
+ return taskComposite.getActionDescription();
+ }
+
+ @Override
+ protected void createToolBar(IToolBarManager toolBarManager) {
+ super.createToolBar(toolBarManager);
+
+ toolBarManager.add(taskComposite.getTaskXViewer().getCustomizeAction());
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new OpenNewAtsTaskEditorAction(taskComposite));
+ toolBarManager.add(new OpenNewAtsTaskEditorSelected(taskComposite));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new RefreshAction(taskComposite));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new NewAction());
+ OseeUiActions.addButtonToEditorToolBar(taskEditor, taskEditor, AtsPlugin.getInstance(), toolBarManager,
+ TaskEditor.EDITOR_ID, "ATS Task Tab");
+ toolBarManager.add(new Separator());
+ createDropDownMenuActions();
+ toolBarManager.add(new DropDownAction());
+ }
+ public class DropDownAction extends Action implements IMenuCreator {
+ private Menu fMenu;
+
+ public DropDownAction() {
+ setText("Other");
+ setMenuCreator(this);
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
+ addKeyListener();
+ addSelectionListener();
+ }
+
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fMenu = new Menu(parent);
+ addActionToMenu(fMenu, selectionMetricsAction);
+ addActionToMenu(fMenu, filterCompletedAction);
+ addActionToMenu(fMenu, filterMyAssigneeAction);
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ addActionToMenu(fMenu, new AtsExportManager(taskComposite.getTaskXViewer()));
+ try {
+ if (taskComposite.getIXTaskViewer().isTaskable()) {
+ addActionToMenu(fMenu, new ImportTasksViaSpreadsheet(
+ (TaskableStateMachineArtifact) taskComposite.getIXTaskViewer().getSma(), new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ taskComposite.loadTable();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }));
+ addActionToMenu(fMenu, new ImportTasksViaSimpleList(
+ (TaskableStateMachineArtifact) taskComposite.getIXTaskViewer().getSma(), new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ taskComposite.loadTable();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }));
+
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ return fMenu;
+ }
+
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ @Override
+ public void run() {
+
+ }
+
+ void clear() {
+ dispose();
+ }
+
+ private void addKeyListener() {
+ taskComposite.getTaskXViewer().getTree().addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent event) {
+ }
+
+ public void keyReleased(KeyEvent event) {
+ if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
+ if (event.keyCode == 'a') {
+ taskComposite.getTaskXViewer().getTree().setSelection(
+ taskComposite.getTaskXViewer().getTree().getItems());
+ } else if (event.keyCode == 'x') {
+ selectionMetricsAction.setChecked(!selectionMetricsAction.isChecked());
+ selectionMetricsAction.run();
+ } else if (event.keyCode == 'f') {
+ filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
+ filterCompletedAction.run();
+ } else if (event.keyCode == 'g') {
+ filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
+ filterMyAssigneeAction.run();
+ } else if (event.keyCode == 'd') {
+ filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
+ filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
+ filterCompletedAction.run();
+ filterMyAssigneeAction.run();
+ }
+ }
+ }
+ });
+ }
+
+ private void addSelectionListener() {
+ taskComposite.getTaskXViewer().getTree().addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (selectionMetricsAction != null) {
+ if (selectionMetricsAction.isChecked()) {
+ selectionMetricsAction.run();
+ } else {
+ if (taskComposite != null) {
+ taskComposite.showReleaseMetricsLabel.setText("");
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+
+ public void updateExtraInfoLine() throws OseeCoreException {
+ if (selectionMetricsAction != null && selectionMetricsAction.isChecked()) {
+ if (taskComposite.getTaskXViewer() != null && taskComposite.getTaskXViewer().getSelectedSMAArtifacts() != null && !taskComposite.getTaskXViewer().getSelectedSMAArtifacts().isEmpty()) {
+ taskComposite.showReleaseMetricsLabel.setText(SMAMetrics.getEstRemainMetrics(
+ taskComposite.getTaskXViewer().getSelectedSMAArtifacts(),
+ null,
+ taskComposite.getTaskXViewer().getSelectedSMAArtifacts().iterator().next().getManHrsPerDayPreference(),
+ null));
+ } else {
+ taskComposite.showReleaseMetricsLabel.setText("");
+ }
+ }
+ taskComposite.showReleaseMetricsLabel.getParent().layout();
+ }
+
+ public void updateExtendedStatusString() {
+ taskComposite.getTaskXViewer().setExtendedStatusString(
+ //
+ (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
+ //
+ (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
+ }
+
+ protected void createDropDownMenuActions() {
+ try {
+ worldAssigneeFilter = new WorldAssigneeFilter();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ selectionMetricsAction = new Action("Show Release Metrics by Selection - Ctrl-X", Action.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ try {
+ updateExtraInfoLine();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+ selectionMetricsAction.setToolTipText("Show Release Metrics by Selection - Ctrl-X");
+ selectionMetricsAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PAGE));
+
+ filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", Action.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ if (filterCompletedAction.isChecked()) {
+ taskComposite.getTaskXViewer().addFilter(worldCompletedFilter);
+ } else {
+ taskComposite.getTaskXViewer().removeFilter(worldCompletedFilter);
+ }
+ updateExtendedStatusString();
+ taskComposite.getTaskXViewer().refresh();
+ }
+ };
+ filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
+ filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
+
+ filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", Action.AS_CHECK_BOX) {
+
+ @Override
+ public void run() {
+ if (filterMyAssigneeAction.isChecked()) {
+ taskComposite.getTaskXViewer().addFilter(worldAssigneeFilter);
+ } else {
+ taskComposite.getTaskXViewer().removeFilter(worldAssigneeFilter);
+ }
+ updateExtendedStatusString();
+ taskComposite.getTaskXViewer().refresh();
+ }
+ };
+ filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
+ filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
+ }
+
+ @Override
+ public void handleSaveButtonPressed() {
+ }
+
+ @Override
+ public boolean isSaveButtonAvailable() {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java
index a2dbb26f31e..24a0fc84f15 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java
@@ -1,312 +1,312 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.osee.ats.actions.ImportTasksViaSimpleList;
-import org.eclipse.osee.ats.actions.ImportTasksViaSpreadsheet;
-import org.eclipse.osee.ats.actions.NewAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected;
-import org.eclipse.osee.ats.actions.TaskAddAction;
-import org.eclipse.osee.ats.actions.TaskDeleteAction;
-import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
-import org.eclipse.osee.ats.editor.SMAEditor;
-import org.eclipse.osee.ats.export.AtsExportManager;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.world.AtsXWidgetActionFormPage;
-import org.eclipse.osee.ats.world.WorldAssigneeFilter;
-import org.eclipse.osee.ats.world.WorldCompletedFilter;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.IActionable;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskTabXWidgetActionPage extends AtsXWidgetActionFormPage implements IActionable {
-
- private final SMAEditor smaEditor;
- private TaskComposite taskComposite;
- private static String HELP_CONTEXT_ID = "atsWorkflowEditorTaskTab";
- private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
- private WorldAssigneeFilter worldAssigneeFilter = null;
- private Action filterCompletedAction, filterMyAssigneeAction;
-
- public TaskTabXWidgetActionPage(SMAEditor smaEditor) {
- super(smaEditor, "org.eclipse.osee.ats.actionPage", "Tasks");
- this.smaEditor = smaEditor;
- }
-
- @Override
- public Section createResultsSection(Composite body) throws OseeCoreException {
- resultsSection = toolkit.createSection(body, Section.NO_TITLE);
- resultsSection.setText("Results");
- resultsSection.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- resultsContainer = toolkit.createClientContainer(resultsSection, 1);
- taskComposite = new TaskComposite(smaEditor, resultsContainer, SWT.BORDER, null);
- AtsPlugin.getInstance().setHelp(taskComposite, HELP_CONTEXT_ID, "org.eclipse.osee.ats.help.ui");
- taskComposite.loadTable();
- return resultsSection;
- }
-
- public TaskComposite getTaskComposite() {
- return taskComposite;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- scrolledForm.setImage(ArtifactImageManager.getImage(smaEditor.getSma()));
- String title = smaEditor.getSma().getName();
- if (title.length() > 80) {
- title = title.substring(0, 80 - 1) + "...";
- }
- scrolledForm.setText(String.format("Tasks for \"%s\"", title));
-
- Result result = AtsPlugin.areOSEEServicesAvailable();
- if (result.isFalse()) {
- AWorkbench.popup("ERROR", "DB Connection Unavailable");
- return;
- }
- }
-
- @Override
- public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
- return null;
- }
-
- @Override
- public Result isResearchSearchValid() throws OseeCoreException {
- return smaEditor.isDirty() ? new Result("Changes un-saved. Save first.") : Result.TrueResult;
- }
-
- public void reSearch() throws OseeCoreException {
- }
-
- @Override
- public String getXWidgetsXml() throws OseeCoreException {
- return null;
- }
-
- @Override
- public void handleSearchButtonPressed() {
- try {
- reSearch();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public String getActionDescription() {
- return taskComposite.getActionDescription();
- }
-
- @Override
- protected void createToolBar(IToolBarManager toolBarManager) {
- super.createToolBar(toolBarManager);
-
- try {
- if (taskComposite.getIXTaskViewer().isTaskable()) {
- toolBarManager.add(new TaskAddAction(taskComposite));
- toolBarManager.add(new TaskDeleteAction(taskComposite));
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
- }
- toolBarManager.add(new Separator());
- toolBarManager.add(taskComposite.getTaskXViewer().getCustomizeAction());
- toolBarManager.add(new Separator());
- toolBarManager.add(new OpenNewAtsTaskEditorAction(taskComposite));
- toolBarManager.add(new OpenNewAtsTaskEditorSelected(taskComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new RefreshAction(taskComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new NewAction());
- OseeUiActions.addButtonToEditorToolBar(smaEditor, smaEditor, AtsPlugin.getInstance(), toolBarManager,
- TaskEditor.EDITOR_ID, "ATS Task Tab");
- toolBarManager.add(new Separator());
- createDropDownMenuActions();
- toolBarManager.add(new DropDownAction());
-
- }
-
- public class DropDownAction extends Action implements IMenuCreator {
- private Menu fMenu;
-
- public DropDownAction() {
- setText("Other");
- setMenuCreator(this);
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
- addKeyListener();
- }
-
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu = new Menu(parent);
-
- addActionToMenu(fMenu, filterCompletedAction);
- addActionToMenu(fMenu, filterMyAssigneeAction);
- new MenuItem(fMenu, SWT.SEPARATOR);
- addActionToMenu(fMenu, new AtsExportManager(taskComposite.getTaskXViewer()));
- try {
- if (taskComposite.getIXTaskViewer().isTaskable()) {
- addActionToMenu(fMenu, new ImportTasksViaSpreadsheet(
- (TaskableStateMachineArtifact) taskComposite.getIXTaskViewer().getSma(), null));
- addActionToMenu(fMenu, new ImportTasksViaSimpleList(
- (TaskableStateMachineArtifact) taskComposite.getIXTaskViewer().getSma(), null));
-
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- return fMenu;
- }
-
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- fMenu = null;
- }
- }
-
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- @Override
- public void run() {
-
- }
-
- void clear() {
- dispose();
- }
-
- private void addKeyListener() {
- taskComposite.getTaskXViewer().getTree().addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- }
-
- public void keyReleased(KeyEvent event) {
- if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
- if (event.keyCode == 'a') {
- taskComposite.getTaskXViewer().getTree().setSelection(
- taskComposite.getTaskXViewer().getTree().getItems());
- } else if (event.keyCode == 'f') {
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- } else if (event.keyCode == 'g') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterMyAssigneeAction.run();
- } else if (event.keyCode == 'd') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- filterMyAssigneeAction.run();
- }
- }
- }
- });
- }
- }
-
- public void updateExtendedStatusString() {
- taskComposite.getTaskXViewer().setExtendedStatusString(
- //
- (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
- //
- (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
- }
-
- protected void createDropDownMenuActions() {
- try {
- worldAssigneeFilter = new WorldAssigneeFilter();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", Action.AS_CHECK_BOX) {
-
- @Override
- public void run() {
- if (filterCompletedAction.isChecked()) {
- taskComposite.getTaskXViewer().addFilter(worldCompletedFilter);
- } else {
- taskComposite.getTaskXViewer().removeFilter(worldCompletedFilter);
- }
- updateExtendedStatusString();
- taskComposite.getTaskXViewer().refresh();
- }
- };
- filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
- filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
-
- filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", Action.AS_CHECK_BOX) {
-
- @Override
- public void run() {
- if (filterMyAssigneeAction.isChecked()) {
- taskComposite.getTaskXViewer().addFilter(worldAssigneeFilter);
- } else {
- taskComposite.getTaskXViewer().removeFilter(worldAssigneeFilter);
- }
- updateExtendedStatusString();
- taskComposite.getTaskXViewer().refresh();
- }
- };
- filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
- filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
- }
-
- @Override
- public void handleSaveButtonPressed() {
- }
-
- @Override
- public boolean isSaveButtonAvailable() {
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.task;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.osee.ats.actions.ImportTasksViaSimpleList;
+import org.eclipse.osee.ats.actions.ImportTasksViaSpreadsheet;
+import org.eclipse.osee.ats.actions.NewAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected;
+import org.eclipse.osee.ats.actions.TaskAddAction;
+import org.eclipse.osee.ats.actions.TaskDeleteAction;
+import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
+import org.eclipse.osee.ats.editor.SMAEditor;
+import org.eclipse.osee.ats.export.AtsExportManager;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.world.AtsXWidgetActionFormPage;
+import org.eclipse.osee.ats.world.WorldAssigneeFilter;
+import org.eclipse.osee.ats.world.WorldCompletedFilter;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskTabXWidgetActionPage extends AtsXWidgetActionFormPage implements IActionable {
+
+ private final SMAEditor smaEditor;
+ private TaskComposite taskComposite;
+ private static String HELP_CONTEXT_ID = "atsWorkflowEditorTaskTab";
+ private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
+ private WorldAssigneeFilter worldAssigneeFilter = null;
+ private Action filterCompletedAction, filterMyAssigneeAction;
+
+ public TaskTabXWidgetActionPage(SMAEditor smaEditor) {
+ super(smaEditor, "org.eclipse.osee.ats.actionPage", "Tasks");
+ this.smaEditor = smaEditor;
+ }
+
+ @Override
+ public Section createResultsSection(Composite body) throws OseeCoreException {
+ resultsSection = toolkit.createSection(body, Section.NO_TITLE);
+ resultsSection.setText("Results");
+ resultsSection.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ resultsContainer = toolkit.createClientContainer(resultsSection, 1);
+ taskComposite = new TaskComposite(smaEditor, resultsContainer, SWT.BORDER, null);
+ AtsPlugin.getInstance().setHelp(taskComposite, HELP_CONTEXT_ID, "org.eclipse.osee.ats.help.ui");
+ taskComposite.loadTable();
+ return resultsSection;
+ }
+
+ public TaskComposite getTaskComposite() {
+ return taskComposite;
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
+ scrolledForm.setImage(ArtifactImageManager.getImage(smaEditor.getSma()));
+ String title = smaEditor.getSma().getName();
+ if (title.length() > 80) {
+ title = title.substring(0, 80 - 1) + "...";
+ }
+ scrolledForm.setText(String.format("Tasks for \"%s\"", title));
+
+ Result result = AtsPlugin.areOSEEServicesAvailable();
+ if (result.isFalse()) {
+ AWorkbench.popup("ERROR", "DB Connection Unavailable");
+ return;
+ }
+ }
+
+ @Override
+ public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
+ return null;
+ }
+
+ @Override
+ public Result isResearchSearchValid() throws OseeCoreException {
+ return smaEditor.isDirty() ? new Result("Changes un-saved. Save first.") : Result.TrueResult;
+ }
+
+ public void reSearch() throws OseeCoreException {
+ }
+
+ @Override
+ public String getXWidgetsXml() throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public void handleSearchButtonPressed() {
+ try {
+ reSearch();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public String getActionDescription() {
+ return taskComposite.getActionDescription();
+ }
+
+ @Override
+ protected void createToolBar(IToolBarManager toolBarManager) {
+ super.createToolBar(toolBarManager);
+
+ try {
+ if (taskComposite.getIXTaskViewer().isTaskable()) {
+ toolBarManager.add(new TaskAddAction(taskComposite));
+ toolBarManager.add(new TaskDeleteAction(taskComposite));
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ toolBarManager.add(new Separator());
+ toolBarManager.add(taskComposite.getTaskXViewer().getCustomizeAction());
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new OpenNewAtsTaskEditorAction(taskComposite));
+ toolBarManager.add(new OpenNewAtsTaskEditorSelected(taskComposite));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new RefreshAction(taskComposite));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new NewAction());
+ OseeUiActions.addButtonToEditorToolBar(smaEditor, smaEditor, AtsPlugin.getInstance(), toolBarManager,
+ TaskEditor.EDITOR_ID, "ATS Task Tab");
+ toolBarManager.add(new Separator());
+ createDropDownMenuActions();
+ toolBarManager.add(new DropDownAction());
+
+ }
+
+ public class DropDownAction extends Action implements IMenuCreator {
+ private Menu fMenu;
+
+ public DropDownAction() {
+ setText("Other");
+ setMenuCreator(this);
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
+ addKeyListener();
+ }
+
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fMenu = new Menu(parent);
+
+ addActionToMenu(fMenu, filterCompletedAction);
+ addActionToMenu(fMenu, filterMyAssigneeAction);
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ addActionToMenu(fMenu, new AtsExportManager(taskComposite.getTaskXViewer()));
+ try {
+ if (taskComposite.getIXTaskViewer().isTaskable()) {
+ addActionToMenu(fMenu, new ImportTasksViaSpreadsheet(
+ (TaskableStateMachineArtifact) taskComposite.getIXTaskViewer().getSma(), null));
+ addActionToMenu(fMenu, new ImportTasksViaSimpleList(
+ (TaskableStateMachineArtifact) taskComposite.getIXTaskViewer().getSma(), null));
+
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ return fMenu;
+ }
+
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ @Override
+ public void run() {
+
+ }
+
+ void clear() {
+ dispose();
+ }
+
+ private void addKeyListener() {
+ taskComposite.getTaskXViewer().getTree().addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent event) {
+ }
+
+ public void keyReleased(KeyEvent event) {
+ if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
+ if (event.keyCode == 'a') {
+ taskComposite.getTaskXViewer().getTree().setSelection(
+ taskComposite.getTaskXViewer().getTree().getItems());
+ } else if (event.keyCode == 'f') {
+ filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
+ filterCompletedAction.run();
+ } else if (event.keyCode == 'g') {
+ filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
+ filterMyAssigneeAction.run();
+ } else if (event.keyCode == 'd') {
+ filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
+ filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
+ filterCompletedAction.run();
+ filterMyAssigneeAction.run();
+ }
+ }
+ }
+ });
+ }
+ }
+
+ public void updateExtendedStatusString() {
+ taskComposite.getTaskXViewer().setExtendedStatusString(
+ //
+ (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
+ //
+ (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
+ }
+
+ protected void createDropDownMenuActions() {
+ try {
+ worldAssigneeFilter = new WorldAssigneeFilter();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", Action.AS_CHECK_BOX) {
+
+ @Override
+ public void run() {
+ if (filterCompletedAction.isChecked()) {
+ taskComposite.getTaskXViewer().addFilter(worldCompletedFilter);
+ } else {
+ taskComposite.getTaskXViewer().removeFilter(worldCompletedFilter);
+ }
+ updateExtendedStatusString();
+ taskComposite.getTaskXViewer().refresh();
+ }
+ };
+ filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
+ filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
+
+ filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", Action.AS_CHECK_BOX) {
+
+ @Override
+ public void run() {
+ if (filterMyAssigneeAction.isChecked()) {
+ taskComposite.getTaskXViewer().addFilter(worldAssigneeFilter);
+ } else {
+ taskComposite.getTaskXViewer().removeFilter(worldAssigneeFilter);
+ }
+ updateExtendedStatusString();
+ taskComposite.getTaskXViewer().refresh();
+ }
+ };
+ filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
+ filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
+ }
+
+ @Override
+ public void handleSaveButtonPressed() {
+ }
+
+ @Override
+ public boolean isSaveButtonAvailable() {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewerFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewerFactory.java
index 2e4a5e8cd34..58ff00aae09 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewerFactory.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewerFactory.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * 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.ats.task;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerSorter;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.world.AtsWorldEditorItems;
-import org.eclipse.osee.ats.world.IAtsWorldEditorItem;
-import org.eclipse.osee.ats.world.WorldXViewerFactory;
-import org.eclipse.osee.ats.world.WorldXViewerSorter;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskXViewerFactory extends SkynetXViewerFactory {
-
- public static final List<XViewerColumn> TaskViewerVisibleColumns =
- Arrays.asList(WorldXViewerFactory.Title_Col, WorldXViewerFactory.State_Col, WorldXViewerFactory.Assignees_Col,
- WorldXViewerFactory.Percent_Complete_Total_Col, WorldXViewerFactory.Total_Hours_Spent_Col,
- WorldXViewerFactory.Resolution_Col, WorldXViewerFactory.Estimated_Hours_Col,
- WorldXViewerFactory.Remaining_Hours_Col, WorldXViewerFactory.Related_To_State_Col,
- WorldXViewerFactory.Notes_Col);
- public static Integer[] widths = new Integer[] {450, 60, 150, 40, 40, 100, 50, 50, 50, 80, 80};
-
- public TaskXViewerFactory() {
- super("org.eclipse.osee.ats.TaskXViewer");
- int widthIndex = 0;
- // Create new column from world columns but set show and width for task
- for (XViewerColumn taskCol : TaskViewerVisibleColumns) {
- XViewerColumn newCol = taskCol.copy();
- newCol.setShow(true);
- newCol.setWidth(widths[widthIndex++]);
- registerColumns(newCol);
- }
- // Add remaining columns from world columns
- for (XViewerColumn worldCol : WorldXViewerFactory.WorldViewColumns) {
- if (!TaskViewerVisibleColumns.contains(worldCol)) {
- XViewerColumn newCol = worldCol.copy();
- newCol.setShow(false);
- registerColumns(newCol);
- }
- }
- // Register any columns from other plugins
- try {
- for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
- for (XViewerColumn xCol : item.getXViewerColumns()) {
- registerColumns(xCol);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- registerAllAttributeColumns();
- }
-
- @Override
- public XViewerSorter createNewXSorter(XViewer xViewer) {
- return new WorldXViewerSorter(xViewer);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.task;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerSorter;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.world.AtsWorldEditorItems;
+import org.eclipse.osee.ats.world.IAtsWorldEditorItem;
+import org.eclipse.osee.ats.world.WorldXViewerFactory;
+import org.eclipse.osee.ats.world.WorldXViewerSorter;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskXViewerFactory extends SkynetXViewerFactory {
+
+ public static final List<XViewerColumn> TaskViewerVisibleColumns =
+ Arrays.asList(WorldXViewerFactory.Title_Col, WorldXViewerFactory.State_Col, WorldXViewerFactory.Assignees_Col,
+ WorldXViewerFactory.Percent_Complete_Total_Col, WorldXViewerFactory.Total_Hours_Spent_Col,
+ WorldXViewerFactory.Resolution_Col, WorldXViewerFactory.Estimated_Hours_Col,
+ WorldXViewerFactory.Remaining_Hours_Col, WorldXViewerFactory.Related_To_State_Col,
+ WorldXViewerFactory.Notes_Col);
+ public static Integer[] widths = new Integer[] {450, 60, 150, 40, 40, 100, 50, 50, 50, 80, 80};
+
+ public TaskXViewerFactory() {
+ super("org.eclipse.osee.ats.TaskXViewer");
+ int widthIndex = 0;
+ // Create new column from world columns but set show and width for task
+ for (XViewerColumn taskCol : TaskViewerVisibleColumns) {
+ XViewerColumn newCol = taskCol.copy();
+ newCol.setShow(true);
+ newCol.setWidth(widths[widthIndex++]);
+ registerColumns(newCol);
+ }
+ // Add remaining columns from world columns
+ for (XViewerColumn worldCol : WorldXViewerFactory.WorldViewColumns) {
+ if (!TaskViewerVisibleColumns.contains(worldCol)) {
+ XViewerColumn newCol = worldCol.copy();
+ newCol.setShow(false);
+ registerColumns(newCol);
+ }
+ }
+ // Register any columns from other plugins
+ try {
+ for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
+ for (XViewerColumn xCol : item.getXViewerColumns()) {
+ registerColumns(xCol);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ registerAllAttributeColumns();
+ }
+
+ @Override
+ public XViewerSorter createNewXSorter(XViewer xViewer) {
+ return new WorldXViewerSorter(xViewer);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsArtifactChecks.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsArtifactChecks.java
index b44e0b43ad5..a1ac6914d8c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsArtifactChecks.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsArtifactChecks.java
@@ -1,147 +1,147 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.world.search.ActionableItemWorldSearchItem;
-import org.eclipse.osee.ats.world.search.TeamWorldSearchItem;
-import org.eclipse.osee.ats.world.search.TeamWorldSearchItem.ReleasedOption;
-import org.eclipse.osee.ats.world.search.UserRelatedToAtsObjectSearch;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.LoadView;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCheck;
-
-/**
- * Check for certain conditions that must be met to delete an ATS object or User artifact.
- *
- * @author Donald G. Dunne
- */
-public class AtsArtifactChecks extends ArtifactCheck {
- @Override
- public IStatus isDeleteable(Collection<Artifact> artifacts) throws OseeCoreException {
- String result = checkActionableItems(artifacts);
- if (result != null) {
- return createStatus(result);
- }
-
- result = checkTeamDefinitions(artifacts);
- if (result != null) {
- return createStatus(result);
- }
-
- result = checkAtsWorkflows(artifacts);
- if (result != null) {
- return createStatus(result);
- }
-
- result = checkUsers(artifacts);
- if (result != null) {
- return createStatus(result);
- }
-
- return OK_STATUS;
- }
-
- private IStatus createStatus(String message) {
- return new Status(IStatus.ERROR, AtsPlugin.PLUGIN_ID, message);
- }
-
- private String checkActionableItems(Collection<Artifact> artifacts) throws OseeCoreException {
- Set<ActionableItemArtifact> aias = new HashSet<ActionableItemArtifact>();
- for (Artifact art : artifacts) {
- if (art instanceof ActionableItemArtifact) {
- aias.add((ActionableItemArtifact) art);
- }
- }
- if (aias.size() > 0) {
- ActionableItemWorldSearchItem srch = new ActionableItemWorldSearchItem("AI search", aias, true, true, false);
- if (srch.performSearchGetResults(false).size() > 0) {
- return "Actionable Items (or children AIs) selected to delete have related Team Workflows; Delete or re-assign Team Workflows first.";
- }
- }
- return null;
- }
-
- private String checkTeamDefinitions(Collection<Artifact> artifacts) throws OseeCoreException {
- Set<TeamDefinitionArtifact> teamDefs = new HashSet<TeamDefinitionArtifact>();
- for (Artifact art : artifacts) {
- if (art instanceof TeamDefinitionArtifact) {
- teamDefs.add((TeamDefinitionArtifact) art);
- }
- }
- if (teamDefs.size() > 0) {
-
- TeamWorldSearchItem srch =
- new TeamWorldSearchItem("Team Def search", teamDefs, true, false, true, null, null, ReleasedOption.Both);
- if (srch.performSearchGetResults(false).size() > 0) {
- return "Team Definition (or children Team Definitions) selected to delete have related Team Workflows; Delete or re-assign Team Workflows first.";
- }
- }
- return null;
- }
-
- private String checkAtsWorkflows(Collection<Artifact> artifacts) throws OseeCoreException {
- for (Artifact art : artifacts) {
- if (art.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
- if (art.getRelatedArtifacts(CoreRelationTypes.WorkItem__Parent).size() > 0) {
- return String.format(
- "ATS WorkFlowDefinition [%s] selected to delete has related Team Definition(s) via WorkItem__Parent; Re-assign Team Definitions to new WorkFlowDefinition first.",
- art);
- }
- }
- if (art.isOfType(CoreArtifactTypes.WorkRuleDefinition)) {
- if (art.getRelatedArtifacts(CoreRelationTypes.WorkItem__Parent).size() > 0) {
- return String.format(
- "ATS WorkRuleDefinition [%s] selected to delete has related Work Items via WorkItem__Parent that must be removed first.",
- art);
- }
- }
- if (art.isOfType(CoreArtifactTypes.WorkWidgetDefinition)) {
- if (art.getRelatedArtifacts(CoreRelationTypes.WorkItem__Parent).size() > 0) {
- return String.format(
- "ATS WorkWidgetDefinition [%s] selected to delete has related Work Items via WorkItem__Parent that must be removed first.",
- art);
- }
- }
- }
- return null;
- }
-
- private String checkUsers(Collection<Artifact> artifacts) throws OseeCoreException {
- Set<User> users = new HashSet<User>();
- for (Artifact art : artifacts) {
- if (art instanceof User) {
- users.add((User) art);
- }
- }
- for (User user : users) {
- UserRelatedToAtsObjectSearch srch =
- new UserRelatedToAtsObjectSearch("User search", user, false, LoadView.None);
- if (srch.performSearchGetResults().size() > 0) {
- return String.format(
- "User name: \"%s\" userId: \"%s\" selected to delete has related ATS Objects; Un-relate to ATS first before deleting.",
- user.getName(), user.getUserId());
- }
- }
- return 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.ats.util;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.world.search.ActionableItemWorldSearchItem;
+import org.eclipse.osee.ats.world.search.TeamWorldSearchItem;
+import org.eclipse.osee.ats.world.search.TeamWorldSearchItem.ReleasedOption;
+import org.eclipse.osee.ats.world.search.UserRelatedToAtsObjectSearch;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.LoadView;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCheck;
+
+/**
+ * Check for certain conditions that must be met to delete an ATS object or User artifact.
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsArtifactChecks extends ArtifactCheck {
+ @Override
+ public IStatus isDeleteable(Collection<Artifact> artifacts) throws OseeCoreException {
+ String result = checkActionableItems(artifacts);
+ if (result != null) {
+ return createStatus(result);
+ }
+
+ result = checkTeamDefinitions(artifacts);
+ if (result != null) {
+ return createStatus(result);
+ }
+
+ result = checkAtsWorkflows(artifacts);
+ if (result != null) {
+ return createStatus(result);
+ }
+
+ result = checkUsers(artifacts);
+ if (result != null) {
+ return createStatus(result);
+ }
+
+ return OK_STATUS;
+ }
+
+ private IStatus createStatus(String message) {
+ return new Status(IStatus.ERROR, AtsPlugin.PLUGIN_ID, message);
+ }
+
+ private String checkActionableItems(Collection<Artifact> artifacts) throws OseeCoreException {
+ Set<ActionableItemArtifact> aias = new HashSet<ActionableItemArtifact>();
+ for (Artifact art : artifacts) {
+ if (art instanceof ActionableItemArtifact) {
+ aias.add((ActionableItemArtifact) art);
+ }
+ }
+ if (aias.size() > 0) {
+ ActionableItemWorldSearchItem srch = new ActionableItemWorldSearchItem("AI search", aias, true, true, false);
+ if (srch.performSearchGetResults(false).size() > 0) {
+ return "Actionable Items (or children AIs) selected to delete have related Team Workflows; Delete or re-assign Team Workflows first.";
+ }
+ }
+ return null;
+ }
+
+ private String checkTeamDefinitions(Collection<Artifact> artifacts) throws OseeCoreException {
+ Set<TeamDefinitionArtifact> teamDefs = new HashSet<TeamDefinitionArtifact>();
+ for (Artifact art : artifacts) {
+ if (art instanceof TeamDefinitionArtifact) {
+ teamDefs.add((TeamDefinitionArtifact) art);
+ }
+ }
+ if (teamDefs.size() > 0) {
+
+ TeamWorldSearchItem srch =
+ new TeamWorldSearchItem("Team Def search", teamDefs, true, false, true, null, null, ReleasedOption.Both);
+ if (srch.performSearchGetResults(false).size() > 0) {
+ return "Team Definition (or children Team Definitions) selected to delete have related Team Workflows; Delete or re-assign Team Workflows first.";
+ }
+ }
+ return null;
+ }
+
+ private String checkAtsWorkflows(Collection<Artifact> artifacts) throws OseeCoreException {
+ for (Artifact art : artifacts) {
+ if (art.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
+ if (art.getRelatedArtifacts(CoreRelationTypes.WorkItem__Parent).size() > 0) {
+ return String.format(
+ "ATS WorkFlowDefinition [%s] selected to delete has related Team Definition(s) via WorkItem__Parent; Re-assign Team Definitions to new WorkFlowDefinition first.",
+ art);
+ }
+ }
+ if (art.isOfType(CoreArtifactTypes.WorkRuleDefinition)) {
+ if (art.getRelatedArtifacts(CoreRelationTypes.WorkItem__Parent).size() > 0) {
+ return String.format(
+ "ATS WorkRuleDefinition [%s] selected to delete has related Work Items via WorkItem__Parent that must be removed first.",
+ art);
+ }
+ }
+ if (art.isOfType(CoreArtifactTypes.WorkWidgetDefinition)) {
+ if (art.getRelatedArtifacts(CoreRelationTypes.WorkItem__Parent).size() > 0) {
+ return String.format(
+ "ATS WorkWidgetDefinition [%s] selected to delete has related Work Items via WorkItem__Parent that must be removed first.",
+ art);
+ }
+ }
+ }
+ return null;
+ }
+
+ private String checkUsers(Collection<Artifact> artifacts) throws OseeCoreException {
+ Set<User> users = new HashSet<User>();
+ for (Artifact art : artifacts) {
+ if (art instanceof User) {
+ users.add((User) art);
+ }
+ }
+ for (User user : users) {
+ UserRelatedToAtsObjectSearch srch =
+ new UserRelatedToAtsObjectSearch("User search", user, false, LoadView.None);
+ if (srch.performSearchGetResults().size() > 0) {
+ return String.format(
+ "User name: \"%s\" userId: \"%s\" selected to delete has related ATS Objects; Un-relate to ATS first before deleting.",
+ user.getName(), user.getUserId());
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java
index 24f4089794a..94eb855e2a9 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java
@@ -1,798 +1,798 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
-import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.commit.CommitStatus;
-import org.eclipse.osee.ats.util.widgets.commit.ICommitConfigArtifact;
-import org.eclipse.osee.ats.workflow.item.AtsAddDecisionReviewRule;
-import org.eclipse.osee.ats.workflow.item.AtsAddDecisionReviewRule.DecisionRuleOption;
-import org.eclipse.osee.ats.workflow.item.AtsAddPeerToPeerReviewRule;
-import org.eclipse.osee.ats.workflow.item.StateEventType;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.enums.BranchArchivedState;
-import org.eclipse.osee.framework.core.enums.BranchState;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.exception.MultipleBranchesExist;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.BranchFilter;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.IExceptionableRunnable;
-import org.eclipse.osee.framework.plugin.core.util.Jobs;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.ArrayTreeContentProvider;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.change.ChangeUiUtil;
-import org.eclipse.osee.framework.ui.skynet.util.TransactionIdLabelProvider;
-import org.eclipse.osee.framework.ui.skynet.util.filteredTree.SimpleCheckFilteredTreeDialog;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkRuleDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * BranchManager contains methods necessary for ATS objects to interact with creation, view and commit of branches.
- *
- * @author Donald G. Dunne
- */
-public class AtsBranchManager {
- public static Set<Branch> branchesInCommit = new HashSet<Branch>();
- private final TeamWorkFlowArtifact teamArt;
-
- public AtsBranchManager(TeamWorkFlowArtifact teamArt) {
- this.teamArt = teamArt;
- }
-
- public void showMergeManager() {
- try {
- if (!isWorkingBranchInWork() && !isCommittedBranchExists()) {
- AWorkbench.popup("ERROR", "No Current Working or Committed Branch");
- return;
- }
- if (isWorkingBranchInWork()) {
- Branch branch = getConfiguredBranchForWorkflow();
- if (branch == null) {
- AWorkbench.popup("ERROR", "Can't access parent branch");
- return;
- }
- MergeView.openView(getWorkingBranch(), branch, getWorkingBranch().getBaseTransaction());
-
- } else if (isCommittedBranchExists()) {
- TransactionRecord transactionId = getTransactionIdOrPopupChoose("Show Merge Manager", true);
- if (transactionId == null) {
- return;
- }
- MergeView.openView(transactionId);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- /**
- * Return true if merge branch exists in DB (whether archived or not)
- *
- * @param destinationBranch
- * @return true
- * @throws OseeCoreException
- */
- public boolean isMergeBranchExists(Branch destinationBranch) throws OseeCoreException {
- return isMergeBranchExists(getWorkingBranch(), destinationBranch);
- }
-
- /**
- * Method available for optimized checking of merge branches so don't have to re-acquire working branch if already
- * have
- */
- public boolean isMergeBranchExists(Branch workingBranch, Branch destinationBranch) throws OseeCoreException {
- if (workingBranch == null) {
- return false;
- }
- return BranchManager.doesMergeBranchExist(workingBranch, destinationBranch);
- }
-
- public boolean isMergeCompleted(Branch destinationBranch) throws OseeCoreException {
- ConflictManagerExternal conflictManager = new ConflictManagerExternal(destinationBranch, getWorkingBranch());
- return !conflictManager.remainingConflictsExist();
- }
-
- public TransactionRecord getCommitTransactionRecord(ICommitConfigArtifact configArt) throws OseeCoreException {
- Branch branch = configArt.getParentBranch();
- if (branch == null) {
- return null;
- }
-
- Collection<TransactionRecord> transactions = TransactionManager.getCommittedArtifactTransactionIds(teamArt);
- for (TransactionRecord transId : transactions) {
- if (transId.getBranchId() == branch.getId()) {
- return transId;
- }
- }
- return null;
- }
-
- public CommitStatus getCommitStatus(ICommitConfigArtifact configArt) throws OseeCoreException {
- Branch branch = configArt.getParentBranch();
- if (branch == null) {
- return CommitStatus.Branch_Not_Configured;
- }
-
- if (branch.getBranchState().isCommitted()) {
- return CommitStatus.Committed;
- }
- Collection<TransactionRecord> transactions = TransactionManager.getCommittedArtifactTransactionIds(teamArt);
- boolean mergeBranchExists = teamArt.getBranchMgr().isMergeBranchExists(branch);
-
- for (TransactionRecord transId : transactions) {
- if (transId.getBranchId() == branch.getId()) {
- if (mergeBranchExists) {
- return CommitStatus.Committed_With_Merge;
- } else {
- return CommitStatus.Committed;
- }
- }
- }
-
- Result result = teamArt.getBranchMgr().isCommitBranchAllowed(configArt);
- if (result.isFalse()) {
- return CommitStatus.Branch_Commit_Disabled;
- }
- if (teamArt.getBranchMgr().getWorkingBranch() == null) {
- return CommitStatus.Working_Branch_Not_Created;
- }
- if (mergeBranchExists) {
- return CommitStatus.Merge_In_Progress;
- }
- return CommitStatus.Commit_Needed;
- }
-
- public void showMergeManager(Branch destinationBranch) throws OseeCoreException {
- if (isWorkingBranchInWork()) {
- MergeView.openView(getWorkingBranch(), destinationBranch, getWorkingBranch().getBaseTransaction());
- } else if (isCommittedBranchExists()) {
- for (TransactionRecord transactionId : getTransactionIds(true)) {
- if (transactionId.getBranchId() == destinationBranch.getId()) {
- MergeView.openView(transactionId);
-
- }
- }
- }
- }
-
- /**
- * Opens the branch currently associated with this state machine artifact.
- */
- public void showWorkingBranch() {
- try {
- if (!isWorkingBranchInWork()) {
- AWorkbench.popup("ERROR", "No Current Working Branch");
- return;
- }
- BranchView.revealBranch(getWorkingBranch());
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public Integer getId() throws OseeCoreException {
- Branch branch = getWorkingBranch();
- if (branch == null) {
- return null;
- }
- return branch.getId();
- }
-
- /**
- * If working branch has no changes, allow for deletion.
- */
- public void deleteWorkingBranch(boolean promptUser) {
- boolean isExecutionAllowed = !promptUser;
- try {
- Branch branch = getWorkingBranch();
- if (promptUser) {
- StringBuilder message = new StringBuilder();
- if (BranchManager.hasChanges(branch)) {
- message.append("Warning: Changes have been made on this branch.\n\n");
- }
- message.append("Are you sure you want to delete the branch: ");
- message.append(branch);
-
- isExecutionAllowed =
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
+import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.commit.CommitStatus;
+import org.eclipse.osee.ats.util.widgets.commit.ICommitConfigArtifact;
+import org.eclipse.osee.ats.workflow.item.AtsAddDecisionReviewRule;
+import org.eclipse.osee.ats.workflow.item.AtsAddDecisionReviewRule.DecisionRuleOption;
+import org.eclipse.osee.ats.workflow.item.AtsAddPeerToPeerReviewRule;
+import org.eclipse.osee.ats.workflow.item.StateEventType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.MultipleBranchesExist;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.cache.BranchFilter;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.IExceptionableRunnable;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.ArrayTreeContentProvider;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.change.ChangeUiUtil;
+import org.eclipse.osee.framework.ui.skynet.util.TransactionIdLabelProvider;
+import org.eclipse.osee.framework.ui.skynet.util.filteredTree.SimpleCheckFilteredTreeDialog;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkRuleDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * BranchManager contains methods necessary for ATS objects to interact with creation, view and commit of branches.
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsBranchManager {
+ public static Set<Branch> branchesInCommit = new HashSet<Branch>();
+ private final TeamWorkFlowArtifact teamArt;
+
+ public AtsBranchManager(TeamWorkFlowArtifact teamArt) {
+ this.teamArt = teamArt;
+ }
+
+ public void showMergeManager() {
+ try {
+ if (!isWorkingBranchInWork() && !isCommittedBranchExists()) {
+ AWorkbench.popup("ERROR", "No Current Working or Committed Branch");
+ return;
+ }
+ if (isWorkingBranchInWork()) {
+ Branch branch = getConfiguredBranchForWorkflow();
+ if (branch == null) {
+ AWorkbench.popup("ERROR", "Can't access parent branch");
+ return;
+ }
+ MergeView.openView(getWorkingBranch(), branch, getWorkingBranch().getBaseTransaction());
+
+ } else if (isCommittedBranchExists()) {
+ TransactionRecord transactionId = getTransactionIdOrPopupChoose("Show Merge Manager", true);
+ if (transactionId == null) {
+ return;
+ }
+ MergeView.openView(transactionId);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ /**
+ * Return true if merge branch exists in DB (whether archived or not)
+ *
+ * @param destinationBranch
+ * @return true
+ * @throws OseeCoreException
+ */
+ public boolean isMergeBranchExists(Branch destinationBranch) throws OseeCoreException {
+ return isMergeBranchExists(getWorkingBranch(), destinationBranch);
+ }
+
+ /**
+ * Method available for optimized checking of merge branches so don't have to re-acquire working branch if already
+ * have
+ */
+ public boolean isMergeBranchExists(Branch workingBranch, Branch destinationBranch) throws OseeCoreException {
+ if (workingBranch == null) {
+ return false;
+ }
+ return BranchManager.doesMergeBranchExist(workingBranch, destinationBranch);
+ }
+
+ public boolean isMergeCompleted(Branch destinationBranch) throws OseeCoreException {
+ ConflictManagerExternal conflictManager = new ConflictManagerExternal(destinationBranch, getWorkingBranch());
+ return !conflictManager.remainingConflictsExist();
+ }
+
+ public TransactionRecord getCommitTransactionRecord(ICommitConfigArtifact configArt) throws OseeCoreException {
+ Branch branch = configArt.getParentBranch();
+ if (branch == null) {
+ return null;
+ }
+
+ Collection<TransactionRecord> transactions = TransactionManager.getCommittedArtifactTransactionIds(teamArt);
+ for (TransactionRecord transId : transactions) {
+ if (transId.getBranchId() == branch.getId()) {
+ return transId;
+ }
+ }
+ return null;
+ }
+
+ public CommitStatus getCommitStatus(ICommitConfigArtifact configArt) throws OseeCoreException {
+ Branch branch = configArt.getParentBranch();
+ if (branch == null) {
+ return CommitStatus.Branch_Not_Configured;
+ }
+
+ if (branch.getBranchState().isCommitted()) {
+ return CommitStatus.Committed;
+ }
+ Collection<TransactionRecord> transactions = TransactionManager.getCommittedArtifactTransactionIds(teamArt);
+ boolean mergeBranchExists = teamArt.getBranchMgr().isMergeBranchExists(branch);
+
+ for (TransactionRecord transId : transactions) {
+ if (transId.getBranchId() == branch.getId()) {
+ if (mergeBranchExists) {
+ return CommitStatus.Committed_With_Merge;
+ } else {
+ return CommitStatus.Committed;
+ }
+ }
+ }
+
+ Result result = teamArt.getBranchMgr().isCommitBranchAllowed(configArt);
+ if (result.isFalse()) {
+ return CommitStatus.Branch_Commit_Disabled;
+ }
+ if (teamArt.getBranchMgr().getWorkingBranch() == null) {
+ return CommitStatus.Working_Branch_Not_Created;
+ }
+ if (mergeBranchExists) {
+ return CommitStatus.Merge_In_Progress;
+ }
+ return CommitStatus.Commit_Needed;
+ }
+
+ public void showMergeManager(Branch destinationBranch) throws OseeCoreException {
+ if (isWorkingBranchInWork()) {
+ MergeView.openView(getWorkingBranch(), destinationBranch, getWorkingBranch().getBaseTransaction());
+ } else if (isCommittedBranchExists()) {
+ for (TransactionRecord transactionId : getTransactionIds(true)) {
+ if (transactionId.getBranchId() == destinationBranch.getId()) {
+ MergeView.openView(transactionId);
+
+ }
+ }
+ }
+ }
+
+ /**
+ * Opens the branch currently associated with this state machine artifact.
+ */
+ public void showWorkingBranch() {
+ try {
+ if (!isWorkingBranchInWork()) {
+ AWorkbench.popup("ERROR", "No Current Working Branch");
+ return;
+ }
+ BranchView.revealBranch(getWorkingBranch());
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public Integer getId() throws OseeCoreException {
+ Branch branch = getWorkingBranch();
+ if (branch == null) {
+ return null;
+ }
+ return branch.getId();
+ }
+
+ /**
+ * If working branch has no changes, allow for deletion.
+ */
+ public void deleteWorkingBranch(boolean promptUser) {
+ boolean isExecutionAllowed = !promptUser;
+ try {
+ Branch branch = getWorkingBranch();
+ if (promptUser) {
+ StringBuilder message = new StringBuilder();
+ if (BranchManager.hasChanges(branch)) {
+ message.append("Warning: Changes have been made on this branch.\n\n");
+ }
+ message.append("Are you sure you want to delete the branch: ");
+ message.append(branch);
+
+ isExecutionAllowed =
MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Delete Working Branch", message.toString());
- }
-
- if (isExecutionAllowed) {
- Job job = BranchManager.deleteBranch(branch);
- job.join();
- IStatus status = job.getResult();
- if (promptUser) {
- AWorkbench.popup("Delete Complete",
+ }
+
+ if (isExecutionAllowed) {
+ Job job = BranchManager.deleteBranch(branch);
+ job.join();
+ IStatus status = job.getResult();
+ if (promptUser) {
+ AWorkbench.popup("Delete Complete",
status.isOK() ? "Branch delete was successful." : "Branch delete failed.\n" + status.getMessage());
- } else {
- if (!status.isOK()) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, status.getMessage(), status.getException());
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Problem deleting branch.", ex);
- }
- }
-
- public Collection<TransactionRecord> getFirstCommitTransaction() throws OseeCoreException {
- Collection<TransactionRecord> committedTransactions =
+ } else {
+ if (!status.isOK()) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, status.getMessage(), status.getException());
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Problem deleting branch.", ex);
+ }
+ }
+
+ public Collection<TransactionRecord> getFirstCommitTransaction() throws OseeCoreException {
+ Collection<TransactionRecord> committedTransactions =
TransactionManager.getCommittedArtifactTransactionIds(teamArt);
-
- Collection<TransactionRecord> transactionIds = new ArrayList<TransactionRecord>();
- for (TransactionRecord transactionId : committedTransactions) {
- // exclude working branches including branch states that are re-baselined
- Branch branch = transactionId.getBranch();
- if (branch.getBranchType().isBaselineBranch() && branch.getArchiveState().isUnArchived()) {
- transactionIds.add(transactionId);
- }
- }
- return transactionIds;
- }
-
- /**
- * @return TransactionId associated with this state machine artifact
- */
- public Collection<TransactionRecord> getTransactionIds(boolean showMergeManager) throws OseeCoreException {
- if (showMergeManager) {
- Branch workingBranch = getWorkingBranch();
- // grab only the transaction that had merge conflicts
- Collection<TransactionRecord> transactionIds = new ArrayList<TransactionRecord>();
- for (TransactionRecord transactionId : getFirstCommitTransaction()) {
- if (isMergeBranchExists(workingBranch, transactionId.getBranch())) {
- transactionIds.add(transactionId);
- }
- }
- return transactionIds;
- } else {
- return getFirstCommitTransaction();
- }
- }
-
- public TransactionRecord getEarliestTransactionId() throws OseeCoreException {
- Collection<TransactionRecord> transactionIds = getTransactionIds(false);
- if (transactionIds.size() == 1) {
- return transactionIds.iterator().next();
- }
- TransactionRecord earliestTransactionId = transactionIds.iterator().next();
- for (TransactionRecord transactionId : transactionIds) {
- if (transactionId.getId() < earliestTransactionId.getId()) {
- earliestTransactionId = transactionId;
- }
- }
- return earliestTransactionId;
- }
-
- /**
- * Either return a single commit transaction or user must choose from a list of valid commit transactions
- */
- public TransactionRecord getTransactionIdOrPopupChoose(String title, boolean showMergeManager) throws OseeCoreException {
- Collection<TransactionRecord> transactionIds = new HashSet<TransactionRecord>();
- for (TransactionRecord id : getTransactionIds(showMergeManager)) {
- // ignore working branches that have been committed
- if (id.getBranch().getBranchType().isWorkingBranch() && id.getBranch().getBranchState().isCommitted()) {
- continue;
- }
- // ignore working branches that have been re-baselined (e.g. update form parent branch)
- else if (id.getBranch().getBranchType().isWorkingBranch() && id.getBranch().getBranchState().isRebaselined()) {
- continue;
- } else {
- transactionIds.add(id);
- }
- }
- if (transactionIds.size() == 1) {
- return transactionIds.iterator().next();
- }
-
- ViewerSorter sorter = new ViewerSorter() {
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 == null || e2 == null) {
- return 0;
- }
- if (((TransactionRecord) e1).getId() < ((TransactionRecord) e2).getId()) {
- return -1;
- } else if (((TransactionRecord) e1).getId() > ((TransactionRecord) e2).getId()) {
- return 1;
- }
- return 0;
- }
- };
- SimpleCheckFilteredTreeDialog ld =
+
+ Collection<TransactionRecord> transactionIds = new ArrayList<TransactionRecord>();
+ for (TransactionRecord transactionId : committedTransactions) {
+ // exclude working branches including branch states that are re-baselined
+ Branch branch = transactionId.getBranch();
+ if (branch.getBranchType().isBaselineBranch() && branch.getArchiveState().isUnArchived()) {
+ transactionIds.add(transactionId);
+ }
+ }
+ return transactionIds;
+ }
+
+ /**
+ * @return TransactionId associated with this state machine artifact
+ */
+ public Collection<TransactionRecord> getTransactionIds(boolean showMergeManager) throws OseeCoreException {
+ if (showMergeManager) {
+ Branch workingBranch = getWorkingBranch();
+ // grab only the transaction that had merge conflicts
+ Collection<TransactionRecord> transactionIds = new ArrayList<TransactionRecord>();
+ for (TransactionRecord transactionId : getFirstCommitTransaction()) {
+ if (isMergeBranchExists(workingBranch, transactionId.getBranch())) {
+ transactionIds.add(transactionId);
+ }
+ }
+ return transactionIds;
+ } else {
+ return getFirstCommitTransaction();
+ }
+ }
+
+ public TransactionRecord getEarliestTransactionId() throws OseeCoreException {
+ Collection<TransactionRecord> transactionIds = getTransactionIds(false);
+ if (transactionIds.size() == 1) {
+ return transactionIds.iterator().next();
+ }
+ TransactionRecord earliestTransactionId = transactionIds.iterator().next();
+ for (TransactionRecord transactionId : transactionIds) {
+ if (transactionId.getId() < earliestTransactionId.getId()) {
+ earliestTransactionId = transactionId;
+ }
+ }
+ return earliestTransactionId;
+ }
+
+ /**
+ * Either return a single commit transaction or user must choose from a list of valid commit transactions
+ */
+ public TransactionRecord getTransactionIdOrPopupChoose(String title, boolean showMergeManager) throws OseeCoreException {
+ Collection<TransactionRecord> transactionIds = new HashSet<TransactionRecord>();
+ for (TransactionRecord id : getTransactionIds(showMergeManager)) {
+ // ignore working branches that have been committed
+ if (id.getBranch().getBranchType().isWorkingBranch() && id.getBranch().getBranchState().isCommitted()) {
+ continue;
+ }
+ // ignore working branches that have been re-baselined (e.g. update form parent branch)
+ else if (id.getBranch().getBranchType().isWorkingBranch() && id.getBranch().getBranchState().isRebaselined()) {
+ continue;
+ } else {
+ transactionIds.add(id);
+ }
+ }
+ if (transactionIds.size() == 1) {
+ return transactionIds.iterator().next();
+ }
+
+ ViewerSorter sorter = new ViewerSorter() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (e1 == null || e2 == null) {
+ return 0;
+ }
+ if (((TransactionRecord) e1).getId() < ((TransactionRecord) e2).getId()) {
+ return -1;
+ } else if (((TransactionRecord) e1).getId() > ((TransactionRecord) e2).getId()) {
+ return 1;
+ }
+ return 0;
+ }
+ };
+ SimpleCheckFilteredTreeDialog ld =
new SimpleCheckFilteredTreeDialog(title, "Select Commit Branch", new ArrayTreeContentProvider(),
new TransactionIdLabelProvider(), sorter, 0, Integer.MAX_VALUE);
- ld.setInput(transactionIds);
-
- if (ld.open() == 0) {
- return (TransactionRecord) ld.getResult()[0];
- }
- return null;
- }
-
- public Result isCreateBranchAllowed() throws OseeCoreException {
- if (!teamArt.isTeamWorkflow()) {
- return Result.FalseResult;
- }
-
- if (teamArt.getTeamDefinition().isTeamUsesVersions()) {
- if (teamArt.getTargetedForVersion() == null) {
- return new Result(false, "Workflow not targeted for Version");
- }
- Result result = teamArt.getTargetedForVersion().isCreateBranchAllowed();
- if (result.isFalse()) {
- return result;
- }
-
- if (teamArt.getTargetedForVersion().getParentBranch() == null) {
- return new Result(false,
+ ld.setInput(transactionIds);
+
+ if (ld.open() == 0) {
+ return (TransactionRecord) ld.getResult()[0];
+ }
+ return null;
+ }
+
+ public Result isCreateBranchAllowed() throws OseeCoreException {
+ if (!teamArt.isTeamWorkflow()) {
+ return Result.FalseResult;
+ }
+
+ if (teamArt.getTeamDefinition().isTeamUsesVersions()) {
+ if (teamArt.getTargetedForVersion() == null) {
+ return new Result(false, "Workflow not targeted for Version");
+ }
+ Result result = teamArt.getTargetedForVersion().isCreateBranchAllowed();
+ if (result.isFalse()) {
+ return result;
+ }
+
+ if (teamArt.getTargetedForVersion().getParentBranch() == null) {
+ return new Result(false,
"Parent Branch not configured for Version [" + teamArt.getTargetedForVersion() + "]");
- }
- if (!teamArt.getTargetedForVersion().getParentBranch().getBranchType().isBaselineBranch()) {
- return new Result(false, "Parent Branch must be of Baseline branch type. See Admin for configuration.");
- }
- return Result.TrueResult;
-
- } else {
- Result result = teamArt.getTeamDefinition().isCreateBranchAllowed();
- if (result.isFalse()) {
- return result;
- }
-
- if (teamArt.getTeamDefinition().getParentBranch() == null) {
- return new Result(false,
+ }
+ if (!teamArt.getTargetedForVersion().getParentBranch().getBranchType().isBaselineBranch()) {
+ return new Result(false, "Parent Branch must be of Baseline branch type. See Admin for configuration.");
+ }
+ return Result.TrueResult;
+
+ } else {
+ Result result = teamArt.getTeamDefinition().isCreateBranchAllowed();
+ if (result.isFalse()) {
+ return result;
+ }
+
+ if (teamArt.getTeamDefinition().getParentBranch() == null) {
+ return new Result(false,
"Parent Branch not configured for Team Definition [" + teamArt.getTeamDefinition() + "]");
- }
- if (!teamArt.getTeamDefinition().getParentBranch().getBranchType().isBaselineBranch()) {
- return new Result(false, "Parent Branch must be of Baseline branch type. See Admin for configuration.");
- }
- return Result.TrueResult;
- }
- }
-
- public Result isCommitBranchAllowed(ICommitConfigArtifact configArt) throws OseeCoreException {
- if (!teamArt.isTeamWorkflow()) {
- return Result.FalseResult;
- }
- if (teamArt.getTeamDefinition().isTeamUsesVersions()) {
- if (teamArt.getTargetedForVersion() == null) {
- return new Result(false, "Workflow not targeted for Version");
- }
- Result result = teamArt.getTargetedForVersion().isCommitBranchAllowed();
- if (result.isFalse()) {
- return result;
- }
-
- if (teamArt.getTargetedForVersion().getParentBranch() == null) {
- return new Result(false,
+ }
+ if (!teamArt.getTeamDefinition().getParentBranch().getBranchType().isBaselineBranch()) {
+ return new Result(false, "Parent Branch must be of Baseline branch type. See Admin for configuration.");
+ }
+ return Result.TrueResult;
+ }
+ }
+
+ public Result isCommitBranchAllowed(ICommitConfigArtifact configArt) throws OseeCoreException {
+ if (!teamArt.isTeamWorkflow()) {
+ return Result.FalseResult;
+ }
+ if (teamArt.getTeamDefinition().isTeamUsesVersions()) {
+ if (teamArt.getTargetedForVersion() == null) {
+ return new Result(false, "Workflow not targeted for Version");
+ }
+ Result result = teamArt.getTargetedForVersion().isCommitBranchAllowed();
+ if (result.isFalse()) {
+ return result;
+ }
+
+ if (teamArt.getTargetedForVersion().getParentBranch() == null) {
+ return new Result(false,
"Parent Branch not configured for Version [" + teamArt.getTargetedForVersion() + "]");
- }
- return Result.TrueResult;
-
- } else {
- Result result = teamArt.getTeamDefinition().isCommitBranchAllowed();
- if (result.isFalse()) {
- return result;
- }
-
- if (teamArt.getTeamDefinition().getParentBranch() == null) {
- return new Result(false,
+ }
+ return Result.TrueResult;
+
+ } else {
+ Result result = teamArt.getTeamDefinition().isCommitBranchAllowed();
+ if (result.isFalse()) {
+ return result;
+ }
+
+ if (teamArt.getTeamDefinition().getParentBranch() == null) {
+ return new Result(false,
"Parent Branch not configured for Team Definition [" + teamArt.getTeamDefinition() + "]");
- }
- return Result.TrueResult;
- }
- }
-
- /**
- * Display change report associated with the branch, if exists, or transaction, if branch has been committed.
- */
- public void showChangeReport() {
- try {
- if (isWorkingBranchInWork()) {
- ChangeUiUtil.open(getWorkingBranch());
- } else if (isCommittedBranchExists()) {
- TransactionRecord transactionId = getTransactionIdOrPopupChoose("Show Change Report", false);
- if (transactionId == null) {
- return;
- }
- ChangeUiUtil.open(transactionId);
- } else {
- AWorkbench.popup("ERROR", "No Branch or Committed Transaction Found.");
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't show change report.", ex);
- }
- }
-
- /**
- * Grab the change report for the indicated branch
- */
- public void showChangeReportForBranch(Branch destinationBranch) {
- try {
- for (TransactionRecord transactionId : getTransactionIds(false)) {
- if (transactionId.getBranch() == destinationBranch) {
- ChangeUiUtil.open(transactionId);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't show change report.", ex);
- }
- }
-
- Branch workingBranchCache = null;
- long workingBranchCacheUpdated = 0;
-
- /**
- * Return working branch associated with SMA whether it is committed or not; This data is cached across all workflows
- * with the cache being updated by local and remote events.
- */
- public Branch getWorkingBranch() throws OseeCoreException {
- long now = new Date().getTime();
- if (now - workingBranchCacheUpdated > 1000) {
- workingBranchCache = getWorkingBranchExcludeStates(BranchState.REBASELINED, BranchState.DELETED);
- workingBranchCacheUpdated = now;
- // System.out.println("updating cache");
- } else {
- // System.out.println("returning cache");
- }
- return workingBranchCache;
- }
-
- /**
- * Return working branch associated with SMA, even if it's been archived; This data is cached across all workflows
- * with the cache being updated by local and remote events. Filters out rebaseline branches (which are working
- * branches also).
- */
- public Branch getWorkingBranchExcludeStates(BranchState... negatedBranchStates) throws OseeCoreException {
- BranchFilter branchFilter = new BranchFilter(BranchArchivedState.ALL, BranchType.WORKING, BranchType.BASELINE);
- branchFilter.setNegatedBranchStates(negatedBranchStates);
- branchFilter.setAssociatedArtifact(teamArt);
-
- List<Branch> branches = BranchManager.getBranches(branchFilter);
-
- if (branches.isEmpty()) {
- return null;
- } else if (branches.size() > 1) {
- throw new MultipleBranchesExist(
+ }
+ return Result.TrueResult;
+ }
+ }
+
+ /**
+ * Display change report associated with the branch, if exists, or transaction, if branch has been committed.
+ */
+ public void showChangeReport() {
+ try {
+ if (isWorkingBranchInWork()) {
+ ChangeUiUtil.open(getWorkingBranch());
+ } else if (isCommittedBranchExists()) {
+ TransactionRecord transactionId = getTransactionIdOrPopupChoose("Show Change Report", false);
+ if (transactionId == null) {
+ return;
+ }
+ ChangeUiUtil.open(transactionId);
+ } else {
+ AWorkbench.popup("ERROR", "No Branch or Committed Transaction Found.");
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't show change report.", ex);
+ }
+ }
+
+ /**
+ * Grab the change report for the indicated branch
+ */
+ public void showChangeReportForBranch(Branch destinationBranch) {
+ try {
+ for (TransactionRecord transactionId : getTransactionIds(false)) {
+ if (transactionId.getBranch() == destinationBranch) {
+ ChangeUiUtil.open(transactionId);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't show change report.", ex);
+ }
+ }
+
+ Branch workingBranchCache = null;
+ long workingBranchCacheUpdated = 0;
+
+ /**
+ * Return working branch associated with SMA whether it is committed or not; This data is cached across all workflows
+ * with the cache being updated by local and remote events.
+ */
+ public Branch getWorkingBranch() throws OseeCoreException {
+ long now = new Date().getTime();
+ if (now - workingBranchCacheUpdated > 1000) {
+ workingBranchCache = getWorkingBranchExcludeStates(BranchState.REBASELINED, BranchState.DELETED);
+ workingBranchCacheUpdated = now;
+ // System.out.println("updating cache");
+ } else {
+ // System.out.println("returning cache");
+ }
+ return workingBranchCache;
+ }
+
+ /**
+ * Return working branch associated with SMA, even if it's been archived; This data is cached across all workflows
+ * with the cache being updated by local and remote events. Filters out rebaseline branches (which are working
+ * branches also).
+ */
+ public Branch getWorkingBranchExcludeStates(BranchState... negatedBranchStates) throws OseeCoreException {
+ BranchFilter branchFilter = new BranchFilter(BranchArchivedState.ALL, BranchType.WORKING, BranchType.BASELINE);
+ branchFilter.setNegatedBranchStates(negatedBranchStates);
+ branchFilter.setAssociatedArtifact(teamArt);
+
+ List<Branch> branches = BranchManager.getBranches(branchFilter);
+
+ if (branches.isEmpty()) {
+ return null;
+ } else if (branches.size() > 1) {
+ throw new MultipleBranchesExist(
"Unexpected multiple associated un-deleted working branches found for workflow " + teamArt.getHumanReadableId());
- } else {
- return branches.get(0);
- }
- }
-
- /**
- * @return whether there is a working branch that is not committed
- * @throws OseeCoreException
- */
- public boolean isWorkingBranchInWork() throws OseeCoreException {
- Branch branch = getWorkingBranch();
- return branch != null && !branch.getBranchState().isCommitted();
- }
-
- /**
- * Returns true if there was ever a commit of a working branch regardless of whether the working branch is archived
- * or not.
- */
- public boolean isWorkingBranchEverCommitted() throws OseeCoreException {
- return getBranchesCommittedTo().size() > 0;
- }
-
- public Collection<ICommitConfigArtifact> getConfigArtifactsConfiguredToCommitTo() throws OseeCoreException {
- Set<ICommitConfigArtifact> configObjects = new HashSet<ICommitConfigArtifact>();
- if (teamArt.isTeamUsesVersions()) {
- if (teamArt.getTargetedForVersion() != null) {
- teamArt.getTargetedForVersion().getParallelVersions(configObjects);
- }
- } else {
- if (teamArt.isTeamWorkflow() && teamArt.getTeamDefinition().getParentBranch() != null) {
- configObjects.add(teamArt.getTeamDefinition());
- }
- }
- return configObjects;
- }
-
- public ICommitConfigArtifact getParentBranchConfigArtifactConfiguredToCommitTo() throws OseeCoreException {
- if (teamArt.isTeamUsesVersions()) {
- if (teamArt.getTargetedForVersion() != null) {
- return teamArt.getTargetedForVersion();
- }
- } else {
- if (teamArt.isTeamWorkflow() && teamArt.getTeamDefinition().getParentBranch() != null) {
- return teamArt.getTeamDefinition();
- }
- }
- return null;
- }
-
- public boolean isAllObjectsToCommitToConfigured() throws OseeCoreException {
- return getConfigArtifactsConfiguredToCommitTo().size() == getBranchesToCommitTo().size();
- }
-
- public Collection<Branch> getBranchesLeftToCommit() throws OseeCoreException {
- Set<Branch> branchesLeft = new HashSet<Branch>();
- Collection<Branch> committedTo = getBranchesCommittedTo();
- for (Branch branchToCommit : getBranchesToCommitTo()) {
- if (!committedTo.contains(branchToCommit)) {
- branchesLeft.add(branchToCommit);
- }
- }
- return branchesLeft;
- }
-
- public Collection<Branch> getBranchesToCommitTo() throws OseeCoreException {
- Set<Branch> branches = new HashSet<Branch>();
- for (Object obj : getConfigArtifactsConfiguredToCommitTo()) {
- if (obj instanceof VersionArtifact && ((VersionArtifact) obj).getParentBranch() != null) {
- branches.add(((VersionArtifact) obj).getParentBranch());
- } else if (obj instanceof TeamDefinitionArtifact && ((TeamDefinitionArtifact) obj).getParentBranch() != null) {
- branches.add(((TeamDefinitionArtifact) obj).getParentBranch());
- }
- }
- return branches;
- }
-
- public Collection<Branch> getBranchesCommittedTo() throws OseeCoreException {
- Set<Branch> branches = new HashSet<Branch>();
- for (TransactionRecord transId : getTransactionIds(false)) {
- branches.add(transId.getBranch());
- }
- return branches;
- }
-
- /**
- * @return true if there is at least one destination branch committed to
- */
- public boolean isCommittedBranchExists() throws OseeCoreException {
- return isAllObjectsToCommitToConfigured() && !getBranchesCommittedTo().isEmpty();
- }
-
- /**
- * Return true if all commit destination branches are configured and have been committed to
- */
- public boolean isBranchesAllCommitted() throws OseeCoreException {
- Collection<Branch> committedTo = getBranchesCommittedTo();
- for (Branch destBranch : getBranchesToCommitTo()) {
- if (!committedTo.contains(destBranch)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isBranchesAllCommittedExcept(Branch branchToExclude) throws OseeCoreException {
- Collection<Branch> committedTo = getBranchesCommittedTo();
- for (Branch destBranch : getBranchesToCommitTo()) {
- if (!destBranch.equals(branchToExclude) && !committedTo.contains(destBranch)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Perform error checks and popup confirmation dialogs associated with creating a working branch.
- *
- * @param pageId if specified, WorkPage gets callback to provide confirmation that branch can be created
- * @param popup if true, errors are popped up to user; otherwise sent silently in Results
- * @return Result return of status
- */
- public Result createWorkingBranch(String pageId, boolean popup) {
- try {
- if (isCommittedBranchExists()) {
- if (popup) {
- AWorkbench.popup("ERROR", "Can not create another working branch once changes have been committed.");
- }
- return new Result("Committed branch already exists.");
- }
- Branch parentBranch = getConfiguredBranchForWorkflow();
- if (parentBranch == null) {
- String errorStr =
+ } else {
+ return branches.get(0);
+ }
+ }
+
+ /**
+ * @return whether there is a working branch that is not committed
+ * @throws OseeCoreException
+ */
+ public boolean isWorkingBranchInWork() throws OseeCoreException {
+ Branch branch = getWorkingBranch();
+ return branch != null && !branch.getBranchState().isCommitted();
+ }
+
+ /**
+ * Returns true if there was ever a commit of a working branch regardless of whether the working branch is archived
+ * or not.
+ */
+ public boolean isWorkingBranchEverCommitted() throws OseeCoreException {
+ return getBranchesCommittedTo().size() > 0;
+ }
+
+ public Collection<ICommitConfigArtifact> getConfigArtifactsConfiguredToCommitTo() throws OseeCoreException {
+ Set<ICommitConfigArtifact> configObjects = new HashSet<ICommitConfigArtifact>();
+ if (teamArt.isTeamUsesVersions()) {
+ if (teamArt.getTargetedForVersion() != null) {
+ teamArt.getTargetedForVersion().getParallelVersions(configObjects);
+ }
+ } else {
+ if (teamArt.isTeamWorkflow() && teamArt.getTeamDefinition().getParentBranch() != null) {
+ configObjects.add(teamArt.getTeamDefinition());
+ }
+ }
+ return configObjects;
+ }
+
+ public ICommitConfigArtifact getParentBranchConfigArtifactConfiguredToCommitTo() throws OseeCoreException {
+ if (teamArt.isTeamUsesVersions()) {
+ if (teamArt.getTargetedForVersion() != null) {
+ return teamArt.getTargetedForVersion();
+ }
+ } else {
+ if (teamArt.isTeamWorkflow() && teamArt.getTeamDefinition().getParentBranch() != null) {
+ return teamArt.getTeamDefinition();
+ }
+ }
+ return null;
+ }
+
+ public boolean isAllObjectsToCommitToConfigured() throws OseeCoreException {
+ return getConfigArtifactsConfiguredToCommitTo().size() == getBranchesToCommitTo().size();
+ }
+
+ public Collection<Branch> getBranchesLeftToCommit() throws OseeCoreException {
+ Set<Branch> branchesLeft = new HashSet<Branch>();
+ Collection<Branch> committedTo = getBranchesCommittedTo();
+ for (Branch branchToCommit : getBranchesToCommitTo()) {
+ if (!committedTo.contains(branchToCommit)) {
+ branchesLeft.add(branchToCommit);
+ }
+ }
+ return branchesLeft;
+ }
+
+ public Collection<Branch> getBranchesToCommitTo() throws OseeCoreException {
+ Set<Branch> branches = new HashSet<Branch>();
+ for (Object obj : getConfigArtifactsConfiguredToCommitTo()) {
+ if (obj instanceof VersionArtifact && ((VersionArtifact) obj).getParentBranch() != null) {
+ branches.add(((VersionArtifact) obj).getParentBranch());
+ } else if (obj instanceof TeamDefinitionArtifact && ((TeamDefinitionArtifact) obj).getParentBranch() != null) {
+ branches.add(((TeamDefinitionArtifact) obj).getParentBranch());
+ }
+ }
+ return branches;
+ }
+
+ public Collection<Branch> getBranchesCommittedTo() throws OseeCoreException {
+ Set<Branch> branches = new HashSet<Branch>();
+ for (TransactionRecord transId : getTransactionIds(false)) {
+ branches.add(transId.getBranch());
+ }
+ return branches;
+ }
+
+ /**
+ * @return true if there is at least one destination branch committed to
+ */
+ public boolean isCommittedBranchExists() throws OseeCoreException {
+ return isAllObjectsToCommitToConfigured() && !getBranchesCommittedTo().isEmpty();
+ }
+
+ /**
+ * Return true if all commit destination branches are configured and have been committed to
+ */
+ public boolean isBranchesAllCommitted() throws OseeCoreException {
+ Collection<Branch> committedTo = getBranchesCommittedTo();
+ for (Branch destBranch : getBranchesToCommitTo()) {
+ if (!committedTo.contains(destBranch)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isBranchesAllCommittedExcept(Branch branchToExclude) throws OseeCoreException {
+ Collection<Branch> committedTo = getBranchesCommittedTo();
+ for (Branch destBranch : getBranchesToCommitTo()) {
+ if (!destBranch.equals(branchToExclude) && !committedTo.contains(destBranch)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Perform error checks and popup confirmation dialogs associated with creating a working branch.
+ *
+ * @param pageId if specified, WorkPage gets callback to provide confirmation that branch can be created
+ * @param popup if true, errors are popped up to user; otherwise sent silently in Results
+ * @return Result return of status
+ */
+ public Result createWorkingBranch(String pageId, boolean popup) {
+ try {
+ if (isCommittedBranchExists()) {
+ if (popup) {
+ AWorkbench.popup("ERROR", "Can not create another working branch once changes have been committed.");
+ }
+ return new Result("Committed branch already exists.");
+ }
+ Branch parentBranch = getConfiguredBranchForWorkflow();
+ if (parentBranch == null) {
+ String errorStr =
"Parent Branch can not be determined.\n\nPlease specify " + "parent branch through Version Artifact or Team Definition Artifact.\n\n" + "Contact your team lead to configure this.";
- if (popup) {
- AWorkbench.popup("ERROR", errorStr);
- }
- return new Result(errorStr);
- }
- Result result = isCreateBranchAllowed();
- if (result.isFalse()) {
- if (popup) {
- result.popup();
- }
- return result;
- }
- // Retrieve parent branch to create working branch from
- if (popup && !MessageDialog.openConfirm(
+ if (popup) {
+ AWorkbench.popup("ERROR", errorStr);
+ }
+ return new Result(errorStr);
+ }
+ Result result = isCreateBranchAllowed();
+ if (result.isFalse()) {
+ if (popup) {
+ result.popup();
+ }
+ return result;
+ }
+ // Retrieve parent branch to create working branch from
+ if (popup && !MessageDialog.openConfirm(
Displays.getActiveShell(),
"Create Working Branch",
"Create a working branch from parent branch\n\n\"" + parentBranch.getName() + "\"?\n\n" + "NOTE: Working branches are necessary when OSEE Artifact changes " + "are made during implementation.")) {
- return Result.FalseResult;
- }
- createWorkingBranch(pageId, parentBranch);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return new Result("Exception occurred: " + ex.getLocalizedMessage());
- }
- return Result.TrueResult;
- }
-
- public static void createNecessaryBranchEventReviews(StateEventType stateEventType, TeamWorkFlowArtifact teamArt, SkynetTransaction transaction) throws OseeCoreException {
- if (stateEventType != StateEventType.CommitBranch && stateEventType != StateEventType.CreateBranch) {
- throw new OseeStateException("Invalid stateEventType = " + stateEventType);
- }
- // Create any decision and peerToPeer reviews for createBranch and commitBranch
- for (String ruleId : Arrays.asList(AtsAddDecisionReviewRule.ID, AtsAddPeerToPeerReviewRule.ID)) {
- for (WorkRuleDefinition workRuleDef : teamArt.getWorkRulesStartsWith(ruleId)) {
- StateEventType eventType = AtsAddDecisionReviewRule.getStateEventType(teamArt, workRuleDef);
- if (eventType != null && eventType == stateEventType) {
- if (ruleId.equals(AtsAddDecisionReviewRule.ID)) {
- DecisionReviewArtifact decArt =
+ return Result.FalseResult;
+ }
+ createWorkingBranch(pageId, parentBranch);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return new Result("Exception occurred: " + ex.getLocalizedMessage());
+ }
+ return Result.TrueResult;
+ }
+
+ public static void createNecessaryBranchEventReviews(StateEventType stateEventType, TeamWorkFlowArtifact teamArt, SkynetTransaction transaction) throws OseeCoreException {
+ if (stateEventType != StateEventType.CommitBranch && stateEventType != StateEventType.CreateBranch) {
+ throw new OseeStateException("Invalid stateEventType = " + stateEventType);
+ }
+ // Create any decision and peerToPeer reviews for createBranch and commitBranch
+ for (String ruleId : Arrays.asList(AtsAddDecisionReviewRule.ID, AtsAddPeerToPeerReviewRule.ID)) {
+ for (WorkRuleDefinition workRuleDef : teamArt.getWorkRulesStartsWith(ruleId)) {
+ StateEventType eventType = AtsAddDecisionReviewRule.getStateEventType(teamArt, workRuleDef);
+ if (eventType != null && eventType == stateEventType) {
+ if (ruleId.equals(AtsAddDecisionReviewRule.ID)) {
+ DecisionReviewArtifact decArt =
AtsAddDecisionReviewRule.createNewDecisionReview(workRuleDef, transaction, teamArt,
DecisionRuleOption.TransitionToDecision);
- if (decArt != null) {
- decArt.persist(transaction);
- }
- } else if (ruleId.equals(AtsAddPeerToPeerReviewRule.ID)) {
- PeerToPeerReviewArtifact peerArt =
+ if (decArt != null) {
+ decArt.persist(transaction);
+ }
+ } else if (ruleId.equals(AtsAddPeerToPeerReviewRule.ID)) {
+ PeerToPeerReviewArtifact peerArt =
AtsAddPeerToPeerReviewRule.createNewPeerToPeerReview(workRuleDef, teamArt, transaction);
- if (peerArt != null) {
- peerArt.persist(transaction);
- }
- }
- }
- }
- }
- }
-
- /**
- * @return Branch that is the configured branch to create working branch from.
- */
- private Branch getConfiguredBranchForWorkflow() throws OseeCoreException {
- Branch parentBranch = null;
-
- // Check for parent branch id in Version artifact
- if (teamArt.isTeamUsesVersions()) {
- VersionArtifact verArt = teamArt.getTargetedForVersion();
- if (verArt != null) {
- parentBranch = verArt.getParentBranch();
- }
- }
-
- // If not defined in version, check for parent branch from team definition
- if (parentBranch == null && teamArt.isTeamWorkflow()) {
- parentBranch = teamArt.getTeamDefinition().getParentBranch();
- }
-
- // If not defined, return null
- return parentBranch;
- }
-
- /**
- * Create a working branch associated with this state machine artifact. This should NOT be called by applications
- * except in test cases or automated tools. Use createWorkingBranchWithPopups
- */
- public void createWorkingBranch(String pageId, final IOseeBranch parentBranch) throws OseeCoreException {
- final String branchName = Strings.truncate(teamArt.getBranchName(), 195, true);
-
- IExceptionableRunnable runnable = new IExceptionableRunnable() {
- public IStatus run(IProgressMonitor monitor) throws OseeCoreException {
- BranchManager.createWorkingBranch(parentBranch, branchName, teamArt);
- // Create reviews as necessary
- SkynetTransaction transaction =
+ if (peerArt != null) {
+ peerArt.persist(transaction);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @return Branch that is the configured branch to create working branch from.
+ */
+ private Branch getConfiguredBranchForWorkflow() throws OseeCoreException {
+ Branch parentBranch = null;
+
+ // Check for parent branch id in Version artifact
+ if (teamArt.isTeamUsesVersions()) {
+ VersionArtifact verArt = teamArt.getTargetedForVersion();
+ if (verArt != null) {
+ parentBranch = verArt.getParentBranch();
+ }
+ }
+
+ // If not defined in version, check for parent branch from team definition
+ if (parentBranch == null && teamArt.isTeamWorkflow()) {
+ parentBranch = teamArt.getTeamDefinition().getParentBranch();
+ }
+
+ // If not defined, return null
+ return parentBranch;
+ }
+
+ /**
+ * Create a working branch associated with this state machine artifact. This should NOT be called by applications
+ * except in test cases or automated tools. Use createWorkingBranchWithPopups
+ */
+ public void createWorkingBranch(String pageId, final IOseeBranch parentBranch) throws OseeCoreException {
+ final String branchName = Strings.truncate(teamArt.getBranchName(), 195, true);
+
+ IExceptionableRunnable runnable = new IExceptionableRunnable() {
+ public IStatus run(IProgressMonitor monitor) throws OseeCoreException {
+ BranchManager.createWorkingBranch(parentBranch, branchName, teamArt);
+ // Create reviews as necessary
+ SkynetTransaction transaction =
new SkynetTransaction(AtsUtil.getAtsBranch(), "Create Reviews upon Transition");
- createNecessaryBranchEventReviews(StateEventType.CreateBranch, teamArt, transaction);
- transaction.execute();
- return Status.OK_STATUS;
- }
- };
-
- Jobs.runInJob("Create Branch", runnable, AtsPlugin.class, AtsPlugin.PLUGIN_ID);
- }
-
- public boolean isBranchInCommit() throws OseeCoreException {
- if (!isWorkingBranchInWork()) {
- return false;
- }
- return branchesInCommit.contains(getWorkingBranch());
- }
-
- /**
- * @param commitPopup if true, pop-up errors associated with results
- * @param overrideStateValidation if true, don't do checks to see if commit can be performed. This should only be
+ createNecessaryBranchEventReviews(StateEventType.CreateBranch, teamArt, transaction);
+ transaction.execute();
+ return Status.OK_STATUS;
+ }
+ };
+
+ Jobs.runInJob("Create Branch", runnable, AtsPlugin.class, AtsPlugin.PLUGIN_ID);
+ }
+
+ public boolean isBranchInCommit() throws OseeCoreException {
+ if (!isWorkingBranchInWork()) {
+ return false;
+ }
+ return branchesInCommit.contains(getWorkingBranch());
+ }
+
+ /**
+ * @param commitPopup if true, pop-up errors associated with results
+ * @param overrideStateValidation if true, don't do checks to see if commit can be performed. This should only be
* used for developmental testing or automation
- */
- public Job commitWorkingBranch(final boolean commitPopup, final boolean overrideStateValidation, Branch destinationBranch, boolean archiveWorkingBranch) throws OseeCoreException {
- if (isBranchInCommit()) {
- throw new OseeCoreException("Branch is currently being committed.");
- }
- Job job =
+ */
+ public Job commitWorkingBranch(final boolean commitPopup, final boolean overrideStateValidation, Branch destinationBranch, boolean archiveWorkingBranch) throws OseeCoreException {
+ if (isBranchInCommit()) {
+ throw new OseeCoreException("Branch is currently being committed.");
+ }
+ Job job =
new AtsBranchCommitJob(teamArt, commitPopup, overrideStateValidation, destinationBranch, archiveWorkingBranch);
- Operations.scheduleJob(job, true, Job.LONG, null);
- return job;
- }
-
- public ChangeData getChangeDataFromEarliestTransactionId() throws OseeCoreException {
- return getChangeData(null);
- }
-
- /**
- * Return ChangeData represented by commit to commitConfigArt or earliest commit if commitConfigArt == null
- *
- * @param commitConfigArt that configures commit or null
- */
- public ChangeData getChangeData(ICommitConfigArtifact commitConfigArt) throws OseeCoreException {
- if (commitConfigArt != null && commitConfigArt.getParentBranch() == null) {
- throw new OseeArgumentException("Parent Branch not configured for " + commitConfigArt);
- }
- Collection<Change> changes = new ArrayList<Change>();
-
- IOperation operation = null;
- if (teamArt.getBranchMgr().isWorkingBranchInWork()) {
- operation = ChangeManager.comparedToParent(getWorkingBranch(), changes);
- Operations.executeWorkAndCheckStatus(operation, new NullProgressMonitor(), -1.0);
- } else if (teamArt.getBranchMgr().isCommittedBranchExists()) {
- TransactionRecord transactionId = null;
- if (commitConfigArt == null) {
- transactionId = getEarliestTransactionId();
- } else {
- for (TransactionRecord transId : getTransactionIds(false)) {
- if (transId.getBranch() == commitConfigArt.getParentBranch()) {
- transactionId = transId;
- }
- }
- }
- operation = ChangeManager.comparedToPreviousTx(transactionId, changes);
- Operations.executeWorkAndCheckStatus(operation, new NullProgressMonitor(), -1.0);
- }
- return new ChangeData(changes);
- }
+ Operations.scheduleJob(job, true, Job.LONG, null);
+ return job;
+ }
+
+ public ChangeData getChangeDataFromEarliestTransactionId() throws OseeCoreException {
+ return getChangeData(null);
+ }
+
+ /**
+ * Return ChangeData represented by commit to commitConfigArt or earliest commit if commitConfigArt == null
+ *
+ * @param commitConfigArt that configures commit or null
+ */
+ public ChangeData getChangeData(ICommitConfigArtifact commitConfigArt) throws OseeCoreException {
+ if (commitConfigArt != null && commitConfigArt.getParentBranch() == null) {
+ throw new OseeArgumentException("Parent Branch not configured for " + commitConfigArt);
+ }
+ Collection<Change> changes = new ArrayList<Change>();
+
+ IOperation operation = null;
+ if (teamArt.getBranchMgr().isWorkingBranchInWork()) {
+ operation = ChangeManager.comparedToParent(getWorkingBranch(), changes);
+ Operations.executeWorkAndCheckStatus(operation, new NullProgressMonitor(), -1.0);
+ } else if (teamArt.getBranchMgr().isCommittedBranchExists()) {
+ TransactionRecord transactionId = null;
+ if (commitConfigArt == null) {
+ transactionId = getEarliestTransactionId();
+ } else {
+ for (TransactionRecord transId : getTransactionIds(false)) {
+ if (transId.getBranch() == commitConfigArt.getParentBranch()) {
+ transactionId = transId;
+ }
+ }
+ }
+ operation = ChangeManager.comparedToPreviousTx(transactionId, changes);
+ Operations.executeWorkAndCheckStatus(operation, new NullProgressMonitor(), -1.0);
+ }
+ return new ChangeData(changes);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsEditor.java
index 2802d030e70..90a26c50cfa 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsEditor.java
@@ -8,11 +8,11 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.util;
-
-/**
- * @author Donald G. Dunne
- */
-public enum AtsEditor {
- WorldEditor, WorkflowEditor, TaskEditor, ChangeReport
-}
+package org.eclipse.osee.ats.util;
+
+/**
+ * @author Donald G. Dunne
+ */
+public enum AtsEditor {
+ WorldEditor, WorkflowEditor, TaskEditor, ChangeReport
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsFolderUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsFolderUtil.java
index 49a51820b89..022c3f301ab 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsFolderUtil.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsFolderUtil.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.osee.framework.core.data.IArtifactType;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.StaticIdManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsFolderUtil {
-
- public enum AtsFolder {
- Ats_Heading("Action Tracking System", "ats.HeadingFolder", CoreArtifactTypes.Folder),
- Teams("Teams", "osee.ats.TopTeamDefinition", AtsArtifactTypes.TeamDefinition),
- ActionableItem("Actionable Items", "osee.ats.TopActionableItem", AtsArtifactTypes.ActionableItem),
- WorkFlow("Work Flows", "Work Flows", CoreArtifactTypes.Folder),
- WorkRules("Work Rules", "Work Rules", CoreArtifactTypes.Folder),
- WorkWidgets("Work Widgets", "Work Widgets", CoreArtifactTypes.Folder),
- WorkPages("Work Pages", "Work Pages", CoreArtifactTypes.Folder);
- protected final String displayName;
- protected final String staticId;
- protected final IArtifactType artifactType;
-
- private AtsFolder(String displayName, String staticId, IArtifactType artifactType) {
- this.displayName = displayName;
- this.staticId = staticId;
- this.artifactType = artifactType;
- }
-
- /**
- * @return the displayName
- */
- public String getDisplayName() {
- return displayName;
- }
-
- /**
- * @return the staticId
- */
- public String getStaticId() {
- return staticId;
- }
- }
-
- public static Map<AtsFolder, Artifact> folderMap = new HashMap<AtsFolder, Artifact>();
-
- public static Artifact getFolder(AtsFolder atsFolder) throws OseeCoreException {
- if (!folderMap.containsKey(atsFolder)) {
- Artifact artifact =
- StaticIdManager.getSingletonArtifact(atsFolder.artifactType, atsFolder.staticId, AtsUtil.getAtsBranch(),
- true);
- if (artifact == null) {
- throw new OseeStateException(String.format("Can't retrieve Ats folder [%s]", atsFolder.displayName));
- }
- folderMap.put(atsFolder, artifact);
- }
- return folderMap.get(atsFolder);
- }
-
- public static void createAtsFolders() throws OseeCoreException {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Create ATS Folders");
-
- Artifact headingArt =
- OseeSystemArtifacts.getOrCreateArtifact(CoreArtifactTypes.Folder, AtsFolder.Ats_Heading.displayName,
- AtsUtil.getAtsBranch());
- if (!headingArt.hasParent()) {
- Artifact rootArt = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(AtsUtil.getAtsBranch());
- rootArt.addChild(headingArt);
- StaticIdManager.setSingletonAttributeValue(headingArt, AtsFolder.Ats_Heading.staticId);
- headingArt.persist(transaction);
- }
-
- for (AtsFolder atsFolder : AtsFolder.values()) {
- if (atsFolder == AtsFolder.Ats_Heading) {
- continue;
- }
- Artifact art =
- OseeSystemArtifacts.getOrCreateArtifact(atsFolder.artifactType, atsFolder.displayName,
- AtsUtil.getAtsBranch());
- StaticIdManager.setSingletonAttributeValue(art, atsFolder.staticId);
- headingArt.addChild(art);
- art.persist(transaction);
- }
-
- transaction.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.ats.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.StaticIdManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsFolderUtil {
+
+ public enum AtsFolder {
+ Ats_Heading("Action Tracking System", "ats.HeadingFolder", CoreArtifactTypes.Folder),
+ Teams("Teams", "osee.ats.TopTeamDefinition", AtsArtifactTypes.TeamDefinition),
+ ActionableItem("Actionable Items", "osee.ats.TopActionableItem", AtsArtifactTypes.ActionableItem),
+ WorkFlow("Work Flows", "Work Flows", CoreArtifactTypes.Folder),
+ WorkRules("Work Rules", "Work Rules", CoreArtifactTypes.Folder),
+ WorkWidgets("Work Widgets", "Work Widgets", CoreArtifactTypes.Folder),
+ WorkPages("Work Pages", "Work Pages", CoreArtifactTypes.Folder);
+ protected final String displayName;
+ protected final String staticId;
+ protected final IArtifactType artifactType;
+
+ private AtsFolder(String displayName, String staticId, IArtifactType artifactType) {
+ this.displayName = displayName;
+ this.staticId = staticId;
+ this.artifactType = artifactType;
+ }
+
+ /**
+ * @return the displayName
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * @return the staticId
+ */
+ public String getStaticId() {
+ return staticId;
+ }
+ }
+
+ public static Map<AtsFolder, Artifact> folderMap = new HashMap<AtsFolder, Artifact>();
+
+ public static Artifact getFolder(AtsFolder atsFolder) throws OseeCoreException {
+ if (!folderMap.containsKey(atsFolder)) {
+ Artifact artifact =
+ StaticIdManager.getSingletonArtifact(atsFolder.artifactType, atsFolder.staticId, AtsUtil.getAtsBranch(),
+ true);
+ if (artifact == null) {
+ throw new OseeStateException(String.format("Can't retrieve Ats folder [%s]", atsFolder.displayName));
+ }
+ folderMap.put(atsFolder, artifact);
+ }
+ return folderMap.get(atsFolder);
+ }
+
+ public static void createAtsFolders() throws OseeCoreException {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Create ATS Folders");
+
+ Artifact headingArt =
+ OseeSystemArtifacts.getOrCreateArtifact(CoreArtifactTypes.Folder, AtsFolder.Ats_Heading.displayName,
+ AtsUtil.getAtsBranch());
+ if (!headingArt.hasParent()) {
+ Artifact rootArt = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(AtsUtil.getAtsBranch());
+ rootArt.addChild(headingArt);
+ StaticIdManager.setSingletonAttributeValue(headingArt, AtsFolder.Ats_Heading.staticId);
+ headingArt.persist(transaction);
+ }
+
+ for (AtsFolder atsFolder : AtsFolder.values()) {
+ if (atsFolder == AtsFolder.Ats_Heading) {
+ continue;
+ }
+ Artifact art =
+ OseeSystemArtifacts.getOrCreateArtifact(atsFolder.artifactType, atsFolder.displayName,
+ AtsUtil.getAtsBranch());
+ StaticIdManager.setSingletonAttributeValue(art, atsFolder.staticId);
+ headingArt.addChild(art);
+ art.persist(transaction);
+ }
+
+ transaction.execute();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsNotifyUsers.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsNotifyUsers.java
index 695c69365e5..35eb96f11cf 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsNotifyUsers.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsNotifyUsers.java
@@ -1,303 +1,303 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.LogItem;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.role.UserRole;
-import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-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.EventModType;
-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.skynet.core.utility.DbUtil;
-import org.eclipse.osee.framework.ui.skynet.notify.INotificationManager;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationEvent;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationManager;
-import org.eclipse.osee.framework.ui.skynet.util.email.EmailUtil;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-
-/**
- * <REM2>
- *
- * @author Donald G. Dunne
- */
-public class AtsNotifyUsers implements IArtifactEventListener, IFrameworkTransactionEventListener {
-
- private static AtsNotifyUsers instance;
- private INotificationManager notificationManager;
- private boolean inTest = false;
- public static enum NotifyType {
- Subscribed, Cancelled, Completed, Assigned, Originator, Reviewed
- };
-
- public static AtsNotifyUsers getInstance() {
- if (instance == null) {
- instance = new AtsNotifyUsers(OseeNotificationManager.getInstance());
- }
- return instance;
- }
-
- private AtsNotifyUsers(INotificationManager notificationManager) {
- if (DbUtil.isDbInit()) return;
- OseeLog.log(AtsPlugin.class, Level.INFO, "Starting ATS Notification Handler");
- OseeEventManager.addListener(this);
- this.notificationManager = notificationManager;
- }
-
- public void dispose() {
- OseeEventManager.removeListener(this);
- }
-
- public void notify(StateMachineArtifact sma, NotifyType... notifyTypes) throws OseeCoreException {
- notify(sma, null, notifyTypes);
- }
-
- /**
- * @param notifyUsers only valid for assignees notifyType. if null or any other type, the users will be computed
- */
- public void notify(StateMachineArtifact sma, Collection<User> notifyUsers, NotifyType... notifyTypes) throws OseeCoreException {
- if (!isInTest() && (!AtsUtil.isEmailEnabled() || !AtsUtil.isProductionDb() || sma.getName().startsWith("tt "))) {
- return;
- }
- List<NotifyType> types = Collections.getAggregate(notifyTypes);
-
- if (types.contains(NotifyType.Originator)) {
- User originator = sma.getOriginator();
- if (!EmailUtil.isEmailValid(originator)) {
- OseeLog.log(AtsPlugin.class, OseeLevel.INFO,
- String.format("Email [%s] invalid for user [%s]", originator.getEmail(), originator.getName()));
- } else if (!UserManager.getUser().equals(originator)) {
- notificationManager.addNotificationEvent(new OseeNotificationEvent(Arrays.asList(originator),
- getIdString(sma), NotifyType.Originator.name(), String.format(
- "You have been set as the originator of [%s] state [%s] titled [%s]",
- sma.getArtifactTypeName(), sma.getStateMgr().getCurrentStateName(), sma.getName())));
- }
- }
- if (types.contains(NotifyType.Assigned)) {
- Collection<User> assignees = notifyUsers != null ? notifyUsers : sma.getStateMgr().getAssignees();
- assignees.remove(UserManager.getUser());
- assignees = EmailUtil.getValidEmailUsers(assignees);
- if (assignees.size() > 0) {
- notificationManager.addNotificationEvent(new OseeNotificationEvent(assignees, getIdString(sma),
- NotifyType.Assigned.name(), String.format(
- "You have been set as the assignee of [%s] in state [%s] titled [%s]",
- sma.getArtifactTypeName(), sma.getStateMgr().getCurrentStateName(), sma.getName())));
- }
- }
- if (types.contains(NotifyType.Subscribed)) {
- Collection<User> subscribed = sma.getSubscribed();
- subscribed = EmailUtil.getValidEmailUsers(subscribed);
- if (subscribed.size() > 0) {
- notificationManager.addNotificationEvent(new OseeNotificationEvent(subscribed, getIdString(sma),
- NotifyType.Subscribed.name(), String.format(
- "[%s] titled [%s] transitioned to [%s] and you subscribed for notification.",
- sma.getArtifactTypeName(), sma.getName(), sma.getStateMgr().getCurrentStateName())));
- }
- }
- if (types.contains(NotifyType.Cancelled) || types.contains(NotifyType.Completed)) {
- if (((sma.isTeamWorkflow()) || (sma instanceof ReviewSMArtifact)) && (sma.isCompleted() || sma.isCancelled())) {
- User originator = sma.getOriginator();
- if (!EmailUtil.isEmailValid(originator)) {
- OseeLog.log(AtsPlugin.class, OseeLevel.INFO,
- String.format("Email [%s] invalid for user [%s]", originator.getEmail(), originator.getName()));
- } else if (!UserManager.getUser().equals(originator)) {
- if (sma.isCompleted()) {
- notificationManager.addNotificationEvent(new OseeNotificationEvent(Arrays.asList(originator),
- getIdString(sma), NotifyType.Completed.name(), String.format("[%s] titled [%s] is Completed",
- sma.getArtifactTypeName(), sma.getName())));
- }
- if (sma.isCancelled()) {
- LogItem cancelledItem = sma.getLog().getStateEvent(LogType.StateCancelled);
- notificationManager.addNotificationEvent(new OseeNotificationEvent(Arrays.asList(originator),
- getIdString(sma), NotifyType.Cancelled.name(), String.format(
- "[%s] titled [%s] was cancelled from the [%s] state on [%s].<br>Reason: [%s]",
- sma.getArtifactTypeName(), sma.getName(), cancelledItem.getState(),
- cancelledItem.getDate(XDate.MMDDYYHHMM), cancelledItem.getMsg())));
- }
- }
- }
- }
- if (types.contains(NotifyType.Reviewed)) {
- if (sma instanceof ReviewSMArtifact) {
- if (((ReviewSMArtifact) sma).getUserRoleManager() != null) {
- Collection<User> authorModerator =
- ((ReviewSMArtifact) sma).getUserRoleManager().getRoleUsersAuthorModerator();
- authorModerator = EmailUtil.getValidEmailUsers(authorModerator);
- if (authorModerator.size() > 0) {
- for (UserRole role : ((ReviewSMArtifact) sma).getUserRoleManager().getRoleUsersReviewComplete()) {
- notificationManager.addNotificationEvent(new OseeNotificationEvent(authorModerator,
- getIdString(sma), NotifyType.Reviewed.name(), String.format(
- "[%s] titled [%s] has been Reviewed by [%s]", sma.getArtifactTypeName(),
- sma.getName(), role.getUser().getName())));
- }
- }
- }
- }
- }
- }
-
- private static String getIdString(StateMachineArtifact sma) {
- try {
- String legacyPcrId = sma.getWorldViewLegacyPCR();
- if (!legacyPcrId.equals("")) {
- return "HRID: " + sma.getHumanReadableId() + " / LegacyId: " + legacyPcrId;
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- return "HRID: " + sma.getHumanReadableId();
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
- if (DbUtil.isDbInit()) return;
- // Only process notifications if this client is sender
- if (sender.isRemote()) return;
- if (transData.branchId != AtsUtil.getAtsBranch().getId()) return;
- boolean notificationAdded = false;
- try {
- // Handle notifications for subscription by TeamDefinition and ActionableItem
- for (Artifact art : transData.cacheAddedArtifacts) {
- if (art instanceof TeamWorkFlowArtifact) {
- TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) art;
-
- // Handle Team Definitions
- Collection<User> subscribedUsers =
- Collections.castAll(teamArt.getTeamDefinition().getRelatedArtifacts(
- AtsRelationTypes.SubscribedUser_User));
- if (subscribedUsers.size() > 0) {
- notificationAdded = true;
- notificationManager.addNotificationEvent(new OseeNotificationEvent(
- subscribedUsers,
- getIdString(teamArt),
- "Workflow Creation",
- "You have subscribed for email notification for Team \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
- }
-
- // Handle Actionable Items
- for (ActionableItemArtifact aia : teamArt.getActionableItemsDam().getActionableItems()) {
- subscribedUsers = Collections.castAll(aia.getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User));
- if (subscribedUsers.size() > 0) {
- notificationAdded = true;
- notificationManager.addNotificationEvent(new OseeNotificationEvent(
- subscribedUsers,
- getIdString(teamArt),
- "Workflow Creation",
- "You have subscribed for email notification for Actionable Item \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
- }
- }
- }
- }
- } finally {
- if (notificationAdded) {
- notificationManager.sendNotifications();
- }
- }
- }
-
- public void setNotificationManager(INotificationManager notificationManager) {
- this.notificationManager = notificationManager;
- }
-
- public boolean isInTest() {
- return inTest;
- }
-
- public void setInTest(boolean inTest) {
- this.inTest = inTest;
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getTeamWorkflowArtifactTypeEventFilter());
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- if (DbUtil.isDbInit()) return;
- // Only process notifications if this client is sender
- try {
- if (sender.isRemote()) return;
- } catch (OseeAuthenticationRequiredException ex) {
- return;
- }
- boolean notificationAdded = false;
- try {
- // Handle notifications for subscription by TeamDefinition and ActionableItem
- for (Artifact art : artifactEvent.getCacheArtifacts(EventModType.Added)) {
- try {
- if (art instanceof TeamWorkFlowArtifact) {
- TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) art;
-
- // Handle Team Definitions
- Collection<User> subscribedUsers =
- Collections.castAll(teamArt.getTeamDefinition().getRelatedArtifacts(
- AtsRelationTypes.SubscribedUser_User));
- if (subscribedUsers.size() > 0) {
- notificationAdded = true;
- notificationManager.addNotificationEvent(new OseeNotificationEvent(
- subscribedUsers,
- getIdString(teamArt),
- "Workflow Creation",
- "You have subscribed for email notification for Team \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
- }
-
- // Handle Actionable Items
- for (ActionableItemArtifact aia : teamArt.getActionableItemsDam().getActionableItems()) {
- subscribedUsers =
- Collections.castAll(aia.getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User));
- if (subscribedUsers.size() > 0) {
- notificationAdded = true;
- notificationManager.addNotificationEvent(new OseeNotificationEvent(
- subscribedUsers,
- getIdString(teamArt),
- "Workflow Creation",
- "You have subscribed for email notification for Actionable Item \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
- }
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- } finally {
- if (notificationAdded) {
- try {
- notificationManager.sendNotifications();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.LogItem;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.role.UserRole;
+import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+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.EventModType;
+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.skynet.core.utility.DbUtil;
+import org.eclipse.osee.framework.ui.skynet.notify.INotificationManager;
+import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationEvent;
+import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationManager;
+import org.eclipse.osee.framework.ui.skynet.util.email.EmailUtil;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+
+/**
+ * <REM2>
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsNotifyUsers implements IArtifactEventListener, IFrameworkTransactionEventListener {
+
+ private static AtsNotifyUsers instance;
+ private INotificationManager notificationManager;
+ private boolean inTest = false;
+ public static enum NotifyType {
+ Subscribed, Cancelled, Completed, Assigned, Originator, Reviewed
+ };
+
+ public static AtsNotifyUsers getInstance() {
+ if (instance == null) {
+ instance = new AtsNotifyUsers(OseeNotificationManager.getInstance());
+ }
+ return instance;
+ }
+
+ private AtsNotifyUsers(INotificationManager notificationManager) {
+ if (DbUtil.isDbInit()) return;
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Starting ATS Notification Handler");
+ OseeEventManager.addListener(this);
+ this.notificationManager = notificationManager;
+ }
+
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ }
+
+ public void notify(StateMachineArtifact sma, NotifyType... notifyTypes) throws OseeCoreException {
+ notify(sma, null, notifyTypes);
+ }
+
+ /**
+ * @param notifyUsers only valid for assignees notifyType. if null or any other type, the users will be computed
+ */
+ public void notify(StateMachineArtifact sma, Collection<User> notifyUsers, NotifyType... notifyTypes) throws OseeCoreException {
+ if (!isInTest() && (!AtsUtil.isEmailEnabled() || !AtsUtil.isProductionDb() || sma.getName().startsWith("tt "))) {
+ return;
+ }
+ List<NotifyType> types = Collections.getAggregate(notifyTypes);
+
+ if (types.contains(NotifyType.Originator)) {
+ User originator = sma.getOriginator();
+ if (!EmailUtil.isEmailValid(originator)) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.INFO,
+ String.format("Email [%s] invalid for user [%s]", originator.getEmail(), originator.getName()));
+ } else if (!UserManager.getUser().equals(originator)) {
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(Arrays.asList(originator),
+ getIdString(sma), NotifyType.Originator.name(), String.format(
+ "You have been set as the originator of [%s] state [%s] titled [%s]",
+ sma.getArtifactTypeName(), sma.getStateMgr().getCurrentStateName(), sma.getName())));
+ }
+ }
+ if (types.contains(NotifyType.Assigned)) {
+ Collection<User> assignees = notifyUsers != null ? notifyUsers : sma.getStateMgr().getAssignees();
+ assignees.remove(UserManager.getUser());
+ assignees = EmailUtil.getValidEmailUsers(assignees);
+ if (assignees.size() > 0) {
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(assignees, getIdString(sma),
+ NotifyType.Assigned.name(), String.format(
+ "You have been set as the assignee of [%s] in state [%s] titled [%s]",
+ sma.getArtifactTypeName(), sma.getStateMgr().getCurrentStateName(), sma.getName())));
+ }
+ }
+ if (types.contains(NotifyType.Subscribed)) {
+ Collection<User> subscribed = sma.getSubscribed();
+ subscribed = EmailUtil.getValidEmailUsers(subscribed);
+ if (subscribed.size() > 0) {
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(subscribed, getIdString(sma),
+ NotifyType.Subscribed.name(), String.format(
+ "[%s] titled [%s] transitioned to [%s] and you subscribed for notification.",
+ sma.getArtifactTypeName(), sma.getName(), sma.getStateMgr().getCurrentStateName())));
+ }
+ }
+ if (types.contains(NotifyType.Cancelled) || types.contains(NotifyType.Completed)) {
+ if (((sma.isTeamWorkflow()) || (sma instanceof ReviewSMArtifact)) && (sma.isCompleted() || sma.isCancelled())) {
+ User originator = sma.getOriginator();
+ if (!EmailUtil.isEmailValid(originator)) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.INFO,
+ String.format("Email [%s] invalid for user [%s]", originator.getEmail(), originator.getName()));
+ } else if (!UserManager.getUser().equals(originator)) {
+ if (sma.isCompleted()) {
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(Arrays.asList(originator),
+ getIdString(sma), NotifyType.Completed.name(), String.format("[%s] titled [%s] is Completed",
+ sma.getArtifactTypeName(), sma.getName())));
+ }
+ if (sma.isCancelled()) {
+ LogItem cancelledItem = sma.getLog().getStateEvent(LogType.StateCancelled);
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(Arrays.asList(originator),
+ getIdString(sma), NotifyType.Cancelled.name(), String.format(
+ "[%s] titled [%s] was cancelled from the [%s] state on [%s].<br>Reason: [%s]",
+ sma.getArtifactTypeName(), sma.getName(), cancelledItem.getState(),
+ cancelledItem.getDate(XDate.MMDDYYHHMM), cancelledItem.getMsg())));
+ }
+ }
+ }
+ }
+ if (types.contains(NotifyType.Reviewed)) {
+ if (sma instanceof ReviewSMArtifact) {
+ if (((ReviewSMArtifact) sma).getUserRoleManager() != null) {
+ Collection<User> authorModerator =
+ ((ReviewSMArtifact) sma).getUserRoleManager().getRoleUsersAuthorModerator();
+ authorModerator = EmailUtil.getValidEmailUsers(authorModerator);
+ if (authorModerator.size() > 0) {
+ for (UserRole role : ((ReviewSMArtifact) sma).getUserRoleManager().getRoleUsersReviewComplete()) {
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(authorModerator,
+ getIdString(sma), NotifyType.Reviewed.name(), String.format(
+ "[%s] titled [%s] has been Reviewed by [%s]", sma.getArtifactTypeName(),
+ sma.getName(), role.getUser().getName())));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private static String getIdString(StateMachineArtifact sma) {
+ try {
+ String legacyPcrId = sma.getWorldViewLegacyPCR();
+ if (!legacyPcrId.equals("")) {
+ return "HRID: " + sma.getHumanReadableId() + " / LegacyId: " + legacyPcrId;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ return "HRID: " + sma.getHumanReadableId();
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
+ if (DbUtil.isDbInit()) return;
+ // Only process notifications if this client is sender
+ if (sender.isRemote()) return;
+ if (transData.branchId != AtsUtil.getAtsBranch().getId()) return;
+ boolean notificationAdded = false;
+ try {
+ // Handle notifications for subscription by TeamDefinition and ActionableItem
+ for (Artifact art : transData.cacheAddedArtifacts) {
+ if (art instanceof TeamWorkFlowArtifact) {
+ TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) art;
+
+ // Handle Team Definitions
+ Collection<User> subscribedUsers =
+ Collections.castAll(teamArt.getTeamDefinition().getRelatedArtifacts(
+ AtsRelationTypes.SubscribedUser_User));
+ if (subscribedUsers.size() > 0) {
+ notificationAdded = true;
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(
+ subscribedUsers,
+ getIdString(teamArt),
+ "Workflow Creation",
+ "You have subscribed for email notification for Team \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
+ }
+
+ // Handle Actionable Items
+ for (ActionableItemArtifact aia : teamArt.getActionableItemsDam().getActionableItems()) {
+ subscribedUsers = Collections.castAll(aia.getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User));
+ if (subscribedUsers.size() > 0) {
+ notificationAdded = true;
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(
+ subscribedUsers,
+ getIdString(teamArt),
+ "Workflow Creation",
+ "You have subscribed for email notification for Actionable Item \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
+ }
+ }
+ }
+ }
+ } finally {
+ if (notificationAdded) {
+ notificationManager.sendNotifications();
+ }
+ }
+ }
+
+ public void setNotificationManager(INotificationManager notificationManager) {
+ this.notificationManager = notificationManager;
+ }
+
+ public boolean isInTest() {
+ return inTest;
+ }
+
+ public void setInTest(boolean inTest) {
+ this.inTest = inTest;
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getTeamWorkflowArtifactTypeEventFilter());
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ if (DbUtil.isDbInit()) return;
+ // Only process notifications if this client is sender
+ try {
+ if (sender.isRemote()) return;
+ } catch (OseeAuthenticationRequiredException ex) {
+ return;
+ }
+ boolean notificationAdded = false;
+ try {
+ // Handle notifications for subscription by TeamDefinition and ActionableItem
+ for (Artifact art : artifactEvent.getCacheArtifacts(EventModType.Added)) {
+ try {
+ if (art instanceof TeamWorkFlowArtifact) {
+ TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) art;
+
+ // Handle Team Definitions
+ Collection<User> subscribedUsers =
+ Collections.castAll(teamArt.getTeamDefinition().getRelatedArtifacts(
+ AtsRelationTypes.SubscribedUser_User));
+ if (subscribedUsers.size() > 0) {
+ notificationAdded = true;
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(
+ subscribedUsers,
+ getIdString(teamArt),
+ "Workflow Creation",
+ "You have subscribed for email notification for Team \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
+ }
+
+ // Handle Actionable Items
+ for (ActionableItemArtifact aia : teamArt.getActionableItemsDam().getActionableItems()) {
+ subscribedUsers =
+ Collections.castAll(aia.getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User));
+ if (subscribedUsers.size() > 0) {
+ notificationAdded = true;
+ notificationManager.addNotificationEvent(new OseeNotificationEvent(
+ subscribedUsers,
+ getIdString(teamArt),
+ "Workflow Creation",
+ "You have subscribed for email notification for Actionable Item \"" + teamArt.getTeamName() + "\"; New Team Workflow created with title \"" + teamArt.getName() + "\""));
+ }
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ } finally {
+ if (notificationAdded) {
+ try {
+ notificationManager.sendNotifications();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPreSaveCacheRemoteEventHandler.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPreSaveCacheRemoteEventHandler.java
index e50b9f03280..7b7c69ed9bb 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPreSaveCacheRemoteEventHandler.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPreSaveCacheRemoteEventHandler.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-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.EventModType;
-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.skynet.core.utility.DbUtil;
-
-/**
- * This class handles updating ATS state machine artifacts based on remote events that change the assignees. Without
- * this, the client will think it changed the assignees if the artifact is saved after the remote modified event.<br>
- * <REM2>
- *
- * @author Donald G. Dunne
- */
-public class AtsPreSaveCacheRemoteEventHandler implements IArtifactEventListener, IFrameworkTransactionEventListener {
-
- private static AtsPreSaveCacheRemoteEventHandler instance = new AtsPreSaveCacheRemoteEventHandler();
-
- public static AtsPreSaveCacheRemoteEventHandler start() {
- return instance;
- }
-
- private AtsPreSaveCacheRemoteEventHandler() {
- if (DbUtil.isDbInit()) return;
- OseeLog.log(AtsPlugin.class, Level.INFO, "Starting ATS Pre-Save Remote Event Handler");
- OseeEventManager.addListener(this);
- }
-
- public void dispose() {
- OseeEventManager.removeListener(this);
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
- if (DbUtil.isDbInit()) return;
- if (transData.branchId != AtsUtil.getAtsBranch().getId()) return;
- for (Artifact artifact : transData.cacheChangedArtifacts) {
- if (artifact instanceof StateMachineArtifact) {
- ((StateMachineArtifact) artifact).initalizePreSaveCache();
- }
- }
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return AtsUtil.getAtsObjectEventFilters();
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- if (DbUtil.isDbInit()) return;
- for (Artifact artifact : artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded)) {
- if (artifact instanceof StateMachineArtifact) {
- ((StateMachineArtifact) artifact).initalizePreSaveCache();
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+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.EventModType;
+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.skynet.core.utility.DbUtil;
+
+/**
+ * This class handles updating ATS state machine artifacts based on remote events that change the assignees. Without
+ * this, the client will think it changed the assignees if the artifact is saved after the remote modified event.<br>
+ * <REM2>
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsPreSaveCacheRemoteEventHandler implements IArtifactEventListener, IFrameworkTransactionEventListener {
+
+ private static AtsPreSaveCacheRemoteEventHandler instance = new AtsPreSaveCacheRemoteEventHandler();
+
+ public static AtsPreSaveCacheRemoteEventHandler start() {
+ return instance;
+ }
+
+ private AtsPreSaveCacheRemoteEventHandler() {
+ if (DbUtil.isDbInit()) return;
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Starting ATS Pre-Save Remote Event Handler");
+ OseeEventManager.addListener(this);
+ }
+
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
+ if (DbUtil.isDbInit()) return;
+ if (transData.branchId != AtsUtil.getAtsBranch().getId()) return;
+ for (Artifact artifact : transData.cacheChangedArtifacts) {
+ if (artifact instanceof StateMachineArtifact) {
+ ((StateMachineArtifact) artifact).initalizePreSaveCache();
+ }
+ }
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return AtsUtil.getAtsObjectEventFilters();
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ if (DbUtil.isDbInit()) return;
+ for (Artifact artifact : artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded)) {
+ if (artifact instanceof StateMachineArtifact) {
+ ((StateMachineArtifact) artifact).initalizePreSaveCache();
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPriority.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPriority.java
index c0a0f5ac7e1..47bec9e7277 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPriority.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsPriority.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.ats.util;
-
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsPriority {
-
- public static String PRIORITY_HELP_CONTEXT_ID = "atsPriority";
-
- public static enum PriorityType {
- None(""), Priority_1("1"), Priority_2("2"), Priority_3("3"), Priority_4("4"), Priority_5("5");
-
- private final String shortName;
-
- private PriorityType(String shortName) {
- this.shortName = shortName;
- }
-
- public String getShortName() {
- return shortName;
- }
-
- public static String[] getPriorities() {
- String priorities[] = new String[PriorityType.values().length];
- int x = 0;
- for (PriorityType pri : PriorityType.values())
- priorities[x++] = pri.toString();
- return priorities;
- }
-
- public static String[] getPrioritiesWithoutNone() {
- String priorities[] = new String[PriorityType.values().length - 1];
- int x = 0;
- for (PriorityType pri : PriorityType.values())
- if (pri != PriorityType.None) priorities[x++] = pri.toString();
- return priorities;
- }
-
- @Override
- public String toString() {
- return shortName;
- }
-
- public static PriorityType getPriority(String type) throws OseeCoreException {
- if (type == null || type.equals("")) return PriorityType.None;
- for (PriorityType pri : PriorityType.values()) {
- if (type.equals(pri.getShortName())) return pri;
- }
- throw new OseeStateException("Invalid priority => " + type);
- }
-
- };
-
- public static void openHelp() {
- AtsPlugin.getInstance().displayHelp(PRIORITY_HELP_CONTEXT_ID, "org.eclipse.osee.ats.help.ui");
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util;
+
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsPriority {
+
+ public static String PRIORITY_HELP_CONTEXT_ID = "atsPriority";
+
+ public static enum PriorityType {
+ None(""), Priority_1("1"), Priority_2("2"), Priority_3("3"), Priority_4("4"), Priority_5("5");
+
+ private final String shortName;
+
+ private PriorityType(String shortName) {
+ this.shortName = shortName;
+ }
+
+ public String getShortName() {
+ return shortName;
+ }
+
+ public static String[] getPriorities() {
+ String priorities[] = new String[PriorityType.values().length];
+ int x = 0;
+ for (PriorityType pri : PriorityType.values())
+ priorities[x++] = pri.toString();
+ return priorities;
+ }
+
+ public static String[] getPrioritiesWithoutNone() {
+ String priorities[] = new String[PriorityType.values().length - 1];
+ int x = 0;
+ for (PriorityType pri : PriorityType.values())
+ if (pri != PriorityType.None) priorities[x++] = pri.toString();
+ return priorities;
+ }
+
+ @Override
+ public String toString() {
+ return shortName;
+ }
+
+ public static PriorityType getPriority(String type) throws OseeCoreException {
+ if (type == null || type.equals("")) return PriorityType.None;
+ for (PriorityType pri : PriorityType.values()) {
+ if (type.equals(pri.getShortName())) return pri;
+ }
+ throw new OseeStateException("Invalid priority => " + type);
+ }
+
+ };
+
+ public static void openHelp() {
+ AtsPlugin.getInstance().displayHelp(PRIORITY_HELP_CONTEXT_ID, "org.eclipse.osee.ats.help.ui");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsRelationTypes.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsRelationTypes.java
index b54dc09a175..a233dd967ec 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsRelationTypes.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsRelationTypes.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import org.eclipse.osee.framework.core.data.IRelationType;
-import org.eclipse.osee.framework.core.data.NamedIdentity;
-import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
-import org.eclipse.osee.framework.core.enums.RelationSide;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsRelationTypes extends NamedIdentity implements IRelationEnumeration, IRelationType {
- private final RelationSide relationSide;
-
- public static final AtsRelationTypes ActionToWorkflow_Action =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE953ixQThusHUPwA", "ActionToWorkflow");
- public static final AtsRelationTypes ActionToWorkflow_WorkFlow =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE953ixQThusHUPwA", "ActionToWorkflow");
- public static final AtsRelationTypes FavoriteUser_Artifact =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+NegDLK1g2ph+AA", "FavoriteUser");
- public static final AtsRelationTypes FavoriteUser_User =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+NegDLK1g2ph+AA", "FavoriteUser");
- public static final AtsRelationTypes Goal_Goal =
- new AtsRelationTypes(RelationSide.SIDE_A, "ABMn0wPKdyN+Mfo5nwgA", "Goal");
- public static final AtsRelationTypes Goal_Member =
- new AtsRelationTypes(RelationSide.SIDE_B, "ABMn0wPKdyN+Mfo5nwgA", "Goal");
- public static final AtsRelationTypes ParallelVersion_Child =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE_EJHSBGb9msPXQA", "ParallelVersion");
- public static final AtsRelationTypes ParallelVersion_Parent =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE_EJHSBGb9msPXQA", "ParallelVersion");
- public static final AtsRelationTypes PrivilegedMember_Member =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE9XfiibyK1x2FiwA", "PrivilegedMember");
- public static final AtsRelationTypes PrivilegedMember_Team =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE9XfiibyK1x2FiwA", "PrivilegedMember");
- public static final AtsRelationTypes SmaToTask_Sma =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE97xw1BM5l+GxKAA", "SmaToTask");
- public static final AtsRelationTypes SmaToTask_Task =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE97xw1BM5l+GxKAA", "SmaToTask");
- public static final AtsRelationTypes SubscribedUser_Artifact =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+LkSAkfUWoTHdwA", "SubscribedUser");
- public static final AtsRelationTypes SubscribedUser_User =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+LkSAkfUWoTHdwA", "SubscribedUser");
- public static final AtsRelationTypes TeamActionableItem_ActionableItem =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE939Ul9Oenq9wWgA", "TeamActionableItem");
- public static final AtsRelationTypes TeamActionableItem_Team =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE939Ul9Oenq9wWgA", "TeamActionableItem");
- public static final AtsRelationTypes TeamDefinitionToDecisionReviewWorkflowDiagram_TeamDefinition =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+Fg4RmKrda_jJQA",
- "TeamDefinitionToDecisionReviewWorkflowDiagram");
- public static final AtsRelationTypes TeamDefinitionToDecisionReviewWorkflowDiagram_WorkflowDiagram =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+Fg4RmKrda_jJQA",
- "TeamDefinitionToDecisionReviewWorkflowDiagram");
- public static final AtsRelationTypes TeamDefinitionToPeerToPeerReviewWorkflowDiagram_TeamDefinition =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+HqYUG262IxMFwA",
- "TeamDefinitionToPeerToPeerReviewWorkflowDiagram");
- public static final AtsRelationTypes TeamDefinitionToPeerToPeerReviewWorkflowDiagram_WorkflowDiagram =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+HqYUG262IxMFwA",
- "TeamDefinitionToPeerToPeerReviewWorkflowDiagram");
- public static final AtsRelationTypes TeamDefinitionToTaskWorkflowDiagram_TeamDefinition =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+DkeQ9mRBPca0QA", "TeamDefinitionToTaskWorkflowDiagram");
- public static final AtsRelationTypes TeamDefinitionToTaskWorkflowDiagram_WorkflowDiagram =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+DkeQ9mRBPca0QA", "TeamDefinitionToTaskWorkflowDiagram");
- public static final AtsRelationTypes TeamDefinitionToVersion_TeamDefinition =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE9_i7zG3lR1kGWQA", "TeamDefinitionToVersion");
- public static final AtsRelationTypes TeamDefinitionToVersion_Version =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE9_i7zG3lR1kGWQA", "TeamDefinitionToVersion");
- public static final AtsRelationTypes TeamDefinitionToWorkflowDiagram_TeamDefinition =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+BpKTGewbN8c3gA", "TeamDefinitionToWorkflowDiagram");
- public static final AtsRelationTypes TeamDefinitionToWorkflowDiagram_WorkflowDiagram =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+BpKTGewbN8c3gA", "TeamDefinitionToWorkflowDiagram");
- public static final AtsRelationTypes TeamLead_Lead =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE90HyTZPyHuQWOQA", "TeamLead");
- public static final AtsRelationTypes TeamLead_Team =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE90HyTZPyHuQWOQA", "TeamLead");
- public static final AtsRelationTypes TeamMember_Member =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE92A6gCO9WJ2ijQA", "TeamMember");
- public static final AtsRelationTypes TeamMember_Team =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE92A6gCO9WJ2ijQA", "TeamMember");
- public static final AtsRelationTypes TeamWorkflowTargetedForVersion_Version =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE99pzm4zSibDT9gA", "TeamWorkflowTargetedForVersion");
- public static final AtsRelationTypes TeamWorkflowTargetedForVersion_Workflow =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE99pzm4zSibDT9gA", "TeamWorkflowTargetedForVersion");
- public static final AtsRelationTypes TeamWorkflowToReview_Review =
- new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+JqDz+8tuRDdIwA", "TeamWorkflowToReview");
- public static final AtsRelationTypes TeamWorkflowToReview_Team =
- new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+JqDz+8tuRDdIwA", "TeamWorkflowToReview");
-
- private AtsRelationTypes(RelationSide relationSide, String guid, String name) {
- super(guid, name);
- this.relationSide = relationSide;
- }
-
- @Override
- public RelationSide getSide() {
- return relationSide;
- }
+/*******************************************************************************
+ * 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.ats.util;
+
+import org.eclipse.osee.framework.core.data.IRelationType;
+import org.eclipse.osee.framework.core.data.NamedIdentity;
+import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
+import org.eclipse.osee.framework.core.enums.RelationSide;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsRelationTypes extends NamedIdentity implements IRelationEnumeration, IRelationType {
+ private final RelationSide relationSide;
+
+ public static final AtsRelationTypes ActionToWorkflow_Action =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE953ixQThusHUPwA", "ActionToWorkflow");
+ public static final AtsRelationTypes ActionToWorkflow_WorkFlow =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE953ixQThusHUPwA", "ActionToWorkflow");
+ public static final AtsRelationTypes FavoriteUser_Artifact =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+NegDLK1g2ph+AA", "FavoriteUser");
+ public static final AtsRelationTypes FavoriteUser_User =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+NegDLK1g2ph+AA", "FavoriteUser");
+ public static final AtsRelationTypes Goal_Goal =
+ new AtsRelationTypes(RelationSide.SIDE_A, "ABMn0wPKdyN+Mfo5nwgA", "Goal");
+ public static final AtsRelationTypes Goal_Member =
+ new AtsRelationTypes(RelationSide.SIDE_B, "ABMn0wPKdyN+Mfo5nwgA", "Goal");
+ public static final AtsRelationTypes ParallelVersion_Child =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE_EJHSBGb9msPXQA", "ParallelVersion");
+ public static final AtsRelationTypes ParallelVersion_Parent =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE_EJHSBGb9msPXQA", "ParallelVersion");
+ public static final AtsRelationTypes PrivilegedMember_Member =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE9XfiibyK1x2FiwA", "PrivilegedMember");
+ public static final AtsRelationTypes PrivilegedMember_Team =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE9XfiibyK1x2FiwA", "PrivilegedMember");
+ public static final AtsRelationTypes SmaToTask_Sma =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE97xw1BM5l+GxKAA", "SmaToTask");
+ public static final AtsRelationTypes SmaToTask_Task =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE97xw1BM5l+GxKAA", "SmaToTask");
+ public static final AtsRelationTypes SubscribedUser_Artifact =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+LkSAkfUWoTHdwA", "SubscribedUser");
+ public static final AtsRelationTypes SubscribedUser_User =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+LkSAkfUWoTHdwA", "SubscribedUser");
+ public static final AtsRelationTypes TeamActionableItem_ActionableItem =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE939Ul9Oenq9wWgA", "TeamActionableItem");
+ public static final AtsRelationTypes TeamActionableItem_Team =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE939Ul9Oenq9wWgA", "TeamActionableItem");
+ public static final AtsRelationTypes TeamDefinitionToDecisionReviewWorkflowDiagram_TeamDefinition =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+Fg4RmKrda_jJQA",
+ "TeamDefinitionToDecisionReviewWorkflowDiagram");
+ public static final AtsRelationTypes TeamDefinitionToDecisionReviewWorkflowDiagram_WorkflowDiagram =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+Fg4RmKrda_jJQA",
+ "TeamDefinitionToDecisionReviewWorkflowDiagram");
+ public static final AtsRelationTypes TeamDefinitionToPeerToPeerReviewWorkflowDiagram_TeamDefinition =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+HqYUG262IxMFwA",
+ "TeamDefinitionToPeerToPeerReviewWorkflowDiagram");
+ public static final AtsRelationTypes TeamDefinitionToPeerToPeerReviewWorkflowDiagram_WorkflowDiagram =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+HqYUG262IxMFwA",
+ "TeamDefinitionToPeerToPeerReviewWorkflowDiagram");
+ public static final AtsRelationTypes TeamDefinitionToTaskWorkflowDiagram_TeamDefinition =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+DkeQ9mRBPca0QA", "TeamDefinitionToTaskWorkflowDiagram");
+ public static final AtsRelationTypes TeamDefinitionToTaskWorkflowDiagram_WorkflowDiagram =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+DkeQ9mRBPca0QA", "TeamDefinitionToTaskWorkflowDiagram");
+ public static final AtsRelationTypes TeamDefinitionToVersion_TeamDefinition =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE9_i7zG3lR1kGWQA", "TeamDefinitionToVersion");
+ public static final AtsRelationTypes TeamDefinitionToVersion_Version =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE9_i7zG3lR1kGWQA", "TeamDefinitionToVersion");
+ public static final AtsRelationTypes TeamDefinitionToWorkflowDiagram_TeamDefinition =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+BpKTGewbN8c3gA", "TeamDefinitionToWorkflowDiagram");
+ public static final AtsRelationTypes TeamDefinitionToWorkflowDiagram_WorkflowDiagram =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+BpKTGewbN8c3gA", "TeamDefinitionToWorkflowDiagram");
+ public static final AtsRelationTypes TeamLead_Lead =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE90HyTZPyHuQWOQA", "TeamLead");
+ public static final AtsRelationTypes TeamLead_Team =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE90HyTZPyHuQWOQA", "TeamLead");
+ public static final AtsRelationTypes TeamMember_Member =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE92A6gCO9WJ2ijQA", "TeamMember");
+ public static final AtsRelationTypes TeamMember_Team =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE92A6gCO9WJ2ijQA", "TeamMember");
+ public static final AtsRelationTypes TeamWorkflowTargetedForVersion_Version =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE99pzm4zSibDT9gA", "TeamWorkflowTargetedForVersion");
+ public static final AtsRelationTypes TeamWorkflowTargetedForVersion_Workflow =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE99pzm4zSibDT9gA", "TeamWorkflowTargetedForVersion");
+ public static final AtsRelationTypes TeamWorkflowToReview_Review =
+ new AtsRelationTypes(RelationSide.SIDE_B, "AAMFE+JqDz+8tuRDdIwA", "TeamWorkflowToReview");
+ public static final AtsRelationTypes TeamWorkflowToReview_Team =
+ new AtsRelationTypes(RelationSide.SIDE_A, "AAMFE+JqDz+8tuRDdIwA", "TeamWorkflowToReview");
+
+ private AtsRelationTypes(RelationSide relationSide, String guid, String name) {
+ super(guid, name);
+ this.relationSide = relationSide;
+ }
+
+ @Override
+ public RelationSide getSide() {
+ return relationSide;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
index 183135ef512..b8c63765164 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
@@ -1,514 +1,514 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.osee.ats.AtsOpenOption;
-import org.eclipse.osee.ats.actions.NewAction;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.AtsAttributeTypes;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkflowLabelProvider;
-import org.eclipse.osee.ats.config.AtsBulkLoad;
-import org.eclipse.osee.ats.config.AtsCacheManager;
-import org.eclipse.osee.ats.editor.SMAEditor;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.task.TaskEditor;
-import org.eclipse.osee.ats.task.TaskEditorSimpleProvider;
-import org.eclipse.osee.ats.world.WorldEditor;
-import org.eclipse.osee.ats.world.WorldEditorSimpleProvider;
-import org.eclipse.osee.ats.world.WorldEditorUISearchItemProvider;
-import org.eclipse.osee.ats.world.search.GroupWorldSearchItem;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.core.enums.Active;
-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.Branch;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.OseeGroup;
-import org.eclipse.osee.framework.skynet.core.User;
-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.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event2.filter.ArtifactTypeEventFilter;
-import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
-import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
-import org.eclipse.osee.framework.skynet.core.utility.IncrementingNum;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.XFormToolkit;
-import org.eclipse.osee.framework.ui.skynet.ats.OseeEditor;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.KeyedImage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.dialogs.ListDialog;
-
-/**
- * @author Donald G. Dunne
- */
-public final class AtsUtil {
-
- private static boolean emailEnabled = true;
- public static Color ACTIVE_COLOR = new Color(null, 206, 212, 239);
- private static OseeGroup atsAdminGroup = null;
- private static final Date today = new Date();
- public static int MILLISECS_PER_DAY = 1000 * 60 * 60 * 24;
- public final static String normalColor = "#FFFFFF";
- public final static String activeColor = "#EEEEEE";
- private static ArtifactTypeEventFilter atsObjectArtifactTypesFilter, reviewArtifactTypesFilter,
- teamWorkflowArtifactTypesFilter, workItemArtifactTypesFilter;
- private static List<IEventFilter> atsObjectEventFilter;
-
- private AtsUtil() {
- super();
- }
-
- public static boolean isInTest() {
- return Boolean.valueOf(System.getProperty("osee.isInTest"));
- }
-
- public static long daysTillToday(Date date) throws OseeCoreException {
- return (date.getTime() - today.getTime()) / MILLISECS_PER_DAY;
- }
-
- public static boolean isProductionDb() throws OseeCoreException {
- return ClientSessionManager.isProductionDataStore();
- }
-
- public static boolean isAtsAdmin() {
- try {
- return getAtsAdminGroup().isCurrentUserMember();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return false;
- }
- }
-
- public static OseeGroup getAtsAdminGroup() {
- if (atsAdminGroup == null) {
- atsAdminGroup = new OseeGroup("AtsAdmin");
- }
- return atsAdminGroup;
- }
-
- public static Branch getAtsBranch() throws OseeCoreException {
- return BranchManager.getCommonBranch();
- }
-
- public static boolean isEmailEnabled() {
- return emailEnabled;
- }
-
- public static void setEmailEnabled(boolean enabled) {
- if (!DbUtil.isDbInit()) {
- System.out.println("Email " + (enabled ? "Enabled" : "Disabled"));
- }
- emailEnabled = enabled;
- }
-
- public static Composite createCommonPageComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- composite.setLayout(layout);
-
- return composite;
- }
-
- /**
- * The development of ATS requires quite a few Actions to be created. To facilitate this, this method will retrieve a
- * persistent number from the file-system so each action has a different name. By entering "tt" in the title, new
- * action wizard will be pre-populated with selections and the action name will be created as "tt <number in
- * atsNumFilename>".
- *
- * @return number
- * @throws IOException
- */
- public static int getAtsDeveloperIncrementingNum() {
- try {
- return IncrementingNum.get();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- return 99;
- }
-
- public static ToolBar createCommonToolBar(Composite parent) {
- return createCommonToolBar(parent, null);
- }
-
- public static ToolBar createCommonToolBar(Composite parent, XFormToolkit toolkit) {
- ToolBar toolBar = ALayout.createCommonToolBar(parent);
- if (toolkit != null) {
- toolkit.adapt(toolBar.getParent());
- }
- if (toolkit != null) {
- toolkit.adapt(toolBar);
- }
- return toolBar;
- }
-
- public static String doubleToI18nString(double d) {
- return doubleToI18nString(d, false);
- }
-
- public static String doubleToI18nString(double d, boolean blankIfZero) {
- if (blankIfZero && d == 0) {
- return "";
- }
- // This enables java to use same string for all 0 cases instead of creating new one
- else if (d == 0) {
- return "0.00";
- } else {
- return String.format("%4.2f", d);
- }
- }
-
- public static void editActionableItems(ActionArtifact actionArt) throws OseeCoreException {
- Result result = actionArt.editActionableItems();
- if (result.isFalse() && result.getText().equals("")) {
- return;
- }
- if (result.isFalse()) {
- result.popup();
- }
- }
-
- public static void editActionableItems(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
- Result result = teamArt.editActionableItems();
- if (result.isFalse() && result.getText().equals("")) {
- return;
- }
- if (result.isFalse() && !result.getText().equals("")) {
- result.popup();
- }
- }
-
- public static void openArtifact(String guidOrHrid, Integer branchId, OseeEditor view) {
- try {
- Branch branch = BranchManager.getBranch(branchId);
- Artifact artifact = ArtifactQuery.getArtifactFromId(guidOrHrid, branch);
- openATSAction(artifact, AtsOpenOption.OpenOneOrPopupSelect);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- /**
- * Only to be used by browser. Use open (artifact) instead.
- *
- * @param guid
- * @throws OseeCoreException
- */
- public static void openArtifact(String guid, OseeEditor view) {
- AtsBulkLoad.loadConfig(false);
- Artifact artifact = null;
- try {
- artifact = ArtifactQuery.getArtifactFromId(guid, getAtsBranch());
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
-
- try {
- if (view == OseeEditor.ActionEditor) {
- if (artifact instanceof StateMachineArtifact || artifact instanceof ActionArtifact) {
- openATSAction(artifact, AtsOpenOption.OpenOneOrPopupSelect);
- } else {
- RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
- }
- } else if (view == OseeEditor.ArtifactEditor) {
- RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
- } else if (view == OseeEditor.ArtifactHyperViewer) {
- AWorkbench.popup("ERROR", "Unimplemented");
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public static void createATSAction(String initialDescription, String actionableItemName) {
- // Ensure actionable item is configured for ATS before continuing
- try {
- AtsCacheManager.getSoleArtifactByName(ArtifactTypeManager.getType(AtsArtifactTypes.ActionableItem),
- actionableItemName);
- } catch (ArtifactDoesNotExist ex) {
- AWorkbench.popup(
- "Configuration Error",
- "Actionable Item \"" + actionableItemName + "\" is not configured for ATS tracking.\n\nAction can not be created.");
- return;
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return;
- }
-
- NewAction newAction = new NewAction(actionableItemName);
- newAction.setInitialDescription(initialDescription);
- newAction.run();
- }
-
- public static void openATSArtifact(Artifact art) {
- if (art instanceof IATSArtifact) {
- try {
- openATSAction(art, AtsOpenOption.OpenOneOrPopupSelect);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- AWorkbench.popup("ERROR", ex.getLocalizedMessage());
- }
- } else {
- AWorkbench.popup("ERROR", "Trying to open " + art.getArtifactTypeName() + " with SMAEditor");
- }
- }
-
- public static void openATSAction(final Artifact art, final AtsOpenOption atsOpenOption) {
- try {
- if (art instanceof ActionArtifact) {
- final ActionArtifact actionArt = (ActionArtifact) art;
- Collection<TeamWorkFlowArtifact> teams = actionArt.getTeamWorkFlowArtifacts();
- if (atsOpenOption == AtsOpenOption.OpenAll) {
- for (TeamWorkFlowArtifact team : teams) {
- SMAEditor.editArtifact(team);
- }
- } else if (atsOpenOption == AtsOpenOption.AtsWorld) {
- WorldEditor.open(new WorldEditorSimpleProvider("Action " + actionArt.getHumanReadableId(),
- Arrays.asList(actionArt)));
- } else if (atsOpenOption == AtsOpenOption.OpenOneOrPopupSelect) {
- if (teams.size() == 1) {
- SMAEditor.editArtifact(teams.iterator().next());
- } else {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- TeamWorkFlowArtifact teamArt = promptSelectTeamWorkflow(actionArt);
- if (teamArt != null) {
- SMAEditor.editArtifact((Artifact) teamArt);
- } else {
- return;
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- }
- }
- } else {
- SMAEditor.editArtifact(art);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public static TeamWorkFlowArtifact promptSelectTeamWorkflow(ActionArtifact actArt) throws OseeCoreException {
- ListDialog ld = new ListDialog(Displays.getActiveShell());
- ld.setContentProvider(new ArrayContentProvider());
- ld.setLabelProvider(new TeamWorkflowLabelProvider());
- ld.setTitle("Select Team Workflow");
- ld.setMessage("Select Team Workflow");
- ld.setInput(actArt.getTeamWorkFlowArtifacts());
- if (ld.open() == 0) {
- if (ld.getResult().length == 0) {
- AWorkbench.popup("Error", "No Workflow Selected");
- } else {
- return (TeamWorkFlowArtifact) ld.getResult()[0];
- }
- }
- return null;
- }
-
- public static void openInAtsWorldEditor(String name, Collection<Artifact> artifacts) throws OseeCoreException {
- Set<Artifact> otherArts = new HashSet<Artifact>();
- for (Artifact art : artifacts) {
- if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
- WorldEditor.open(new WorldEditorUISearchItemProvider(new GroupWorldSearchItem(art), null,
- TableLoadOption.None));
- } else {
- otherArts.add(art);
- }
- }
- if (otherArts.size() > 0) {
- WorldEditor.open(new WorldEditorSimpleProvider(name, otherArts));
- }
- }
-
- public static void openInAtsTaskEditor(String name, Collection<Artifact> artifacts) throws OseeCoreException {
- TaskEditor.open(new TaskEditorSimpleProvider(name, artifacts));
- }
-
- public static ToolItem actionToToolItem(ToolBar toolBar, Action action, KeyedImage imageEnum) {
- final Action fAction = action;
- ToolItem item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(imageEnum));
- item.setToolTipText(action.getToolTipText());
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- fAction.run();
- }
- });
- return item;
- }
-
- public static MenuItem actionToMenuItem(Menu menu, final Action action, final int buttonType) {
- final Action fAction = action;
- MenuItem item = new MenuItem(menu, buttonType);
- item.setText(action.getText());
- if (action.getImageDescriptor() != null) {
- item.setImage(action.getImageDescriptor().createImage());
- }
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (buttonType == SWT.CHECK) {
- action.setChecked(!action.isChecked());
- }
- fAction.run();
- }
- });
- return item;
- }
-
- /**
- * TODO Remove duplicate Active flags, need to convert all ats.Active to Active in DB
- *
- * @param <A>
- * @param artifacts to iterate through
- * @param active state to validate against; Both will return all artifacts matching type
- * @param clazz type of artifacts to consider; null for all
- * @return set of Artifacts of type clazz that match the given active state of the "Active" or "ats.Active" attribute
- * value. If no attribute exists, Active == true; If does exist then attribute value "yes" == true, "no" ==
- * false.
- */
- @SuppressWarnings("unchecked")
- public static <A extends Artifact> List<A> getActive(Collection<A> artifacts, Active active, Class<? extends Artifact> clazz) throws OseeCoreException {
- List<A> results = new ArrayList<A>();
- Collection<? extends Artifact> artsOfClass =
- clazz != null ? Collections.castMatching(clazz, artifacts) : artifacts;
- for (Artifact art : artsOfClass) {
- if (active == Active.Both) {
- results.add((A) art);
- } else {
- // assume active unless otherwise specified
- boolean attributeActive = ((A) art).getSoleAttributeValue(AtsAttributeTypes.Active, false);
- if (active == Active.Active && attributeActive) {
- results.add((A) art);
- } else if (active == Active.InActive && !attributeActive) {
- results.add((A) art);
- }
- }
- }
- return results;
- }
-
- public static List<IEventFilter> getAtsObjectEventFilters() {
- try {
- if (atsObjectEventFilter == null) {
- atsObjectEventFilter = new ArrayList<IEventFilter>(2);
- atsObjectEventFilter.add(OseeEventManager.getCommonBranchFilter());
- atsObjectEventFilter.add(getAtsObjectArtifactTypeEventFilter());
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- return atsObjectEventFilter;
- }
-
- public static ArtifactTypeEventFilter getAtsObjectArtifactTypeEventFilter() {
- if (atsObjectArtifactTypesFilter == null) {
- atsObjectArtifactTypesFilter =
- new ArtifactTypeEventFilter(AtsArtifactTypes.TeamWorkflow, AtsArtifactTypes.Action,
- AtsArtifactTypes.Task, AtsArtifactTypes.Goal, AtsArtifactTypes.PeerToPeerReview,
- AtsArtifactTypes.DecisionReview);
- }
- return atsObjectArtifactTypesFilter;
- }
-
- public static ArtifactTypeEventFilter getTeamWorkflowArtifactTypeEventFilter() {
- if (teamWorkflowArtifactTypesFilter == null) {
- teamWorkflowArtifactTypesFilter = new ArtifactTypeEventFilter(AtsArtifactTypes.TeamWorkflow);
- }
- return teamWorkflowArtifactTypesFilter;
- }
-
- public static ArtifactTypeEventFilter getReviewArtifactTypeEventFilter() {
- if (reviewArtifactTypesFilter == null) {
- reviewArtifactTypesFilter =
- new ArtifactTypeEventFilter(AtsArtifactTypes.PeerToPeerReview, AtsArtifactTypes.DecisionReview);
- }
- return reviewArtifactTypesFilter;
- }
-
- public static ArtifactTypeEventFilter getWorkItemArtifactTypeEventFilter() {
- if (workItemArtifactTypesFilter == null) {
- workItemArtifactTypesFilter = new ArtifactTypeEventFilter(CoreArtifactTypes.WorkItemDefinition);
- }
- return workItemArtifactTypesFilter;
- }
-
- public static Set<Artifact> getAssigned(User user) throws OseeCoreException {
- return StateManager.getAssigned(user);
- }
-
- /**
- * return currently assigned state machine artifacts that match clazz
- *
- * @param clazz to match or all if null
- */
- public static Set<Artifact> getAssigned(User user, Class<?> clazz) throws OseeCoreException {
- return StateManager.getAssigned(user, clazz);
- }
-
- /**
- * return currently assigned state machine artifacts that match clazz
- *
- * @param clazz to match or all if null
- */
- public static Set<Artifact> getAssigned(String userId, Class<?> clazz) throws OseeCoreException {
- return StateManager.getAssigned(userId, clazz);
- }
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.osee.ats.AtsOpenOption;
+import org.eclipse.osee.ats.actions.NewAction;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.AtsAttributeTypes;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkflowLabelProvider;
+import org.eclipse.osee.ats.config.AtsBulkLoad;
+import org.eclipse.osee.ats.config.AtsCacheManager;
+import org.eclipse.osee.ats.editor.SMAEditor;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.task.TaskEditor;
+import org.eclipse.osee.ats.task.TaskEditorSimpleProvider;
+import org.eclipse.osee.ats.world.WorldEditor;
+import org.eclipse.osee.ats.world.WorldEditorSimpleProvider;
+import org.eclipse.osee.ats.world.WorldEditorUISearchItemProvider;
+import org.eclipse.osee.ats.world.search.GroupWorldSearchItem;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.core.enums.Active;
+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.Branch;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.OseeGroup;
+import org.eclipse.osee.framework.skynet.core.User;
+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.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
+import org.eclipse.osee.framework.skynet.core.event2.filter.ArtifactTypeEventFilter;
+import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
+import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
+import org.eclipse.osee.framework.skynet.core.utility.IncrementingNum;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.XFormToolkit;
+import org.eclipse.osee.framework.ui.skynet.ats.OseeEditor;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.dialogs.ListDialog;
+
+/**
+ * @author Donald G. Dunne
+ */
+public final class AtsUtil {
+
+ private static boolean emailEnabled = true;
+ public static Color ACTIVE_COLOR = new Color(null, 206, 212, 239);
+ private static OseeGroup atsAdminGroup = null;
+ private static final Date today = new Date();
+ public static int MILLISECS_PER_DAY = 1000 * 60 * 60 * 24;
+ public final static String normalColor = "#FFFFFF";
+ public final static String activeColor = "#EEEEEE";
+ private static ArtifactTypeEventFilter atsObjectArtifactTypesFilter, reviewArtifactTypesFilter,
+ teamWorkflowArtifactTypesFilter, workItemArtifactTypesFilter;
+ private static List<IEventFilter> atsObjectEventFilter;
+
+ private AtsUtil() {
+ super();
+ }
+
+ public static boolean isInTest() {
+ return Boolean.valueOf(System.getProperty("osee.isInTest"));
+ }
+
+ public static long daysTillToday(Date date) throws OseeCoreException {
+ return (date.getTime() - today.getTime()) / MILLISECS_PER_DAY;
+ }
+
+ public static boolean isProductionDb() throws OseeCoreException {
+ return ClientSessionManager.isProductionDataStore();
+ }
+
+ public static boolean isAtsAdmin() {
+ try {
+ return getAtsAdminGroup().isCurrentUserMember();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return false;
+ }
+ }
+
+ public static OseeGroup getAtsAdminGroup() {
+ if (atsAdminGroup == null) {
+ atsAdminGroup = new OseeGroup("AtsAdmin");
+ }
+ return atsAdminGroup;
+ }
+
+ public static Branch getAtsBranch() throws OseeCoreException {
+ return BranchManager.getCommonBranch();
+ }
+
+ public static boolean isEmailEnabled() {
+ return emailEnabled;
+ }
+
+ public static void setEmailEnabled(boolean enabled) {
+ if (!DbUtil.isDbInit()) {
+ System.out.println("Email " + (enabled ? "Enabled" : "Disabled"));
+ }
+ emailEnabled = enabled;
+ }
+
+ public static Composite createCommonPageComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ composite.setLayout(layout);
+
+ return composite;
+ }
+
+ /**
+ * The development of ATS requires quite a few Actions to be created. To facilitate this, this method will retrieve a
+ * persistent number from the file-system so each action has a different name. By entering "tt" in the title, new
+ * action wizard will be pre-populated with selections and the action name will be created as "tt <number in
+ * atsNumFilename>".
+ *
+ * @return number
+ * @throws IOException
+ */
+ public static int getAtsDeveloperIncrementingNum() {
+ try {
+ return IncrementingNum.get();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ return 99;
+ }
+
+ public static ToolBar createCommonToolBar(Composite parent) {
+ return createCommonToolBar(parent, null);
+ }
+
+ public static ToolBar createCommonToolBar(Composite parent, XFormToolkit toolkit) {
+ ToolBar toolBar = ALayout.createCommonToolBar(parent);
+ if (toolkit != null) {
+ toolkit.adapt(toolBar.getParent());
+ }
+ if (toolkit != null) {
+ toolkit.adapt(toolBar);
+ }
+ return toolBar;
+ }
+
+ public static String doubleToI18nString(double d) {
+ return doubleToI18nString(d, false);
+ }
+
+ public static String doubleToI18nString(double d, boolean blankIfZero) {
+ if (blankIfZero && d == 0) {
+ return "";
+ }
+ // This enables java to use same string for all 0 cases instead of creating new one
+ else if (d == 0) {
+ return "0.00";
+ } else {
+ return String.format("%4.2f", d);
+ }
+ }
+
+ public static void editActionableItems(ActionArtifact actionArt) throws OseeCoreException {
+ Result result = actionArt.editActionableItems();
+ if (result.isFalse() && result.getText().equals("")) {
+ return;
+ }
+ if (result.isFalse()) {
+ result.popup();
+ }
+ }
+
+ public static void editActionableItems(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
+ Result result = teamArt.editActionableItems();
+ if (result.isFalse() && result.getText().equals("")) {
+ return;
+ }
+ if (result.isFalse() && !result.getText().equals("")) {
+ result.popup();
+ }
+ }
+
+ public static void openArtifact(String guidOrHrid, Integer branchId, OseeEditor view) {
+ try {
+ Branch branch = BranchManager.getBranch(branchId);
+ Artifact artifact = ArtifactQuery.getArtifactFromId(guidOrHrid, branch);
+ openATSAction(artifact, AtsOpenOption.OpenOneOrPopupSelect);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ /**
+ * Only to be used by browser. Use open (artifact) instead.
+ *
+ * @param guid
+ * @throws OseeCoreException
+ */
+ public static void openArtifact(String guid, OseeEditor view) {
+ AtsBulkLoad.loadConfig(false);
+ Artifact artifact = null;
+ try {
+ artifact = ArtifactQuery.getArtifactFromId(guid, getAtsBranch());
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+
+ try {
+ if (view == OseeEditor.ActionEditor) {
+ if (artifact instanceof StateMachineArtifact || artifact instanceof ActionArtifact) {
+ openATSAction(artifact, AtsOpenOption.OpenOneOrPopupSelect);
+ } else {
+ RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
+ }
+ } else if (view == OseeEditor.ArtifactEditor) {
+ RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
+ } else if (view == OseeEditor.ArtifactHyperViewer) {
+ AWorkbench.popup("ERROR", "Unimplemented");
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public static void createATSAction(String initialDescription, String actionableItemName) {
+ // Ensure actionable item is configured for ATS before continuing
+ try {
+ AtsCacheManager.getSoleArtifactByName(ArtifactTypeManager.getType(AtsArtifactTypes.ActionableItem),
+ actionableItemName);
+ } catch (ArtifactDoesNotExist ex) {
+ AWorkbench.popup(
+ "Configuration Error",
+ "Actionable Item \"" + actionableItemName + "\" is not configured for ATS tracking.\n\nAction can not be created.");
+ return;
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return;
+ }
+
+ NewAction newAction = new NewAction(actionableItemName);
+ newAction.setInitialDescription(initialDescription);
+ newAction.run();
+ }
+
+ public static void openATSArtifact(Artifact art) {
+ if (art instanceof IATSArtifact) {
+ try {
+ openATSAction(art, AtsOpenOption.OpenOneOrPopupSelect);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ AWorkbench.popup("ERROR", ex.getLocalizedMessage());
+ }
+ } else {
+ AWorkbench.popup("ERROR", "Trying to open " + art.getArtifactTypeName() + " with SMAEditor");
+ }
+ }
+
+ public static void openATSAction(final Artifact art, final AtsOpenOption atsOpenOption) {
+ try {
+ if (art instanceof ActionArtifact) {
+ final ActionArtifact actionArt = (ActionArtifact) art;
+ Collection<TeamWorkFlowArtifact> teams = actionArt.getTeamWorkFlowArtifacts();
+ if (atsOpenOption == AtsOpenOption.OpenAll) {
+ for (TeamWorkFlowArtifact team : teams) {
+ SMAEditor.editArtifact(team);
+ }
+ } else if (atsOpenOption == AtsOpenOption.AtsWorld) {
+ WorldEditor.open(new WorldEditorSimpleProvider("Action " + actionArt.getHumanReadableId(),
+ Arrays.asList(actionArt)));
+ } else if (atsOpenOption == AtsOpenOption.OpenOneOrPopupSelect) {
+ if (teams.size() == 1) {
+ SMAEditor.editArtifact(teams.iterator().next());
+ } else {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ TeamWorkFlowArtifact teamArt = promptSelectTeamWorkflow(actionArt);
+ if (teamArt != null) {
+ SMAEditor.editArtifact((Artifact) teamArt);
+ } else {
+ return;
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+ }
+ } else {
+ SMAEditor.editArtifact(art);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public static TeamWorkFlowArtifact promptSelectTeamWorkflow(ActionArtifact actArt) throws OseeCoreException {
+ ListDialog ld = new ListDialog(Displays.getActiveShell());
+ ld.setContentProvider(new ArrayContentProvider());
+ ld.setLabelProvider(new TeamWorkflowLabelProvider());
+ ld.setTitle("Select Team Workflow");
+ ld.setMessage("Select Team Workflow");
+ ld.setInput(actArt.getTeamWorkFlowArtifacts());
+ if (ld.open() == 0) {
+ if (ld.getResult().length == 0) {
+ AWorkbench.popup("Error", "No Workflow Selected");
+ } else {
+ return (TeamWorkFlowArtifact) ld.getResult()[0];
+ }
+ }
+ return null;
+ }
+
+ public static void openInAtsWorldEditor(String name, Collection<Artifact> artifacts) throws OseeCoreException {
+ Set<Artifact> otherArts = new HashSet<Artifact>();
+ for (Artifact art : artifacts) {
+ if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ WorldEditor.open(new WorldEditorUISearchItemProvider(new GroupWorldSearchItem(art), null,
+ TableLoadOption.None));
+ } else {
+ otherArts.add(art);
+ }
+ }
+ if (otherArts.size() > 0) {
+ WorldEditor.open(new WorldEditorSimpleProvider(name, otherArts));
+ }
+ }
+
+ public static void openInAtsTaskEditor(String name, Collection<Artifact> artifacts) throws OseeCoreException {
+ TaskEditor.open(new TaskEditorSimpleProvider(name, artifacts));
+ }
+
+ public static ToolItem actionToToolItem(ToolBar toolBar, Action action, KeyedImage imageEnum) {
+ final Action fAction = action;
+ ToolItem item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(imageEnum));
+ item.setToolTipText(action.getToolTipText());
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ fAction.run();
+ }
+ });
+ return item;
+ }
+
+ public static MenuItem actionToMenuItem(Menu menu, final Action action, final int buttonType) {
+ final Action fAction = action;
+ MenuItem item = new MenuItem(menu, buttonType);
+ item.setText(action.getText());
+ if (action.getImageDescriptor() != null) {
+ item.setImage(action.getImageDescriptor().createImage());
+ }
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (buttonType == SWT.CHECK) {
+ action.setChecked(!action.isChecked());
+ }
+ fAction.run();
+ }
+ });
+ return item;
+ }
+
+ /**
+ * TODO Remove duplicate Active flags, need to convert all ats.Active to Active in DB
+ *
+ * @param <A>
+ * @param artifacts to iterate through
+ * @param active state to validate against; Both will return all artifacts matching type
+ * @param clazz type of artifacts to consider; null for all
+ * @return set of Artifacts of type clazz that match the given active state of the "Active" or "ats.Active" attribute
+ * value. If no attribute exists, Active == true; If does exist then attribute value "yes" == true, "no" ==
+ * false.
+ */
+ @SuppressWarnings("unchecked")
+ public static <A extends Artifact> List<A> getActive(Collection<A> artifacts, Active active, Class<? extends Artifact> clazz) throws OseeCoreException {
+ List<A> results = new ArrayList<A>();
+ Collection<? extends Artifact> artsOfClass =
+ clazz != null ? Collections.castMatching(clazz, artifacts) : artifacts;
+ for (Artifact art : artsOfClass) {
+ if (active == Active.Both) {
+ results.add((A) art);
+ } else {
+ // assume active unless otherwise specified
+ boolean attributeActive = ((A) art).getSoleAttributeValue(AtsAttributeTypes.Active, false);
+ if (active == Active.Active && attributeActive) {
+ results.add((A) art);
+ } else if (active == Active.InActive && !attributeActive) {
+ results.add((A) art);
+ }
+ }
+ }
+ return results;
+ }
+
+ public static List<IEventFilter> getAtsObjectEventFilters() {
+ try {
+ if (atsObjectEventFilter == null) {
+ atsObjectEventFilter = new ArrayList<IEventFilter>(2);
+ atsObjectEventFilter.add(OseeEventManager.getCommonBranchFilter());
+ atsObjectEventFilter.add(getAtsObjectArtifactTypeEventFilter());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ return atsObjectEventFilter;
+ }
+
+ public static ArtifactTypeEventFilter getAtsObjectArtifactTypeEventFilter() {
+ if (atsObjectArtifactTypesFilter == null) {
+ atsObjectArtifactTypesFilter =
+ new ArtifactTypeEventFilter(AtsArtifactTypes.TeamWorkflow, AtsArtifactTypes.Action,
+ AtsArtifactTypes.Task, AtsArtifactTypes.Goal, AtsArtifactTypes.PeerToPeerReview,
+ AtsArtifactTypes.DecisionReview);
+ }
+ return atsObjectArtifactTypesFilter;
+ }
+
+ public static ArtifactTypeEventFilter getTeamWorkflowArtifactTypeEventFilter() {
+ if (teamWorkflowArtifactTypesFilter == null) {
+ teamWorkflowArtifactTypesFilter = new ArtifactTypeEventFilter(AtsArtifactTypes.TeamWorkflow);
+ }
+ return teamWorkflowArtifactTypesFilter;
+ }
+
+ public static ArtifactTypeEventFilter getReviewArtifactTypeEventFilter() {
+ if (reviewArtifactTypesFilter == null) {
+ reviewArtifactTypesFilter =
+ new ArtifactTypeEventFilter(AtsArtifactTypes.PeerToPeerReview, AtsArtifactTypes.DecisionReview);
+ }
+ return reviewArtifactTypesFilter;
+ }
+
+ public static ArtifactTypeEventFilter getWorkItemArtifactTypeEventFilter() {
+ if (workItemArtifactTypesFilter == null) {
+ workItemArtifactTypesFilter = new ArtifactTypeEventFilter(CoreArtifactTypes.WorkItemDefinition);
+ }
+ return workItemArtifactTypesFilter;
+ }
+
+ public static Set<Artifact> getAssigned(User user) throws OseeCoreException {
+ return StateManager.getAssigned(user);
+ }
+
+ /**
+ * return currently assigned state machine artifacts that match clazz
+ *
+ * @param clazz to match or all if null
+ */
+ public static Set<Artifact> getAssigned(User user, Class<?> clazz) throws OseeCoreException {
+ return StateManager.getAssigned(user, clazz);
+ }
+
+ /**
+ * return currently assigned state machine artifacts that match clazz
+ *
+ * @param clazz to match or all if null
+ */
+ public static Set<Artifact> getAssigned(String userId, Class<?> clazz) throws OseeCoreException {
+ return StateManager.getAssigned(userId, clazz);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/DoesNotWorkItemAts.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/DoesNotWorkItemAts.java
index 3d2764f2518..987a2e95e3b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/DoesNotWorkItemAts.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/DoesNotWorkItemAts.java
@@ -1,668 +1,668 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.ATSNote;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.AtsAttributeTypes;
-import org.eclipse.osee.ats.artifact.NoteItem;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.config.AtsBulkLoad;
-import org.eclipse.osee.ats.health.ValidateAtsDatabase;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.core.enums.BranchArchivedState;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AFile;
-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.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.util.ElapsedTime;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Donald G. Dunne
- */
-public class DoesNotWorkItemAts extends XNavigateItemAction {
-
- public DoesNotWorkItemAts(XNavigateItem parent) {
- super(parent, "Does Not Work - ATS - fixAtsNotesAndDefectItemsUserIds", PluginUiImage.ADMIN);
- }
-
- @Override
- public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException {
- if (!MessageDialog.openConfirm(Displays.getActiveShell(), getName(), getName())) {
- return;
- }
- convertAtsStateNotesAndDefectItemsUserIds();
- // fixNotesStateNames();
- // renameTransactionComments();
- // SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Admin Cleanup");
- // Artifact verArt =
- // ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.Version, "0.9.0", AtsUtil.getAtsBranch());
- // for (Attribute<?> attr : verArt.getAttributes()) {
- // if (attr.getAttributeType().getName().equals(ATSAttributes.NEXT_VERSION_ATTRIBUTE.getStoreName())) {
- // System.out.println("next " + attr.getValue());
- // attr.delete();
- // break;
- // }
- // }
- // verArt.persist(transaction);
- // verArt = ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.Version, "0.8.2", AtsUtil.getAtsBranch());
- // for (Attribute<?> attr : verArt.getAttributes()) {
- // if (attr.getAttributeType().getName().equals(ATSAttributes.RELEASED_ATTRIBUTE.getStoreName())) {
- // System.out.println("released " + attr.getValue());
- // attr.delete();
- // break;
- // }
- // }
- // verArt.persist(transaction);
- // transaction.execute();
-
- // deleteDuplicateCommonBranchDuplicateRelations();
- // convertAtsLogUserIds(transaction);
- // deleteUnAssignedUserRelations();
- // relateDonDunne();
-
- // testDeleteAttribute();
- // deleteNullUserAttributes();
- // XNavigateItem item = AtsNavigateViewItems.getInstance().getSearchNavigateItems().get(1);
- // System.out.println("Item " + item.getName());
- // NavigateView.getNavigateView().handleDoubleClick(item);
-
- // XResultData.runExample();
-
- // fixOseePeerReviews();
-
- AWorkbench.popup("Completed", "Complete");
- }
-
- @SuppressWarnings("unused")
- private void myWorldTimeTest() throws OseeCoreException {
- AtsBulkLoad.loadConfig(true);
- // ElapsedTime time = new ElapsedTime("My World via Relations");
- // Set<Artifact> assigned =
- // RelationManager.getRelatedArtifacts(Arrays.asList(UserManager.getUser()), 1,
- // CoreRelationTypes.Users_Artifact);
- // System.out.println("Returned " + assigned.size() + " objects");
- // time.end();
-
- ElapsedTime time = new ElapsedTime("My World via Attribute Search");
- List<Artifact> assignedList =
- ArtifactQuery.getArtifactListFromAttribute(ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName(),
- "%727536%", AtsUtil.getAtsBranch());
- System.out.println("Returned " + assignedList.size() + " objects");
- time.end();
-
- }
-
- @SuppressWarnings("unused")
- private void fixNotesStateNames() throws OseeCoreException {
- Map<String, Integer> valueToGammaId = new HashMap<String, Integer>();
- String SELECT_QUERY = "select * from osee_attribute where value like '%quot; State%'";
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(SELECT_QUERY);
- while (chStmt.next()) {
- int gammaId = chStmt.getInt("gamma_id");
- String value = chStmt.getString("value");
- valueToGammaId.put(value, gammaId);
- }
- } finally {
- chStmt.close();
- }
-
- for (Entry<String, Integer> entry : valueToGammaId.entrySet()) {
- String value = entry.getKey();
- int gammaId = entry.getValue();
- System.out.println("Old GammaId " + gammaId + " Value = " + value);
- List<NoteItem> items = ATSNote.getNoteItems(value, "GammaId:" + gammaId);
- for (NoteItem item : items) {
- System.out.println(String.format("Pre State [%s]", item.getState()));
- }
-
- // Make changes
- value = value.replaceAll("\\&quot; State", "");
- value = value.replaceAll("state=\"\\&quot;", "state=\"");
- System.out.println("New GammaId " + gammaId + " Value = " + value);
- items = ATSNote.getNoteItems(value, "GammaId:" + gammaId);
- for (NoteItem item : items) {
- System.out.println(String.format("Post State [%s]", item.getState()));
- }
- // ConnectionHandler.runPreparedUpdate(UPDATE_QUERY, value, gammaId);
- }
- }
-
- private void convertAtsStateNotesAndDefectItemsUserIds() throws OseeCoreException {
- String SELECT_QUERY = "select * from osee_attribute where value like ? and attr_type_id in (84,92,72,73)";
- Map<String, String> oldIdToNewId = new HashMap<String, String>();
- oldIdToNewId.put("<va053c>", "<1588621>");
- oldIdToNewId.put("<fw314c>", "<1631765>");
-
- for (Entry<String, String> entry : oldIdToNewId.entrySet()) {
-
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(SELECT_QUERY, "%" + entry.getKey() + "%");
- while (chStmt.next()) {
- int gammaId = chStmt.getInt("gamma_id");
- String value = chStmt.getString("value");
- System.out.println("Old " + gammaId + " Value = " + value);
- value = value.replaceAll(entry.getKey(), entry.getValue());
- System.out.println("New " + gammaId + " Value = " + value);
- // ConnectionHandler.runPreparedUpdate(UPDATE_QUERY, value, gammaId);
- }
- } finally {
- chStmt.close();
- }
-
- }
- }
-
- @SuppressWarnings("unused")
- private void renameTransactionComments() throws OseeCoreException {
- List<String> notRenamed = new ArrayList<String>();
- Map<String, Integer> commentToTransId = new HashMap<String, Integer>();
- String SEARCH_TRANSACTION_COMMENTS =
- "select transaction_id, osee_comment from osee_tx_details where osee_comment like '%Commit%'";
-
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(SEARCH_TRANSACTION_COMMENTS);
- while (chStmt.next()) {
- int transId = chStmt.getInt("transaction_id");
- String comment = chStmt.getString("osee_comment");
- commentToTransId.put(comment, transId);
- }
- } finally {
- chStmt.close();
- }
-
- for (Entry<String, Integer> entry : commentToTransId.entrySet()) {
- String comment = entry.getKey();
- Pattern traxPattern = Pattern.compile("^(.*? - TRAX RPCR .*)( - TRAX RPCR .*)$");
- Pattern shortPattern = Pattern.compile("^(.*? -) +(.*?) - +(.*?)$");
- System.out.println("TransId " + entry.getValue() + " Comment = " + comment);
-
- boolean renamed = false;
- Matcher m = traxPattern.matcher(comment);
- if (m.find()) {
- String first = m.group(1);
- m.group(2);
- String newComment = first;
- if (!comment.equals(newComment)) {
- renamed = true;
- System.out.println("TransId " + entry.getValue() + " Rename1 = " + newComment);
- // TransactionManager.setTransactionComment(TransactionManager.getTransactionId(entry.getValue()),
- // newComment);
- }
- }
- if (!renamed) {
- m = shortPattern.matcher(comment);
- if (m.find()) {
- String prefix = m.group(1);
- String first = m.group(2);
- String second = m.group(3);
- second = second.replaceFirst("...$", "");
- String newComment = prefix + " " + first;
- if (first.equals(second) || first.startsWith(second)) {
- renamed = true;
- System.out.println("TransId " + entry.getValue() + " Rename2 = " + newComment);
- // TransactionManager.setTransactionComment(TransactionManager.getTransactionId(entry.getValue()),
- // newComment);
- }
- }
- }
- if (!renamed) {
- notRenamed.add(comment);
- }
-
- }
- for (String branchName : notRenamed) {
- System.out.println("Not Renamed " + branchName);
- }
-
- }
-
- @SuppressWarnings("unused")
- private void renameBranches() throws OseeCoreException {
- List<String> notRenamed = new ArrayList<String>();
- Pattern traxPattern = Pattern.compile("^(..... - TRAX RPCR .*)( - TRAX RPCR .*)$");
- Pattern shortPattern = Pattern.compile("^(..... -) +(.*?) - +(.*?)$");
- Collection<Branch> branches = BranchManager.getBranches(BranchArchivedState.ALL, BranchType.WORKING);
- int x = 0;
- for (Branch branch : branches) {
- System.out.println(String.format("\n%d/%d - Branch = [%s]", x++, branches.size(), branch));
- String branchName = branch.getName();
- boolean renamed = false;
- Matcher m = traxPattern.matcher(branch.getName());
- if (m.find()) {
- String first = m.group(1);
- m.group(2);
- String newBranchName = first;
- if (!branchName.equals(newBranchName)) {
- renamed = true;
- System.out.println("Rename = " + newBranchName);
- branch.setName(newBranchName);
- BranchManager.persist(branch);
- }
- }
- if (branchName.contains("BGJ6A")) {
- System.out.println("here");
- }
- if (!renamed) {
- m = shortPattern.matcher(branch.getName());
- if (m.find()) {
- String prefix = m.group(1);
- String first = m.group(2);
- String second = m.group(3);
- second = second.replaceFirst("...$", "");
- String newBranchName = prefix + " " + first;
- if (first.equals(second) || first.startsWith(second)) {
- renamed = true;
- System.out.println("Rename = " + newBranchName);
- branch.setName(newBranchName);
- BranchManager.persist(branch);
- }
- }
- }
- if (!renamed) {
- notRenamed.add(branchName);
- }
-
- }
- for (String branchName : notRenamed) {
- System.out.println("Not Renamed " + branchName);
- }
-
- }
-
- @SuppressWarnings("unused")
- private void deleteDuplicateCommonBranchDuplicateRelations() throws OseeCoreException {
- XResultData rd = new XResultData();
- rd.log(getName());
- int listsCount = 0;
- int artifactsCount = 0;
- boolean fix = true;
- SkynetTransaction transaction =
- new SkynetTransaction(AtsUtil.getAtsBranch(), "Delete duplicate common branch relations");
-
- // Break artifacts into blocks so don't run out of memory
- List<Collection<Integer>> artIdLists = ValidateAtsDatabase.loadAtsBranchArtifactIds(rd, null);
- for (Collection<Integer> artIdList : artIdLists) {
- System.out.println(String.format("Processing artifacts from list %d/%d", listsCount++, artIdLists.size()));
- Collection<Artifact> artifacts = ArtifactQuery.getArtifactListFromIds(artIdList, AtsUtil.getAtsBranch());
- artifactsCount += artifacts.size();
-
- for (Artifact artifact : artifacts) {
- List<RelationLink> relLinks = artifact.getRelationsAll(false);
- for (RelationLink relLink : relLinks) {
- // Only handle relations where this artifact is SIDEA (so don't handle same relation twice)
- if (!relLink.getArtifactA().equals(artifact)) {
- continue;
- }
- // Find all duplicates
- List<RelationLink> duplicates = new ArrayList<RelationLink>();
- duplicates.add(relLink);
- for (RelationLink otherRelLink : relLinks) {
- if (relLink == otherRelLink) {
- continue;
- }
- if (relLink.equalsConceptually(otherRelLink)) {
- duplicates.add(otherRelLink);
- }
- }
- // If more than one, there are duplicates
- if (duplicates.size() > 1) {
- handleDuplicates(rd, artifact, duplicates, fix, transaction);
- }
- }
- }
- }
- transaction.execute();
- rd.report(getName());
- }
-
- /**
- * For set of duplicate relations, keep first one and delete rest
- */
- private void handleDuplicates(XResultData rd, Artifact artifact, List<RelationLink> relLinks, boolean fix, SkynetTransaction transaction) throws OseeCoreException {
- Integer firstId = null;
- String firstName = null;
- String str = relLinks.size() + " duplicate relations found for [" + artifact.getHumanReadableId() + "] ";
- for (RelationLink relLink : relLinks) {
- if (firstId == null) {
- firstId = relLink.getId();
- firstName = relLink.getArtifactB().getName();
- } else if (relLink.getId() != firstId && relLink.getArtifactB().getName().equals(firstName)) {
- str += " Deleteable";
- if (fix) {
- relLink.delete(false);
- artifact.persist(transaction);
- }
- }
- str += "[" + relLink.getArtifactB().getName() + "(" + relLink.getId() + ")]";
- }
- System.out.println(str);
- if (fix) {
- rd.log("fixed");
- }
- rd.log(str);
- }
-
- @SuppressWarnings("unused")
- private void purgeHrids() throws OseeCoreException {
- String[] hrids = AFile.readFile("O:\\hrids_to_delete.txt").split("\r\n");
- int x = 0;
- for (String hrid : hrids) {
- hrid = hrid.replaceAll(" ", "");
- System.out.println("Processing " + x++ + " of " + hrids.length);
- try {
- Artifact art = null;
- // Handle case where duplicate hrids
- try {
- art = ArtifactQuery.getArtifactFromId(hrid, AtsUtil.getAtsBranch());
- } catch (MultipleArtifactsExist ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- continue;
- }
- Set<Artifact> artsToDelete = new HashSet<Artifact>();
- if (art instanceof TeamWorkFlowArtifact) {
- art = ((TeamWorkFlowArtifact) art).getParentActionArtifact();
- }
- if (art instanceof ActionArtifact) {
- artsToDelete.add(art);
- artsToDelete.addAll(((ActionArtifact) art).getTeamWorkFlowArtifacts());
- }
- if (artsToDelete.size() > 0) {
- System.out.println("Sleeping 5 sec...");
- Thread.sleep(5000);
- System.out.println("Purging " + artsToDelete.size() + " artifacts...");
- new PurgeArtifacts(artsToDelete).execute();
- }
- } catch (ArtifactDoesNotExist ex) {
- System.out.println("Artifact with hrid does not exist: " + hrid);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- }
-
- }
-
- @SuppressWarnings("unused")
- private void convertAtsLogUserIds(SkynetTransaction transaction) throws OseeCoreException {
- List<String> hrids =
- Arrays.asList("NKYBF", "J1Z48", "ZY4W5", "U9H58", "9713S", "83XVW", "59B9X", "TQD1J", "UVM7U", "HZT73",
- "C49Q5", "RHCPY", "MBCXV", "YJFKC", "2F461", "AGW15", "K6ZGD", "9W45V", "GG43L", "G2VTQ", "CVWFC",
- "EXMT0", "W1TS8", "JM3RD", "7Q0W3", "P9DKR", "BR2RN", "Z6B0Z", "6KT6U", "HPQJX", "QN2K3", "W0VTD",
- "LDJMH", "6PWYH", "T8B4K", "YTNLC", "9557A", "SQQ6T", "D82X9", "2P5GC", "YK58N", "LWVT1", "KCGSQ",
- "5X2WL", "C8HWW");
- for (Artifact art : ArtifactQuery.getArtifactListFromIds(hrids, AtsUtil.getAtsBranch())) {
- String str = art.getSoleAttributeValue(ATSAttributes.LOG_ATTRIBUTE.getStoreName(), null);
- str = str.replaceAll("rj236c", "1779483");
- art.setSoleAttributeFromString(ATSAttributes.LOG_ATTRIBUTE.getStoreName(), str);
- art.persist(transaction);
- }
- }
-
- @SuppressWarnings("unused")
- private void fixTestTaskResolutions() throws OseeCoreException {
- System.out.println("Started fixTestTaskResolutions...");
- for (Artifact artifact : ArtifactQuery.getArtifactListFromAttributeType(AtsAttributeTypes.Resolution,
- AtsUtil.getAtsBranch())) {
- if (artifact instanceof TaskArtifact) {
- TaskArtifact taskArt = (TaskArtifact) artifact;
- String resolution =
- ((TaskArtifact) artifact).getSoleAttributeValue(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName(),
- null);
- if (resolution == null) {
- System.err.println("Unexpected null resolution." + taskArt.getHumanReadableId());
- // taskArt.deleteSoleAttribute(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
- // taskArt.persistAttributes();
- } else {
- String newResolution = null;
- if (resolution.equals("Need_DTE_Test")) {
- System.out.println("Rename Need_DTE_Test to In_DTE_Test " + taskArt.getHumanReadableId());
- newResolution = "In_DTE_Test";
- } else if (resolution.equals("Awaiting_Code_Fix")) {
- System.out.println("Rename Awaiting_Code_Fix to Awaiting_Code " + taskArt.getHumanReadableId());
- newResolution = "Awaiting_Code";
- } else if (resolution.equals("Awaiting_Review")) {
- System.out.println("Rename Awaiting_Review to In_DTE_Test " + taskArt.getHumanReadableId());
- newResolution = "In_DTE_Test";
- } else if (resolution.equals("Unit_Tested")) {
- System.out.println("Rename Unit_Tested to In_DTE_Test " + taskArt.getHumanReadableId());
- newResolution = "In_DTE_Test";
- }
- if (newResolution != null) {
- taskArt.setSoleAttributeFromString(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName(), newResolution);
- taskArt.persist();
- }
- }
- }
- }
- System.out.println("Completed fixTestTaskResolutions...");
- }
-
- // private void deleteUnAssignedUserRelations() throws OseeCoreException {
- // AbstractSkynetTxTemplate newActionTx = new AbstractSkynetTxTemplate(AtsUtil.getAtsBranch()) {
- //
- // @Override
- // protected void handleTxWork() throws OseeCoreException {
- // User unassignedUser = SkynetAuthentication.getUser(UserEnum.UnAssigned);
- // for (Artifact art : unassignedUser.getRelatedArtifacts(CoreRelationEnumeration.Users_Artifact)) {
- // if (art instanceof StateMachineArtifact) {
- // unassignedUser.deleteRelation(CoreRelationEnumeration.Users_Artifact, art);
- // }
- // }
- // unassignedUser.persistRelations();
- // }
- // };
- // newActionTx.execute();
- // }
-
- // private static final boolean fixIt = false;
-
- // public void cleanXViewerCustomizations() throws OseeCoreException {
- // for (User user : SkynetAuthentication.getUsers()) {
- // System.out.println("User: " + user);
- //
- // SkynetUserArtifactCustomizeDefaults custDefaults = new SkynetUserArtifactCustomizeDefaults(user);
- //
- // // Get all customizations
- // List<String> customizations = user.getAttributesToStringList("XViewer Customization");
- // if (customizations.isEmpty() && custDefaults.isEmpty()) continue;
- // Set<String> validGuids = new HashSet<String>();
- // int currNumDefaults = custDefaults.getGuids().size();
- // for (String custStr : new CopyOnWriteArrayList<String>(customizations)) {
- // CustomizeData custData = new CustomizeData(custStr);
- // validGuids.add(custData.getGuid());
- //
- // // check for old customizations to remove
- // boolean orderFound = custStr.contains("<order>");
- // boolean namespaceNullFound = custStr.contains("namespace=\"null\"");
- // if (orderFound || namespaceNullFound) {
- // System.err.println("Removing " + (orderFound ? "<order>" : "namespace==null") + " customizations " + custData.getGuid());
- // validGuids.remove(custData.getGuid());
- // custDefaults.removeDefaultCustomization(custData);
- // customizations.remove(custStr);
- // } else {
- // // Check for sort columns that are hidden
- // for (String columnName : custData.getSortingData().getSortingNames()) {
- // XViewerColumn xCol = custData.getColumnData().getXColumn(columnName);
- // if (xCol == null) {
- // System.err.println("sort column not found \"" + columnName + "\" - " + custData.getGuid());
- // } else if (xCol.isShow() == false) {
- // System.err.println("sort col is hidden \"" + columnName + "\" - " + custData.getGuid());
- // }
- // }
- // }
- // }
- // if (validGuids.size() != custDefaults.getGuids().size()) {
- // System.err.println("Update default customizations : " + user + " - " + currNumDefaults + " valid: " + validGuids.size());
- // custDefaults.setGuids(validGuids);
- // }
- // if (fixIt) {
- // custDefaults.save();
- // user.setAttributeValues("XViewer Customization", customizations);
- // user.persistAttributes();
- // }
- // }
- // }
-
- public Result isCustomizationSortErrored(String custDataStr, CustomizeData custData) {
-
- return Result.TrueResult;
- }
-
- // String xViewerDefaults = user.getSoleAttributeValueAsString("XViewer Defaults", null);
- // // Get all current default guids
- // Set<String> currentDefaultGuids = new HashSet<String>();
- // if (xViewerDefaults != null) {
- // for (String guid : AXml.getTagDataArray(xViewerDefaults, XVIEWER_DEFAULTS_TAG)) {
- // if (guid != null && !guid.equals("")) {
- // currentDefaultGuids.add(guid);
- // }
- // }
- // }
- // private void relateDonDunne()throws OseeCoreException{
- // AbstractSkynetTxTemplate newActionTx = new AbstractSkynetTxTemplate(AtsUtil.getAtsBranch()) {
- //
- // @Override
- // protected void handleTxWork()throws OseeCoreException{
- // for (Artifact art : ArtifactQuery.getArtifactsFromAttribute(
- // ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName(),
- // "%<" + SkynetAuthentication.getUser().getUserId() + ">%", AtsUtil.getAtsBranch())) {
- // if ((art instanceof StateMachineArtifact) && ((StateMachineArtifact) art).getStateMgr().getAssignees().contains(
- // SkynetAuthentication.getUser())) {
- // art.addRelation(CoreRelationEnumeration.Users_User, SkynetAuthentication.getUser());
- // }
- // }
- // SkynetAuthentication.getUser().persistRelations();
- // }
- // };
- // newActionTx.execute();
- //
- // }
-
- // private void testDeleteAttribute() throws OseeCoreException {
- // Artifact art =
- // ArtifactQuery.getArtifactsFromIds(Arrays.asList("76589"), AtsUtil.getAtsBranch()).iterator().next();
- // for (Attribute<?> attr : art.getAttributes()) {
- // if (attr.getValue() == null) {
- // System.out.println(art.getHumanReadableId() + " - " + attr.getNameValueDescription());
- // attr.delete();
- // }
- // }
- // art.persistAttributes();
- // }
-
- // private void deleteNullAttributes() throws OseeCoreException {
- //
- // AbstractSkynetTxTemplate newActionTx = new AbstractSkynetTxTemplate(AtsUtil.getAtsBranch()) {
- //
- // @Override
- // protected void handleTxWork() throws OseeCoreException {
- // int x = 0;
- // for (String artTypeName : Arrays.asList(TeamWorkFlowArtifact.ARTIFACT_NAME, TaskArtifact.ARTIFACT_NAME,
- // DecisionReviewArtifact.ARTIFACT_NAME, PeerToPeerReviewArtifact.ARTIFACT_NAME,
- // "Lba V13 Code Team Workflow", "Lba V13 Test Team Workflow", "Lba V13 Req Team Workflow",
- // "Lba V13 SW Design Team Workflow", "Lba V13 Tech Approach Team Workflow",
- // "Lba V11 REU Code Team Workflow", "Lba V11 REU Test Team Workflow", "Lba V11 REU Req Team Workflow",
- // "Lba B3 Code Team Workflow", "Lba B3 Test Team Workflow", "Lba B3 Req Team Workflow",
- // "Lba B3 SW Design Team Workflow", "Lba B3 Tech Approach Team Workflow")) {
- // for (Artifact team : ArtifactQuery.getArtifactsFromType(artTypeName, AtsUtil.getAtsBranch())) {
- // for (Attribute<?> attr : team.getAttributes(false)) {
- // if (attr.getValue() == null) {
- // System.out.println(team.getHumanReadableId() + " - " + attr.getNameValueDescription());
- // attr.delete();
- // x++;
- // }
- // }
- // if (team.isDirty()) team.persistAttributes();
- // }
- // }
- // System.out.println("Deleted " + x);
- // }
- // };
- // newActionTx.execute();
- //
- // }
- //
- // private void deleteNullUserAttributes() throws OseeCoreException {
- //
- // AbstractSkynetTxTemplate newActionTx = new AbstractSkynetTxTemplate(AtsUtil.getAtsBranch()) {
- //
- // @Override
- // protected void handleTxWork() throws OseeCoreException {
- // int x = 0;
- // for (String artTypeName : Arrays.asList(User.ARTIFACT_NAME)) {
- // for (Artifact team : ArtifactQuery.getArtifactsFromType(artTypeName, AtsUtil.getAtsBranch())) {
- // for (Attribute<?> attr : team.getAttributes(false)) {
- // if (attr.getValue() == null) {
- // System.out.println(team.getHumanReadableId() + " - " + attr.getNameValueDescription());
- // attr.delete();
- // x++;
- // }
- // }
- // if (team.isDirty()) team.persistAttributes();
- // }
- // }
- // System.out.println("Deleted " + x);
- // }
- // };
- // newActionTx.execute();
- //
- // }
-
- // for (String artTypeName : Arrays.asList(TeamWorkFlowArtifact.ARTIFACT_NAME, TaskArtifact.ARTIFACT_NAME,
- // DecisionReviewArtifact.ARTIFACT_NAME, PeerToPeerReviewArtifact.ARTIFACT_NAME,
- // "Lba V13 Code Team Workflow", "Lba V13 Test Team Workflow", "Lba V13 Req Team Workflow",
- // "Lba V13 SW Design Team Workflow", "Lba V13 Tech Approach Team Workflow",
- // "Lba V11 REU Code Team Workflow", "Lba V11 REU Test Team Workflow", "Lba V11 REU Req Team Workflow",
- // "Lba B3 Code Team Workflow", "Lba B3 Test Team Workflow", "Lba B3 Req Team Workflow",
- // "Lba B3 SW Design Team Workflow", "Lba B3 Tech Approach Team Workflow")) {
-
-}
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ATSNote;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.AtsAttributeTypes;
+import org.eclipse.osee.ats.artifact.NoteItem;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.config.AtsBulkLoad;
+import org.eclipse.osee.ats.health.ValidateAtsDatabase;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
+import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AFile;
+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.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.util.ElapsedTime;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DoesNotWorkItemAts extends XNavigateItemAction {
+
+ public DoesNotWorkItemAts(XNavigateItem parent) {
+ super(parent, "Does Not Work - ATS - fixAtsNotesAndDefectItemsUserIds", PluginUiImage.ADMIN);
+ }
+
+ @Override
+ public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException {
+ if (!MessageDialog.openConfirm(Displays.getActiveShell(), getName(), getName())) {
+ return;
+ }
+ convertAtsStateNotesAndDefectItemsUserIds();
+ // fixNotesStateNames();
+ // renameTransactionComments();
+ // SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Admin Cleanup");
+ // Artifact verArt =
+ // ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.Version, "0.9.0", AtsUtil.getAtsBranch());
+ // for (Attribute<?> attr : verArt.getAttributes()) {
+ // if (attr.getAttributeType().getName().equals(ATSAttributes.NEXT_VERSION_ATTRIBUTE.getStoreName())) {
+ // System.out.println("next " + attr.getValue());
+ // attr.delete();
+ // break;
+ // }
+ // }
+ // verArt.persist(transaction);
+ // verArt = ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.Version, "0.8.2", AtsUtil.getAtsBranch());
+ // for (Attribute<?> attr : verArt.getAttributes()) {
+ // if (attr.getAttributeType().getName().equals(ATSAttributes.RELEASED_ATTRIBUTE.getStoreName())) {
+ // System.out.println("released " + attr.getValue());
+ // attr.delete();
+ // break;
+ // }
+ // }
+ // verArt.persist(transaction);
+ // transaction.execute();
+
+ // deleteDuplicateCommonBranchDuplicateRelations();
+ // convertAtsLogUserIds(transaction);
+ // deleteUnAssignedUserRelations();
+ // relateDonDunne();
+
+ // testDeleteAttribute();
+ // deleteNullUserAttributes();
+ // XNavigateItem item = AtsNavigateViewItems.getInstance().getSearchNavigateItems().get(1);
+ // System.out.println("Item " + item.getName());
+ // NavigateView.getNavigateView().handleDoubleClick(item);
+
+ // XResultData.runExample();
+
+ // fixOseePeerReviews();
+
+ AWorkbench.popup("Completed", "Complete");
+ }
+
+ @SuppressWarnings("unused")
+ private void myWorldTimeTest() throws OseeCoreException {
+ AtsBulkLoad.loadConfig(true);
+ // ElapsedTime time = new ElapsedTime("My World via Relations");
+ // Set<Artifact> assigned =
+ // RelationManager.getRelatedArtifacts(Arrays.asList(UserManager.getUser()), 1,
+ // CoreRelationTypes.Users_Artifact);
+ // System.out.println("Returned " + assigned.size() + " objects");
+ // time.end();
+
+ ElapsedTime time = new ElapsedTime("My World via Attribute Search");
+ List<Artifact> assignedList =
+ ArtifactQuery.getArtifactListFromAttribute(ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName(),
+ "%727536%", AtsUtil.getAtsBranch());
+ System.out.println("Returned " + assignedList.size() + " objects");
+ time.end();
+
+ }
+
+ @SuppressWarnings("unused")
+ private void fixNotesStateNames() throws OseeCoreException {
+ Map<String, Integer> valueToGammaId = new HashMap<String, Integer>();
+ String SELECT_QUERY = "select * from osee_attribute where value like '%quot; State%'";
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(SELECT_QUERY);
+ while (chStmt.next()) {
+ int gammaId = chStmt.getInt("gamma_id");
+ String value = chStmt.getString("value");
+ valueToGammaId.put(value, gammaId);
+ }
+ } finally {
+ chStmt.close();
+ }
+
+ for (Entry<String, Integer> entry : valueToGammaId.entrySet()) {
+ String value = entry.getKey();
+ int gammaId = entry.getValue();
+ System.out.println("Old GammaId " + gammaId + " Value = " + value);
+ List<NoteItem> items = ATSNote.getNoteItems(value, "GammaId:" + gammaId);
+ for (NoteItem item : items) {
+ System.out.println(String.format("Pre State [%s]", item.getState()));
+ }
+
+ // Make changes
+ value = value.replaceAll("\\&quot; State", "");
+ value = value.replaceAll("state=\"\\&quot;", "state=\"");
+ System.out.println("New GammaId " + gammaId + " Value = " + value);
+ items = ATSNote.getNoteItems(value, "GammaId:" + gammaId);
+ for (NoteItem item : items) {
+ System.out.println(String.format("Post State [%s]", item.getState()));
+ }
+ // ConnectionHandler.runPreparedUpdate(UPDATE_QUERY, value, gammaId);
+ }
+ }
+
+ private void convertAtsStateNotesAndDefectItemsUserIds() throws OseeCoreException {
+ String SELECT_QUERY = "select * from osee_attribute where value like ? and attr_type_id in (84,92,72,73)";
+ Map<String, String> oldIdToNewId = new HashMap<String, String>();
+ oldIdToNewId.put("<va053c>", "<1588621>");
+ oldIdToNewId.put("<fw314c>", "<1631765>");
+
+ for (Entry<String, String> entry : oldIdToNewId.entrySet()) {
+
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(SELECT_QUERY, "%" + entry.getKey() + "%");
+ while (chStmt.next()) {
+ int gammaId = chStmt.getInt("gamma_id");
+ String value = chStmt.getString("value");
+ System.out.println("Old " + gammaId + " Value = " + value);
+ value = value.replaceAll(entry.getKey(), entry.getValue());
+ System.out.println("New " + gammaId + " Value = " + value);
+ // ConnectionHandler.runPreparedUpdate(UPDATE_QUERY, value, gammaId);
+ }
+ } finally {
+ chStmt.close();
+ }
+
+ }
+ }
+
+ @SuppressWarnings("unused")
+ private void renameTransactionComments() throws OseeCoreException {
+ List<String> notRenamed = new ArrayList<String>();
+ Map<String, Integer> commentToTransId = new HashMap<String, Integer>();
+ String SEARCH_TRANSACTION_COMMENTS =
+ "select transaction_id, osee_comment from osee_tx_details where osee_comment like '%Commit%'";
+
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(SEARCH_TRANSACTION_COMMENTS);
+ while (chStmt.next()) {
+ int transId = chStmt.getInt("transaction_id");
+ String comment = chStmt.getString("osee_comment");
+ commentToTransId.put(comment, transId);
+ }
+ } finally {
+ chStmt.close();
+ }
+
+ for (Entry<String, Integer> entry : commentToTransId.entrySet()) {
+ String comment = entry.getKey();
+ Pattern traxPattern = Pattern.compile("^(.*? - TRAX RPCR .*)( - TRAX RPCR .*)$");
+ Pattern shortPattern = Pattern.compile("^(.*? -) +(.*?) - +(.*?)$");
+ System.out.println("TransId " + entry.getValue() + " Comment = " + comment);
+
+ boolean renamed = false;
+ Matcher m = traxPattern.matcher(comment);
+ if (m.find()) {
+ String first = m.group(1);
+ m.group(2);
+ String newComment = first;
+ if (!comment.equals(newComment)) {
+ renamed = true;
+ System.out.println("TransId " + entry.getValue() + " Rename1 = " + newComment);
+ // TransactionManager.setTransactionComment(TransactionManager.getTransactionId(entry.getValue()),
+ // newComment);
+ }
+ }
+ if (!renamed) {
+ m = shortPattern.matcher(comment);
+ if (m.find()) {
+ String prefix = m.group(1);
+ String first = m.group(2);
+ String second = m.group(3);
+ second = second.replaceFirst("...$", "");
+ String newComment = prefix + " " + first;
+ if (first.equals(second) || first.startsWith(second)) {
+ renamed = true;
+ System.out.println("TransId " + entry.getValue() + " Rename2 = " + newComment);
+ // TransactionManager.setTransactionComment(TransactionManager.getTransactionId(entry.getValue()),
+ // newComment);
+ }
+ }
+ }
+ if (!renamed) {
+ notRenamed.add(comment);
+ }
+
+ }
+ for (String branchName : notRenamed) {
+ System.out.println("Not Renamed " + branchName);
+ }
+
+ }
+
+ @SuppressWarnings("unused")
+ private void renameBranches() throws OseeCoreException {
+ List<String> notRenamed = new ArrayList<String>();
+ Pattern traxPattern = Pattern.compile("^(..... - TRAX RPCR .*)( - TRAX RPCR .*)$");
+ Pattern shortPattern = Pattern.compile("^(..... -) +(.*?) - +(.*?)$");
+ Collection<Branch> branches = BranchManager.getBranches(BranchArchivedState.ALL, BranchType.WORKING);
+ int x = 0;
+ for (Branch branch : branches) {
+ System.out.println(String.format("\n%d/%d - Branch = [%s]", x++, branches.size(), branch));
+ String branchName = branch.getName();
+ boolean renamed = false;
+ Matcher m = traxPattern.matcher(branch.getName());
+ if (m.find()) {
+ String first = m.group(1);
+ m.group(2);
+ String newBranchName = first;
+ if (!branchName.equals(newBranchName)) {
+ renamed = true;
+ System.out.println("Rename = " + newBranchName);
+ branch.setName(newBranchName);
+ BranchManager.persist(branch);
+ }
+ }
+ if (branchName.contains("BGJ6A")) {
+ System.out.println("here");
+ }
+ if (!renamed) {
+ m = shortPattern.matcher(branch.getName());
+ if (m.find()) {
+ String prefix = m.group(1);
+ String first = m.group(2);
+ String second = m.group(3);
+ second = second.replaceFirst("...$", "");
+ String newBranchName = prefix + " " + first;
+ if (first.equals(second) || first.startsWith(second)) {
+ renamed = true;
+ System.out.println("Rename = " + newBranchName);
+ branch.setName(newBranchName);
+ BranchManager.persist(branch);
+ }
+ }
+ }
+ if (!renamed) {
+ notRenamed.add(branchName);
+ }
+
+ }
+ for (String branchName : notRenamed) {
+ System.out.println("Not Renamed " + branchName);
+ }
+
+ }
+
+ @SuppressWarnings("unused")
+ private void deleteDuplicateCommonBranchDuplicateRelations() throws OseeCoreException {
+ XResultData rd = new XResultData();
+ rd.log(getName());
+ int listsCount = 0;
+ int artifactsCount = 0;
+ boolean fix = true;
+ SkynetTransaction transaction =
+ new SkynetTransaction(AtsUtil.getAtsBranch(), "Delete duplicate common branch relations");
+
+ // Break artifacts into blocks so don't run out of memory
+ List<Collection<Integer>> artIdLists = ValidateAtsDatabase.loadAtsBranchArtifactIds(rd, null);
+ for (Collection<Integer> artIdList : artIdLists) {
+ System.out.println(String.format("Processing artifacts from list %d/%d", listsCount++, artIdLists.size()));
+ Collection<Artifact> artifacts = ArtifactQuery.getArtifactListFromIds(artIdList, AtsUtil.getAtsBranch());
+ artifactsCount += artifacts.size();
+
+ for (Artifact artifact : artifacts) {
+ List<RelationLink> relLinks = artifact.getRelationsAll(false);
+ for (RelationLink relLink : relLinks) {
+ // Only handle relations where this artifact is SIDEA (so don't handle same relation twice)
+ if (!relLink.getArtifactA().equals(artifact)) {
+ continue;
+ }
+ // Find all duplicates
+ List<RelationLink> duplicates = new ArrayList<RelationLink>();
+ duplicates.add(relLink);
+ for (RelationLink otherRelLink : relLinks) {
+ if (relLink == otherRelLink) {
+ continue;
+ }
+ if (relLink.equalsConceptually(otherRelLink)) {
+ duplicates.add(otherRelLink);
+ }
+ }
+ // If more than one, there are duplicates
+ if (duplicates.size() > 1) {
+ handleDuplicates(rd, artifact, duplicates, fix, transaction);
+ }
+ }
+ }
+ }
+ transaction.execute();
+ rd.report(getName());
+ }
+
+ /**
+ * For set of duplicate relations, keep first one and delete rest
+ */
+ private void handleDuplicates(XResultData rd, Artifact artifact, List<RelationLink> relLinks, boolean fix, SkynetTransaction transaction) throws OseeCoreException {
+ Integer firstId = null;
+ String firstName = null;
+ String str = relLinks.size() + " duplicate relations found for [" + artifact.getHumanReadableId() + "] ";
+ for (RelationLink relLink : relLinks) {
+ if (firstId == null) {
+ firstId = relLink.getId();
+ firstName = relLink.getArtifactB().getName();
+ } else if (relLink.getId() != firstId && relLink.getArtifactB().getName().equals(firstName)) {
+ str += " Deleteable";
+ if (fix) {
+ relLink.delete(false);
+ artifact.persist(transaction);
+ }
+ }
+ str += "[" + relLink.getArtifactB().getName() + "(" + relLink.getId() + ")]";
+ }
+ System.out.println(str);
+ if (fix) {
+ rd.log("fixed");
+ }
+ rd.log(str);
+ }
+
+ @SuppressWarnings("unused")
+ private void purgeHrids() throws OseeCoreException {
+ String[] hrids = AFile.readFile("O:\\hrids_to_delete.txt").split("\r\n");
+ int x = 0;
+ for (String hrid : hrids) {
+ hrid = hrid.replaceAll(" ", "");
+ System.out.println("Processing " + x++ + " of " + hrids.length);
+ try {
+ Artifact art = null;
+ // Handle case where duplicate hrids
+ try {
+ art = ArtifactQuery.getArtifactFromId(hrid, AtsUtil.getAtsBranch());
+ } catch (MultipleArtifactsExist ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ continue;
+ }
+ Set<Artifact> artsToDelete = new HashSet<Artifact>();
+ if (art instanceof TeamWorkFlowArtifact) {
+ art = ((TeamWorkFlowArtifact) art).getParentActionArtifact();
+ }
+ if (art instanceof ActionArtifact) {
+ artsToDelete.add(art);
+ artsToDelete.addAll(((ActionArtifact) art).getTeamWorkFlowArtifacts());
+ }
+ if (artsToDelete.size() > 0) {
+ System.out.println("Sleeping 5 sec...");
+ Thread.sleep(5000);
+ System.out.println("Purging " + artsToDelete.size() + " artifacts...");
+ new PurgeArtifacts(artsToDelete).execute();
+ }
+ } catch (ArtifactDoesNotExist ex) {
+ System.out.println("Artifact with hrid does not exist: " + hrid);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ }
+
+ }
+
+ @SuppressWarnings("unused")
+ private void convertAtsLogUserIds(SkynetTransaction transaction) throws OseeCoreException {
+ List<String> hrids =
+ Arrays.asList("NKYBF", "J1Z48", "ZY4W5", "U9H58", "9713S", "83XVW", "59B9X", "TQD1J", "UVM7U", "HZT73",
+ "C49Q5", "RHCPY", "MBCXV", "YJFKC", "2F461", "AGW15", "K6ZGD", "9W45V", "GG43L", "G2VTQ", "CVWFC",
+ "EXMT0", "W1TS8", "JM3RD", "7Q0W3", "P9DKR", "BR2RN", "Z6B0Z", "6KT6U", "HPQJX", "QN2K3", "W0VTD",
+ "LDJMH", "6PWYH", "T8B4K", "YTNLC", "9557A", "SQQ6T", "D82X9", "2P5GC", "YK58N", "LWVT1", "KCGSQ",
+ "5X2WL", "C8HWW");
+ for (Artifact art : ArtifactQuery.getArtifactListFromIds(hrids, AtsUtil.getAtsBranch())) {
+ String str = art.getSoleAttributeValue(ATSAttributes.LOG_ATTRIBUTE.getStoreName(), null);
+ str = str.replaceAll("rj236c", "1779483");
+ art.setSoleAttributeFromString(ATSAttributes.LOG_ATTRIBUTE.getStoreName(), str);
+ art.persist(transaction);
+ }
+ }
+
+ @SuppressWarnings("unused")
+ private void fixTestTaskResolutions() throws OseeCoreException {
+ System.out.println("Started fixTestTaskResolutions...");
+ for (Artifact artifact : ArtifactQuery.getArtifactListFromAttributeType(AtsAttributeTypes.Resolution,
+ AtsUtil.getAtsBranch())) {
+ if (artifact instanceof TaskArtifact) {
+ TaskArtifact taskArt = (TaskArtifact) artifact;
+ String resolution =
+ ((TaskArtifact) artifact).getSoleAttributeValue(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName(),
+ null);
+ if (resolution == null) {
+ System.err.println("Unexpected null resolution." + taskArt.getHumanReadableId());
+ // taskArt.deleteSoleAttribute(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+ // taskArt.persistAttributes();
+ } else {
+ String newResolution = null;
+ if (resolution.equals("Need_DTE_Test")) {
+ System.out.println("Rename Need_DTE_Test to In_DTE_Test " + taskArt.getHumanReadableId());
+ newResolution = "In_DTE_Test";
+ } else if (resolution.equals("Awaiting_Code_Fix")) {
+ System.out.println("Rename Awaiting_Code_Fix to Awaiting_Code " + taskArt.getHumanReadableId());
+ newResolution = "Awaiting_Code";
+ } else if (resolution.equals("Awaiting_Review")) {
+ System.out.println("Rename Awaiting_Review to In_DTE_Test " + taskArt.getHumanReadableId());
+ newResolution = "In_DTE_Test";
+ } else if (resolution.equals("Unit_Tested")) {
+ System.out.println("Rename Unit_Tested to In_DTE_Test " + taskArt.getHumanReadableId());
+ newResolution = "In_DTE_Test";
+ }
+ if (newResolution != null) {
+ taskArt.setSoleAttributeFromString(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName(), newResolution);
+ taskArt.persist();
+ }
+ }
+ }
+ }
+ System.out.println("Completed fixTestTaskResolutions...");
+ }
+
+ // private void deleteUnAssignedUserRelations() throws OseeCoreException {
+ // AbstractSkynetTxTemplate newActionTx = new AbstractSkynetTxTemplate(AtsUtil.getAtsBranch()) {
+ //
+ // @Override
+ // protected void handleTxWork() throws OseeCoreException {
+ // User unassignedUser = SkynetAuthentication.getUser(UserEnum.UnAssigned);
+ // for (Artifact art : unassignedUser.getRelatedArtifacts(CoreRelationEnumeration.Users_Artifact)) {
+ // if (art instanceof StateMachineArtifact) {
+ // unassignedUser.deleteRelation(CoreRelationEnumeration.Users_Artifact, art);
+ // }
+ // }
+ // unassignedUser.persistRelations();
+ // }
+ // };
+ // newActionTx.execute();
+ // }
+
+ // private static final boolean fixIt = false;
+
+ // public void cleanXViewerCustomizations() throws OseeCoreException {
+ // for (User user : SkynetAuthentication.getUsers()) {
+ // System.out.println("User: " + user);
+ //
+ // SkynetUserArtifactCustomizeDefaults custDefaults = new SkynetUserArtifactCustomizeDefaults(user);
+ //
+ // // Get all customizations
+ // List<String> customizations = user.getAttributesToStringList("XViewer Customization");
+ // if (customizations.isEmpty() && custDefaults.isEmpty()) continue;
+ // Set<String> validGuids = new HashSet<String>();
+ // int currNumDefaults = custDefaults.getGuids().size();
+ // for (String custStr : new CopyOnWriteArrayList<String>(customizations)) {
+ // CustomizeData custData = new CustomizeData(custStr);
+ // validGuids.add(custData.getGuid());
+ //
+ // // check for old customizations to remove
+ // boolean orderFound = custStr.contains("<order>");
+ // boolean namespaceNullFound = custStr.contains("namespace=\"null\"");
+ // if (orderFound || namespaceNullFound) {
+ // System.err.println("Removing " + (orderFound ? "<order>" : "namespace==null") + " customizations " + custData.getGuid());
+ // validGuids.remove(custData.getGuid());
+ // custDefaults.removeDefaultCustomization(custData);
+ // customizations.remove(custStr);
+ // } else {
+ // // Check for sort columns that are hidden
+ // for (String columnName : custData.getSortingData().getSortingNames()) {
+ // XViewerColumn xCol = custData.getColumnData().getXColumn(columnName);
+ // if (xCol == null) {
+ // System.err.println("sort column not found \"" + columnName + "\" - " + custData.getGuid());
+ // } else if (xCol.isShow() == false) {
+ // System.err.println("sort col is hidden \"" + columnName + "\" - " + custData.getGuid());
+ // }
+ // }
+ // }
+ // }
+ // if (validGuids.size() != custDefaults.getGuids().size()) {
+ // System.err.println("Update default customizations : " + user + " - " + currNumDefaults + " valid: " + validGuids.size());
+ // custDefaults.setGuids(validGuids);
+ // }
+ // if (fixIt) {
+ // custDefaults.save();
+ // user.setAttributeValues("XViewer Customization", customizations);
+ // user.persistAttributes();
+ // }
+ // }
+ // }
+
+ public Result isCustomizationSortErrored(String custDataStr, CustomizeData custData) {
+
+ return Result.TrueResult;
+ }
+
+ // String xViewerDefaults = user.getSoleAttributeValueAsString("XViewer Defaults", null);
+ // // Get all current default guids
+ // Set<String> currentDefaultGuids = new HashSet<String>();
+ // if (xViewerDefaults != null) {
+ // for (String guid : AXml.getTagDataArray(xViewerDefaults, XVIEWER_DEFAULTS_TAG)) {
+ // if (guid != null && !guid.equals("")) {
+ // currentDefaultGuids.add(guid);
+ // }
+ // }
+ // }
+ // private void relateDonDunne()throws OseeCoreException{
+ // AbstractSkynetTxTemplate newActionTx = new AbstractSkynetTxTemplate(AtsUtil.getAtsBranch()) {
+ //
+ // @Override
+ // protected void handleTxWork()throws OseeCoreException{
+ // for (Artifact art : ArtifactQuery.getArtifactsFromAttribute(
+ // ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName(),
+ // "%<" + SkynetAuthentication.getUser().getUserId() + ">%", AtsUtil.getAtsBranch())) {
+ // if ((art instanceof StateMachineArtifact) && ((StateMachineArtifact) art).getStateMgr().getAssignees().contains(
+ // SkynetAuthentication.getUser())) {
+ // art.addRelation(CoreRelationEnumeration.Users_User, SkynetAuthentication.getUser());
+ // }
+ // }
+ // SkynetAuthentication.getUser().persistRelations();
+ // }
+ // };
+ // newActionTx.execute();
+ //
+ // }
+
+ // private void testDeleteAttribute() throws OseeCoreException {
+ // Artifact art =
+ // ArtifactQuery.getArtifactsFromIds(Arrays.asList("76589"), AtsUtil.getAtsBranch()).iterator().next();
+ // for (Attribute<?> attr : art.getAttributes()) {
+ // if (attr.getValue() == null) {
+ // System.out.println(art.getHumanReadableId() + " - " + attr.getNameValueDescription());
+ // attr.delete();
+ // }
+ // }
+ // art.persistAttributes();
+ // }
+
+ // private void deleteNullAttributes() throws OseeCoreException {
+ //
+ // AbstractSkynetTxTemplate newActionTx = new AbstractSkynetTxTemplate(AtsUtil.getAtsBranch()) {
+ //
+ // @Override
+ // protected void handleTxWork() throws OseeCoreException {
+ // int x = 0;
+ // for (String artTypeName : Arrays.asList(TeamWorkFlowArtifact.ARTIFACT_NAME, TaskArtifact.ARTIFACT_NAME,
+ // DecisionReviewArtifact.ARTIFACT_NAME, PeerToPeerReviewArtifact.ARTIFACT_NAME,
+ // "Lba V13 Code Team Workflow", "Lba V13 Test Team Workflow", "Lba V13 Req Team Workflow",
+ // "Lba V13 SW Design Team Workflow", "Lba V13 Tech Approach Team Workflow",
+ // "Lba V11 REU Code Team Workflow", "Lba V11 REU Test Team Workflow", "Lba V11 REU Req Team Workflow",
+ // "Lba B3 Code Team Workflow", "Lba B3 Test Team Workflow", "Lba B3 Req Team Workflow",
+ // "Lba B3 SW Design Team Workflow", "Lba B3 Tech Approach Team Workflow")) {
+ // for (Artifact team : ArtifactQuery.getArtifactsFromType(artTypeName, AtsUtil.getAtsBranch())) {
+ // for (Attribute<?> attr : team.getAttributes(false)) {
+ // if (attr.getValue() == null) {
+ // System.out.println(team.getHumanReadableId() + " - " + attr.getNameValueDescription());
+ // attr.delete();
+ // x++;
+ // }
+ // }
+ // if (team.isDirty()) team.persistAttributes();
+ // }
+ // }
+ // System.out.println("Deleted " + x);
+ // }
+ // };
+ // newActionTx.execute();
+ //
+ // }
+ //
+ // private void deleteNullUserAttributes() throws OseeCoreException {
+ //
+ // AbstractSkynetTxTemplate newActionTx = new AbstractSkynetTxTemplate(AtsUtil.getAtsBranch()) {
+ //
+ // @Override
+ // protected void handleTxWork() throws OseeCoreException {
+ // int x = 0;
+ // for (String artTypeName : Arrays.asList(User.ARTIFACT_NAME)) {
+ // for (Artifact team : ArtifactQuery.getArtifactsFromType(artTypeName, AtsUtil.getAtsBranch())) {
+ // for (Attribute<?> attr : team.getAttributes(false)) {
+ // if (attr.getValue() == null) {
+ // System.out.println(team.getHumanReadableId() + " - " + attr.getNameValueDescription());
+ // attr.delete();
+ // x++;
+ // }
+ // }
+ // if (team.isDirty()) team.persistAttributes();
+ // }
+ // }
+ // System.out.println("Deleted " + x);
+ // }
+ // };
+ // newActionTx.execute();
+ //
+ // }
+
+ // for (String artTypeName : Arrays.asList(TeamWorkFlowArtifact.ARTIFACT_NAME, TaskArtifact.ARTIFACT_NAME,
+ // DecisionReviewArtifact.ARTIFACT_NAME, PeerToPeerReviewArtifact.ARTIFACT_NAME,
+ // "Lba V13 Code Team Workflow", "Lba V13 Test Team Workflow", "Lba V13 Req Team Workflow",
+ // "Lba V13 SW Design Team Workflow", "Lba V13 Tech Approach Team Workflow",
+ // "Lba V11 REU Code Team Workflow", "Lba V11 REU Test Team Workflow", "Lba V11 REU Req Team Workflow",
+ // "Lba B3 Code Team Workflow", "Lba B3 Test Team Workflow", "Lba B3 Req Team Workflow",
+ // "Lba B3 SW Design Team Workflow", "Lba B3 Tech Approach Team Workflow")) {
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java
index 72541201c71..0abe93c7418 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.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.ats.util.Import;
-
-import java.io.FileFilter;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.config.AtsCacheManager;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.ActionManager;
-import org.eclipse.osee.ats.util.AtsArtifactTypes;
-import org.eclipse.osee.ats.util.AtsNotifyUsers;
-import org.eclipse.osee.ats.util.AtsPriority;
-import org.eclipse.osee.ats.util.AtsRelationTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelSaxHandler;
-import org.eclipse.osee.framework.jdk.core.util.io.xml.RowProcessor;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * @author Donald G. Dunne
- */
-public class ExcelAtsActionArtifactExtractor {
-
- private final Set<ActionData> actionDatas;
- private final Set<ActionArtifact> actionArts;
- private final boolean emailPOCs;
-
- public ExcelAtsActionArtifactExtractor(boolean emailPOCs) {
- this.emailPOCs = emailPOCs;
- this.actionDatas = new HashSet<ActionData>();
- this.actionArts = new HashSet<ActionArtifact>();
- }
-
- public boolean dataIsValid() throws OseeCoreException {
- System.out.println("Validating...");
- XResultData rd = new XResultData();
- int rowNum = 1; // Header is row 1
- for (ActionData aData : actionDatas) {
- rowNum++;
- if (aData.title.equals("")) {
- rd.logError("Row " + rowNum + "; Invalid Title");
- }
- if (aData.actionableItems.isEmpty()) {
- rd.logError("Row " + rowNum + ": Must have at least one ActionableItem defined");
- } else {
- for (String actionableItemName : aData.actionableItems) {
- try {
- if (AtsCacheManager.getArtifactsByName(ArtifactTypeManager.getType(AtsArtifactTypes.ActionableItem),
- actionableItemName).size() > 0) {
- rd.logError("Row " + rowNum + ": Couldn't find actionable item for \"" + actionableItemName + "\"");
- }
- } catch (Exception ex) {
- rd.logError("Row " + rowNum + " - " + ex.getLocalizedMessage());
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- if (!aData.version.equals("")) {
- try {
- if (AtsCacheManager.getSoleArtifactByName(ArtifactTypeManager.getType(AtsArtifactTypes.Version),
- aData.version) == null) {
- rd.logError("Row " + rowNum + ": Can't find single version \"" + aData.version + "\"");
- }
- } catch (Exception ex) {
- rd.logError("Row " + rowNum + " - " + ex.getLocalizedMessage());
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- // If no assignees, ATS will auto-assign to correct person
- // Else if assignees, confirm that they are valid
- if (aData.assigneeStrs.size() > 0) {
- for (String assignee : aData.assigneeStrs) {
- User user = UserManager.getUserByName(assignee);
- if (user == null) {
- rd.logError("Row " + rowNum + ": Couldn't retrieve user \"" + assignee + "\"");
- } else {
- aData.assignees.add(user);
- }
- }
- }
- }
- if (!rd.toString().equals("")) {
- rd.report("Ats Action Import Errors");
- return false;
- }
- return true;
- }
-
- public void createArtifactsAndNotify(SkynetTransaction transaction) {
- AtsUtil.setEmailEnabled(false);
- System.out.println("Creating...");
- Set<TeamWorkFlowArtifact> teamWfs = new HashSet<TeamWorkFlowArtifact>();
- try {
- for (ActionData aData : actionDatas) {
- ActionArtifact actionArt =
- ActionManager.createAction(null, aData.title, aData.desc, ChangeType.getChangeType(aData.changeType),
- AtsPriority.PriorityType.getPriority(aData.priorityStr), false, null,
- ActionableItemArtifact.getActionableItems(aData.actionableItems), transaction);
- actionArts.add(actionArt);
- if (!aData.version.equals("")) {
- VersionArtifact verArt =
- (VersionArtifact) AtsCacheManager.getSoleArtifactByName(
- ArtifactTypeManager.getType(AtsArtifactTypes.Version), aData.version);
-
- for (TeamWorkFlowArtifact team : actionArt.getTeamWorkFlowArtifacts()) {
- verArt.addRelation(AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow, team);
- }
- }
- if (aData.assigneeStrs.size() > 0) {
- for (TeamWorkFlowArtifact team : actionArt.getTeamWorkFlowArtifacts()) {
- team.getStateMgr().setAssignees(aData.assignees);
- }
- }
- for (TeamWorkFlowArtifact team : actionArt.getTeamWorkFlowArtifacts()) {
- team.persist(transaction);
- }
- teamWfs.addAll(actionArt.getTeamWorkFlowArtifacts());
- }
- AtsUtil.setEmailEnabled(true);
- if (emailPOCs) {
- for (TeamWorkFlowArtifact team : teamWfs) {
- AtsNotifyUsers.getInstance().notify(team, AtsNotifyUsers.NotifyType.Assigned);
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- } finally {
- AtsUtil.setEmailEnabled(true);
- }
- }
-
- public void process(URI source) throws OseeCoreException {
- try {
- XMLReader xmlReader = XMLReaderFactory.createXMLReader();
- xmlReader.setContentHandler(new ExcelSaxHandler(new InternalRowProcessor(actionDatas), true));
- xmlReader.parse(new InputSource(new InputStreamReader(source.toURL().openStream(), "UTF-8")));
- } catch (Exception ex) {
- throw new OseeCoreException(ex);
- }
- }
-
- public String getDescription() {
- return "Extract each row as an Action";
- }
-
- /**
- * @return the actionArts
- */
- public Set<ActionArtifact> getActionArts() {
- return actionArts;
- }
-
- public FileFilter getFileFilter() {
- return null;
- }
-
- public String getName() {
- return "Excel Ats Actions";
- }
-
- private final static class ActionData {
- protected String title = "";
- protected String desc = "";
- protected String priorityStr = "";
- protected Set<String> userComms = new HashSet<String>();
- protected String changeType = "";
- protected Set<String> assigneeStrs = new HashSet<String>();
- protected Set<User> assignees = new HashSet<User>();
- protected Set<String> actionableItems = new HashSet<String>();
- protected String version = "";
- }
-
- private final static class InternalRowProcessor implements RowProcessor {
-
- private static enum Columns {
- Title, Description, ActionableItems, Assignees, Priority, ChangeType, UserCommunity, Version
- };
-
- private String[] headerRow;
- private int rowNum = 0;
- private final Set<ActionData> actionDatas;
-
- protected InternalRowProcessor(Set<ActionData> actionDatas) {
- this.actionDatas = actionDatas;
- }
-
- @Override
- public void processEmptyRow() {
- }
-
- @Override
- public void processCommentRow(String[] row) {
- }
-
- @Override
- public void reachedEndOfWorksheet() {
- }
-
- @Override
- public void detectedRowAndColumnCounts(int rowCount, int columnCount) {
- }
-
- @Override
- public void foundStartOfWorksheet(String sheetName) {
- }
-
- @Override
- public void processHeaderRow(String[] headerRow) {
- this.headerRow = headerRow.clone();
- }
-
- @Override
- public void processRow(String[] cols) {
- rowNum++;
- System.out.println("Processing Row " + rowNum);
-
- boolean fullRow = false;
- for (int i = 0; i < cols.length; i++) {
- if (cols[i] != null && !cols[i].equals("")) {
- fullRow = true;
- break;
- }
- }
- if (!fullRow) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, "Empty Row Found => " + rowNum + " skipping...");
- return;
- }
-
- System.out.println("Reading rows...");
- ActionData aData = new ActionData();
- for (int i = 0; i < cols.length; i++) {
- if (headerRow[i] == null) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, "Null header column => " + i);
- } else if (headerRow[i].equalsIgnoreCase(Columns.Title.name())) {
- if (cols[i].equals("")) {
- return;
- }
- aData.title = cols[i];
- } else if (headerRow[i].equalsIgnoreCase(Columns.Priority.name())) {
- aData.priorityStr = cols[i];
- } else if (headerRow[i].equalsIgnoreCase(Columns.Version.name())) {
- aData.version = cols[i] == null ? "" : cols[i];
- } else if (headerRow[i].equalsIgnoreCase(Columns.ChangeType.name())) {
- aData.changeType = cols[i];
- } else if (headerRow[i].equalsIgnoreCase(Columns.Description.name())) {
- aData.desc = cols[i] == null ? "" : cols[i];
- } else if (headerRow[i].equalsIgnoreCase(Columns.UserCommunity.name())) {
- for (String str : cols[i].split(";")) {
- if (!str.equals("")) {
- aData.userComms.add(str);
- }
- }
- } else if (headerRow[i].equalsIgnoreCase(Columns.ActionableItems.name())) {
- for (String str : cols[i].split(";")) {
- if (!str.equals("")) {
- aData.actionableItems.add(str);
- }
- }
- } else if (headerRow[i].equalsIgnoreCase(Columns.Assignees.name())) {
- if (cols[i] != null) {
- for (String str : cols[i].split(";")) {
- if (!str.equals("")) {
- aData.assigneeStrs.add(str);
- }
- }
- }
- } else {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Unhandled column => " + headerRow[i]);
- }
- }
- actionDatas.add(aData);
- }
- }
+/*******************************************************************************
+ * 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.ats.util.Import;
+
+import java.io.FileFilter;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.config.AtsCacheManager;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.ActionManager;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
+import org.eclipse.osee.ats.util.AtsNotifyUsers;
+import org.eclipse.osee.ats.util.AtsPriority;
+import org.eclipse.osee.ats.util.AtsRelationTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelSaxHandler;
+import org.eclipse.osee.framework.jdk.core.util.io.xml.RowProcessor;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ExcelAtsActionArtifactExtractor {
+
+ private final Set<ActionData> actionDatas;
+ private final Set<ActionArtifact> actionArts;
+ private final boolean emailPOCs;
+
+ public ExcelAtsActionArtifactExtractor(boolean emailPOCs) {
+ this.emailPOCs = emailPOCs;
+ this.actionDatas = new HashSet<ActionData>();
+ this.actionArts = new HashSet<ActionArtifact>();
+ }
+
+ public boolean dataIsValid() throws OseeCoreException {
+ System.out.println("Validating...");
+ XResultData rd = new XResultData();
+ int rowNum = 1; // Header is row 1
+ for (ActionData aData : actionDatas) {
+ rowNum++;
+ if (aData.title.equals("")) {
+ rd.logError("Row " + rowNum + "; Invalid Title");
+ }
+ if (aData.actionableItems.isEmpty()) {
+ rd.logError("Row " + rowNum + ": Must have at least one ActionableItem defined");
+ } else {
+ for (String actionableItemName : aData.actionableItems) {
+ try {
+ if (AtsCacheManager.getArtifactsByName(ArtifactTypeManager.getType(AtsArtifactTypes.ActionableItem),
+ actionableItemName).size() > 0) {
+ rd.logError("Row " + rowNum + ": Couldn't find actionable item for \"" + actionableItemName + "\"");
+ }
+ } catch (Exception ex) {
+ rd.logError("Row " + rowNum + " - " + ex.getLocalizedMessage());
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ if (!aData.version.equals("")) {
+ try {
+ if (AtsCacheManager.getSoleArtifactByName(ArtifactTypeManager.getType(AtsArtifactTypes.Version),
+ aData.version) == null) {
+ rd.logError("Row " + rowNum + ": Can't find single version \"" + aData.version + "\"");
+ }
+ } catch (Exception ex) {
+ rd.logError("Row " + rowNum + " - " + ex.getLocalizedMessage());
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ // If no assignees, ATS will auto-assign to correct person
+ // Else if assignees, confirm that they are valid
+ if (aData.assigneeStrs.size() > 0) {
+ for (String assignee : aData.assigneeStrs) {
+ User user = UserManager.getUserByName(assignee);
+ if (user == null) {
+ rd.logError("Row " + rowNum + ": Couldn't retrieve user \"" + assignee + "\"");
+ } else {
+ aData.assignees.add(user);
+ }
+ }
+ }
+ }
+ if (!rd.toString().equals("")) {
+ rd.report("Ats Action Import Errors");
+ return false;
+ }
+ return true;
+ }
+
+ public void createArtifactsAndNotify(SkynetTransaction transaction) {
+ AtsUtil.setEmailEnabled(false);
+ System.out.println("Creating...");
+ Set<TeamWorkFlowArtifact> teamWfs = new HashSet<TeamWorkFlowArtifact>();
+ try {
+ for (ActionData aData : actionDatas) {
+ ActionArtifact actionArt =
+ ActionManager.createAction(null, aData.title, aData.desc, ChangeType.getChangeType(aData.changeType),
+ AtsPriority.PriorityType.getPriority(aData.priorityStr), false, null,
+ ActionableItemArtifact.getActionableItems(aData.actionableItems), transaction);
+ actionArts.add(actionArt);
+ if (!aData.version.equals("")) {
+ VersionArtifact verArt =
+ (VersionArtifact) AtsCacheManager.getSoleArtifactByName(
+ ArtifactTypeManager.getType(AtsArtifactTypes.Version), aData.version);
+
+ for (TeamWorkFlowArtifact team : actionArt.getTeamWorkFlowArtifacts()) {
+ verArt.addRelation(AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow, team);
+ }
+ }
+ if (aData.assigneeStrs.size() > 0) {
+ for (TeamWorkFlowArtifact team : actionArt.getTeamWorkFlowArtifacts()) {
+ team.getStateMgr().setAssignees(aData.assignees);
+ }
+ }
+ for (TeamWorkFlowArtifact team : actionArt.getTeamWorkFlowArtifacts()) {
+ team.persist(transaction);
+ }
+ teamWfs.addAll(actionArt.getTeamWorkFlowArtifacts());
+ }
+ AtsUtil.setEmailEnabled(true);
+ if (emailPOCs) {
+ for (TeamWorkFlowArtifact team : teamWfs) {
+ AtsNotifyUsers.getInstance().notify(team, AtsNotifyUsers.NotifyType.Assigned);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ } finally {
+ AtsUtil.setEmailEnabled(true);
+ }
+ }
+
+ public void process(URI source) throws OseeCoreException {
+ try {
+ XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+ xmlReader.setContentHandler(new ExcelSaxHandler(new InternalRowProcessor(actionDatas), true));
+ xmlReader.parse(new InputSource(new InputStreamReader(source.toURL().openStream(), "UTF-8")));
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ public String getDescription() {
+ return "Extract each row as an Action";
+ }
+
+ /**
+ * @return the actionArts
+ */
+ public Set<ActionArtifact> getActionArts() {
+ return actionArts;
+ }
+
+ public FileFilter getFileFilter() {
+ return null;
+ }
+
+ public String getName() {
+ return "Excel Ats Actions";
+ }
+
+ private final static class ActionData {
+ protected String title = "";
+ protected String desc = "";
+ protected String priorityStr = "";
+ protected Set<String> userComms = new HashSet<String>();
+ protected String changeType = "";
+ protected Set<String> assigneeStrs = new HashSet<String>();
+ protected Set<User> assignees = new HashSet<User>();
+ protected Set<String> actionableItems = new HashSet<String>();
+ protected String version = "";
+ }
+
+ private final static class InternalRowProcessor implements RowProcessor {
+
+ private static enum Columns {
+ Title, Description, ActionableItems, Assignees, Priority, ChangeType, UserCommunity, Version
+ };
+
+ private String[] headerRow;
+ private int rowNum = 0;
+ private final Set<ActionData> actionDatas;
+
+ protected InternalRowProcessor(Set<ActionData> actionDatas) {
+ this.actionDatas = actionDatas;
+ }
+
+ @Override
+ public void processEmptyRow() {
+ }
+
+ @Override
+ public void processCommentRow(String[] row) {
+ }
+
+ @Override
+ public void reachedEndOfWorksheet() {
+ }
+
+ @Override
+ public void detectedRowAndColumnCounts(int rowCount, int columnCount) {
+ }
+
+ @Override
+ public void foundStartOfWorksheet(String sheetName) {
+ }
+
+ @Override
+ public void processHeaderRow(String[] headerRow) {
+ this.headerRow = headerRow.clone();
+ }
+
+ @Override
+ public void processRow(String[] cols) {
+ rowNum++;
+ System.out.println("Processing Row " + rowNum);
+
+ boolean fullRow = false;
+ for (int i = 0; i < cols.length; i++) {
+ if (cols[i] != null && !cols[i].equals("")) {
+ fullRow = true;
+ break;
+ }
+ }
+ if (!fullRow) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, "Empty Row Found => " + rowNum + " skipping...");
+ return;
+ }
+
+ System.out.println("Reading rows...");
+ ActionData aData = new ActionData();
+ for (int i = 0; i < cols.length; i++) {
+ if (headerRow[i] == null) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, "Null header column => " + i);
+ } else if (headerRow[i].equalsIgnoreCase(Columns.Title.name())) {
+ if (cols[i].equals("")) {
+ return;
+ }
+ aData.title = cols[i];
+ } else if (headerRow[i].equalsIgnoreCase(Columns.Priority.name())) {
+ aData.priorityStr = cols[i];
+ } else if (headerRow[i].equalsIgnoreCase(Columns.Version.name())) {
+ aData.version = cols[i] == null ? "" : cols[i];
+ } else if (headerRow[i].equalsIgnoreCase(Columns.ChangeType.name())) {
+ aData.changeType = cols[i];
+ } else if (headerRow[i].equalsIgnoreCase(Columns.Description.name())) {
+ aData.desc = cols[i] == null ? "" : cols[i];
+ } else if (headerRow[i].equalsIgnoreCase(Columns.UserCommunity.name())) {
+ for (String str : cols[i].split(";")) {
+ if (!str.equals("")) {
+ aData.userComms.add(str);
+ }
+ }
+ } else if (headerRow[i].equalsIgnoreCase(Columns.ActionableItems.name())) {
+ for (String str : cols[i].split(";")) {
+ if (!str.equals("")) {
+ aData.actionableItems.add(str);
+ }
+ }
+ } else if (headerRow[i].equalsIgnoreCase(Columns.Assignees.name())) {
+ if (cols[i] != null) {
+ for (String str : cols[i].split(";")) {
+ if (!str.equals("")) {
+ aData.assigneeStrs.add(str);
+ }
+ }
+ }
+ } else {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Unhandled column => " + headerRow[i]);
+ }
+ }
+ actionDatas.add(aData);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
index cf07a0972a6..ba52546a97a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
@@ -1,271 +1,271 @@
-/*******************************************************************************
- * 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.ats.util.Import;
-
-import java.io.FileFilter;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact.TransitionOption;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsNotifyUsers;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelSaxHandler;
-import org.eclipse.osee.framework.jdk.core.util.io.xml.RowProcessor;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * @author Donald G. Dunne
- */
-public class ExcelAtsTaskArtifactExtractor {
-
- private final StateMachineArtifact sma;
- private final boolean emailPOCs;
- private final SkynetTransaction transaction;
-
- private IProgressMonitor monitor;
-
- public ExcelAtsTaskArtifactExtractor(TeamWorkFlowArtifact artifact, boolean emailPOCs, SkynetTransaction transaction) {
- this.emailPOCs = emailPOCs;
- this.transaction = transaction;
- this.sma = artifact;
- }
-
- public void process(URI source) throws OseeCoreException {
- try {
- XMLReader xmlReader = XMLReaderFactory.createXMLReader();
- IProgressMonitor monitor = getMonitor();
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- xmlReader.setContentHandler(new ExcelSaxHandler(
- new InternalRowProcessor(monitor, transaction, sma, emailPOCs), true));
- xmlReader.parse(new InputSource(new InputStreamReader(source.toURL().openStream(), "UTF-8")));
- } catch (Exception ex) {
- throw new OseeCoreException(ex);
- }
- }
-
- public String getDescription() {
- return "Extract each row as a task";
- }
-
- public IProgressMonitor getMonitor() {
- return monitor;
- }
-
- public void setMonitor(IProgressMonitor monitor) {
- this.monitor = monitor;
- }
-
- public FileFilter getFileFilter() {
- return null;
- }
-
- public String getName() {
- return "Excel Ats Tasks";
- }
-
- private final static class InternalRowProcessor implements RowProcessor {
- private String[] headerRow;
- private int rowNum;
- private final IProgressMonitor monitor;
- private final StateMachineArtifact sma;
- private final SkynetTransaction transaction;
- private final boolean emailPOCs;
-
- protected InternalRowProcessor(IProgressMonitor monitor, SkynetTransaction transaction, StateMachineArtifact sma, boolean emailPOCs) {
- this.monitor = monitor;
- this.transaction = transaction;
- this.emailPOCs = emailPOCs;
- this.sma = sma;
- }
-
- public void processEmptyRow() {
- }
-
- public void processCommentRow(String[] row) {
- }
-
- public void reachedEndOfWorksheet() {
- }
-
- public void detectedRowAndColumnCounts(int rowCount, int columnCount) {
- }
-
- public void foundStartOfWorksheet(String sheetName) {
- }
-
- public void processHeaderRow(String[] headerRow) {
- this.headerRow = headerRow.clone();
- }
-
- public void processRow(String[] row) {
- try {
- rowNum++;
- monitor.setTaskName("Processing Row " + rowNum);
- TaskArtifact taskArt = ((TaskableStateMachineArtifact) sma).createNewTask("");
-
- monitor.subTask("Validating...");
- boolean fullRow = false;
- for (int i = 0; i < row.length; i++) {
- if (row[i] != null && !row[i].equals("")) {
- fullRow = true;
- break;
- }
- }
- if (!fullRow) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, "Empty Row Found => " + rowNum + " skipping...");
- return;
- }
- AtsUtil.setEmailEnabled(false);
- for (int i = 0; i < row.length; i++) {
- if (headerRow[i] == null) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, "Null header column => " + i);
- } else if (headerRow[i].equalsIgnoreCase("Originator")) {
- String userName = row[i];
- User u = null;
- if (userName == null || userName.equals("")) {
- u = UserManager.getUser();
- } else {
- u = UserManager.getUserByName(userName);
- }
- if (u == null) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, String.format(
- "Invalid Originator \"%s\" for row %d\nSetting to current user.", userName, rowNum));
- }
- taskArt.getLog().setOriginator(u);
- } else if (headerRow[i].equalsIgnoreCase("Assignees")) {
- Set<User> assignees = new HashSet<User>();
- for (String userName : row[i].split(";")) {
- userName = userName.replaceAll("^\\s+", "");
- userName = userName.replaceAll("\\+$", "");
- User user = null;
- if (userName == null || userName.equals("")) {
- user = UserManager.getUser();
- } else {
- try {
- user = UserManager.getUserByName(userName);
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- if (user == null) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, String.format(
- "Invalid Assignee \"%s\" for row %d. Using current user.", userName, rowNum));
- user = UserManager.getUser();
- }
- assignees.add(user);
- }
- taskArt.getStateMgr().setAssignees(assignees);
- } else if (headerRow[i].equalsIgnoreCase("Resolution")) {
- String str = row[i];
- if (str != null && !str.equals("")) {
- taskArt.setSoleAttributeValue(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName(), str);
- }
- } else if (headerRow[i].equalsIgnoreCase("Description")) {
- String str = row[i];
- if (str != null && !str.equals("")) {
- taskArt.setSoleAttributeValue(ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName(), str);
- }
- } else if (headerRow[i].equalsIgnoreCase("Related to State")) {
- String str = row[i];
- if (str != null && !str.equals("")) {
- taskArt.setSoleAttributeValue(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName(), str);
- }
- } else if (headerRow[i].equalsIgnoreCase("Notes")) {
- String str = row[i];
- if (str != null && !str.equals("")) {
- taskArt.setSoleAttributeValue(ATSAttributes.SMA_NOTE_ATTRIBUTE.getStoreName(), str);
- }
- } else if (headerRow[i].equalsIgnoreCase("Title")) {
- String str = row[i];
- if (str != null && !str.equals("")) {
- monitor.subTask(String.format("Title \"%s\"", str));
- taskArt.setName(str);
- }
- } else if (headerRow[i].equalsIgnoreCase("Percent Complete")) {
- String str = row[i];
- Double percent;
- if (str != null && !str.equals("")) {
- try {
- percent = new Double(str);
- if (percent < 1) {
- percent = percent * 100;
- }
- } catch (Exception ex) {
- throw new OseeArgumentException(String.format("Invalid Percent Complete \"%s\" for row %d",
- str, rowNum));
- }
- int percentInt = percent.intValue();
- sma.getStateMgr().updateMetrics(0, percentInt, true);
- }
- } else if (headerRow[i].equalsIgnoreCase("Hours Spent")) {
- String str = row[i];
- double hours = 0;
- if (str != null && !str.equals("")) {
- try {
- hours = new Double(str);
- } catch (Exception ex) {
- throw new OseeArgumentException(String.format("Invalid Hours Spent \"%s\" for row %d", str,
- rowNum));
- }
- sma.getStateMgr().updateMetrics(hours, sma.getStateMgr().getPercentComplete(), true);
- }
- } else if (headerRow[i].equalsIgnoreCase("Estimated Hours")) {
- String str = row[i];
- double hours = 0;
- if (str != null && !str.equals("")) {
- try {
- hours = new Double(str);
- } catch (Exception ex) {
- throw new OseeArgumentException(String.format("Invalid Estimated Hours \"%s\" for row %d", str,
- rowNum));
- }
- taskArt.setSoleAttributeValue(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName(), hours);
- }
- } else {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, "Unhandled column => " + headerRow[i]);
- }
- }
- AtsUtil.setEmailEnabled(true);
- if (taskArt.isCompleted()) {
- taskArt.transitionToCompleted(0, transaction, TransitionOption.None);
- }
- // always persist
- taskArt.persist(transaction);
- if (emailPOCs && !taskArt.isCompleted() && !taskArt.isCancelled()) {
- AtsNotifyUsers.getInstance().notify(sma, AtsNotifyUsers.NotifyType.Assigned);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
+/*******************************************************************************
+ * 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.ats.util.Import;
+
+import java.io.FileFilter;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact.TransitionOption;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsNotifyUsers;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelSaxHandler;
+import org.eclipse.osee.framework.jdk.core.util.io.xml.RowProcessor;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ExcelAtsTaskArtifactExtractor {
+
+ private final StateMachineArtifact sma;
+ private final boolean emailPOCs;
+ private final SkynetTransaction transaction;
+
+ private IProgressMonitor monitor;
+
+ public ExcelAtsTaskArtifactExtractor(TeamWorkFlowArtifact artifact, boolean emailPOCs, SkynetTransaction transaction) {
+ this.emailPOCs = emailPOCs;
+ this.transaction = transaction;
+ this.sma = artifact;
+ }
+
+ public void process(URI source) throws OseeCoreException {
+ try {
+ XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+ IProgressMonitor monitor = getMonitor();
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ xmlReader.setContentHandler(new ExcelSaxHandler(
+ new InternalRowProcessor(monitor, transaction, sma, emailPOCs), true));
+ xmlReader.parse(new InputSource(new InputStreamReader(source.toURL().openStream(), "UTF-8")));
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ public String getDescription() {
+ return "Extract each row as a task";
+ }
+
+ public IProgressMonitor getMonitor() {
+ return monitor;
+ }
+
+ public void setMonitor(IProgressMonitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public FileFilter getFileFilter() {
+ return null;
+ }
+
+ public String getName() {
+ return "Excel Ats Tasks";
+ }
+
+ private final static class InternalRowProcessor implements RowProcessor {
+ private String[] headerRow;
+ private int rowNum;
+ private final IProgressMonitor monitor;
+ private final StateMachineArtifact sma;
+ private final SkynetTransaction transaction;
+ private final boolean emailPOCs;
+
+ protected InternalRowProcessor(IProgressMonitor monitor, SkynetTransaction transaction, StateMachineArtifact sma, boolean emailPOCs) {
+ this.monitor = monitor;
+ this.transaction = transaction;
+ this.emailPOCs = emailPOCs;
+ this.sma = sma;
+ }
+
+ public void processEmptyRow() {
+ }
+
+ public void processCommentRow(String[] row) {
+ }
+
+ public void reachedEndOfWorksheet() {
+ }
+
+ public void detectedRowAndColumnCounts(int rowCount, int columnCount) {
+ }
+
+ public void foundStartOfWorksheet(String sheetName) {
+ }
+
+ public void processHeaderRow(String[] headerRow) {
+ this.headerRow = headerRow.clone();
+ }
+
+ public void processRow(String[] row) {
+ try {
+ rowNum++;
+ monitor.setTaskName("Processing Row " + rowNum);
+ TaskArtifact taskArt = ((TaskableStateMachineArtifact) sma).createNewTask("");
+
+ monitor.subTask("Validating...");
+ boolean fullRow = false;
+ for (int i = 0; i < row.length; i++) {
+ if (row[i] != null && !row[i].equals("")) {
+ fullRow = true;
+ break;
+ }
+ }
+ if (!fullRow) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, "Empty Row Found => " + rowNum + " skipping...");
+ return;
+ }
+ AtsUtil.setEmailEnabled(false);
+ for (int i = 0; i < row.length; i++) {
+ if (headerRow[i] == null) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, "Null header column => " + i);
+ } else if (headerRow[i].equalsIgnoreCase("Originator")) {
+ String userName = row[i];
+ User u = null;
+ if (userName == null || userName.equals("")) {
+ u = UserManager.getUser();
+ } else {
+ u = UserManager.getUserByName(userName);
+ }
+ if (u == null) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, String.format(
+ "Invalid Originator \"%s\" for row %d\nSetting to current user.", userName, rowNum));
+ }
+ taskArt.getLog().setOriginator(u);
+ } else if (headerRow[i].equalsIgnoreCase("Assignees")) {
+ Set<User> assignees = new HashSet<User>();
+ for (String userName : row[i].split(";")) {
+ userName = userName.replaceAll("^\\s+", "");
+ userName = userName.replaceAll("\\+$", "");
+ User user = null;
+ if (userName == null || userName.equals("")) {
+ user = UserManager.getUser();
+ } else {
+ try {
+ user = UserManager.getUserByName(userName);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ if (user == null) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, String.format(
+ "Invalid Assignee \"%s\" for row %d. Using current user.", userName, rowNum));
+ user = UserManager.getUser();
+ }
+ assignees.add(user);
+ }
+ taskArt.getStateMgr().setAssignees(assignees);
+ } else if (headerRow[i].equalsIgnoreCase("Resolution")) {
+ String str = row[i];
+ if (str != null && !str.equals("")) {
+ taskArt.setSoleAttributeValue(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName(), str);
+ }
+ } else if (headerRow[i].equalsIgnoreCase("Description")) {
+ String str = row[i];
+ if (str != null && !str.equals("")) {
+ taskArt.setSoleAttributeValue(ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName(), str);
+ }
+ } else if (headerRow[i].equalsIgnoreCase("Related to State")) {
+ String str = row[i];
+ if (str != null && !str.equals("")) {
+ taskArt.setSoleAttributeValue(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName(), str);
+ }
+ } else if (headerRow[i].equalsIgnoreCase("Notes")) {
+ String str = row[i];
+ if (str != null && !str.equals("")) {
+ taskArt.setSoleAttributeValue(ATSAttributes.SMA_NOTE_ATTRIBUTE.getStoreName(), str);
+ }
+ } else if (headerRow[i].equalsIgnoreCase("Title")) {
+ String str = row[i];
+ if (str != null && !str.equals("")) {
+ monitor.subTask(String.format("Title \"%s\"", str));
+ taskArt.setName(str);
+ }
+ } else if (headerRow[i].equalsIgnoreCase("Percent Complete")) {
+ String str = row[i];
+ Double percent;
+ if (str != null && !str.equals("")) {
+ try {
+ percent = new Double(str);
+ if (percent < 1) {
+ percent = percent * 100;
+ }
+ } catch (Exception ex) {
+ throw new OseeArgumentException(String.format("Invalid Percent Complete \"%s\" for row %d",
+ str, rowNum));
+ }
+ int percentInt = percent.intValue();
+ sma.getStateMgr().updateMetrics(0, percentInt, true);
+ }
+ } else if (headerRow[i].equalsIgnoreCase("Hours Spent")) {
+ String str = row[i];
+ double hours = 0;
+ if (str != null && !str.equals("")) {
+ try {
+ hours = new Double(str);
+ } catch (Exception ex) {
+ throw new OseeArgumentException(String.format("Invalid Hours Spent \"%s\" for row %d", str,
+ rowNum));
+ }
+ sma.getStateMgr().updateMetrics(hours, sma.getStateMgr().getPercentComplete(), true);
+ }
+ } else if (headerRow[i].equalsIgnoreCase("Estimated Hours")) {
+ String str = row[i];
+ double hours = 0;
+ if (str != null && !str.equals("")) {
+ try {
+ hours = new Double(str);
+ } catch (Exception ex) {
+ throw new OseeArgumentException(String.format("Invalid Estimated Hours \"%s\" for row %d", str,
+ rowNum));
+ }
+ taskArt.setSoleAttributeValue(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName(), hours);
+ }
+ } else {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, "Unhandled column => " + headerRow[i]);
+ }
+ }
+ AtsUtil.setEmailEnabled(true);
+ if (taskArt.isCompleted()) {
+ taskArt.transitionToCompleted(0, transaction, TransitionOption.None);
+ }
+ // always persist
+ taskArt.persist(transaction);
+ if (emailPOCs && !taskArt.isCompleted() && !taskArt.isCancelled()) {
+ AtsNotifyUsers.getInstance().notify(sma, AtsNotifyUsers.NotifyType.Assigned);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/OpenInAtsLoopbackCmd.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/OpenInAtsLoopbackCmd.java
index ba7e65ff146..719df6f504d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/OpenInAtsLoopbackCmd.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/OpenInAtsLoopbackCmd.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.net.HttpURLConnection;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.AtsOpenOption;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.client.server.HttpResponse;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.httpRequests.BaseArtifactLoopbackCmd;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OpenInAtsLoopbackCmd extends BaseArtifactLoopbackCmd {
-
- @Override
- public boolean isApplicable(String cmd) {
- return cmd != null && cmd.equalsIgnoreCase("open.ats");
- }
-
- @Override
- public void process(final Artifact artifact, final Map<String, String> parameters, final HttpResponse httpResponse) {
- if (artifact != null) {
- try {
- boolean hasPermissionToRead = false;
- try {
- hasPermissionToRead = AccessControlManager.hasPermission(artifact, PermissionEnum.READ);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
-
- if (!hasPermissionToRead) {
- httpResponse.outputStandardError(HttpURLConnection.HTTP_UNAUTHORIZED,
- String.format("Access denied - User does not have read access to [%s]", artifact));
- } else {
- final MutableBoolean isDone = new MutableBoolean(false);
- Displays.ensureInDisplayThread(new Runnable() {
-
- @Override
- public void run() {
- try {
- AtsUtil.openATSAction(artifact, AtsOpenOption.OpenOneOrPopupSelect);
- String html =
- AHTML.simplePage("Action [" + artifact.getName() + "]has been opened in OSEE ATS<br><br>" + "<form><input type=button onClick='window.opener=self;window.close()' value='Close'></form>");
- httpResponse.getPrintStream().println(html);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- httpResponse.outputStandardError(HttpURLConnection.HTTP_INTERNAL_ERROR,
- String.format("Unable to open: [%s]", artifact.getName()), ex);
- } finally {
- isDone.setValue(true);
- }
- }
- });
- int count = 1;
- while (!isDone.getValue() && count < 30) {
- try {
- Thread.sleep(350);
- } catch (InterruptedException ex) {
- }
- count++;
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- httpResponse.outputStandardError(HttpURLConnection.HTTP_INTERNAL_ERROR,
- String.format("Unable to open: [%s]", artifact.getName()), ex);
- }
- } else {
- httpResponse.outputStandardError(HttpURLConnection.HTTP_BAD_REQUEST, "Unable to open null 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.ats.util;
+
+import java.net.HttpURLConnection;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.AtsOpenOption;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.client.server.HttpResponse;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.httpRequests.BaseArtifactLoopbackCmd;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OpenInAtsLoopbackCmd extends BaseArtifactLoopbackCmd {
+
+ @Override
+ public boolean isApplicable(String cmd) {
+ return cmd != null && cmd.equalsIgnoreCase("open.ats");
+ }
+
+ @Override
+ public void process(final Artifact artifact, final Map<String, String> parameters, final HttpResponse httpResponse) {
+ if (artifact != null) {
+ try {
+ boolean hasPermissionToRead = false;
+ try {
+ hasPermissionToRead = AccessControlManager.hasPermission(artifact, PermissionEnum.READ);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+
+ if (!hasPermissionToRead) {
+ httpResponse.outputStandardError(HttpURLConnection.HTTP_UNAUTHORIZED,
+ String.format("Access denied - User does not have read access to [%s]", artifact));
+ } else {
+ final MutableBoolean isDone = new MutableBoolean(false);
+ Displays.ensureInDisplayThread(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ AtsUtil.openATSAction(artifact, AtsOpenOption.OpenOneOrPopupSelect);
+ String html =
+ AHTML.simplePage("Action [" + artifact.getName() + "]has been opened in OSEE ATS<br><br>" + "<form><input type=button onClick='window.opener=self;window.close()' value='Close'></form>");
+ httpResponse.getPrintStream().println(html);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ httpResponse.outputStandardError(HttpURLConnection.HTTP_INTERNAL_ERROR,
+ String.format("Unable to open: [%s]", artifact.getName()), ex);
+ } finally {
+ isDone.setValue(true);
+ }
+ }
+ });
+ int count = 1;
+ while (!isDone.getValue() && count < 30) {
+ try {
+ Thread.sleep(350);
+ } catch (InterruptedException ex) {
+ }
+ count++;
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ httpResponse.outputStandardError(HttpURLConnection.HTTP_INTERNAL_ERROR,
+ String.format("Unable to open: [%s]", artifact.getName()), ex);
+ }
+ } else {
+ httpResponse.outputStandardError(HttpURLConnection.HTTP_BAD_REQUEST, "Unable to open null artifact");
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java
index b040589dbcd..cff4e83cbac 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java
@@ -1,319 +1,319 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.ATSArtifact;
-import org.eclipse.osee.ats.artifact.ATSLog;
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.LogItem;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.SMAState;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.AHTML.CellItem;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultBrowserHyperCmd;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-
-public class Overview {
-
- public final static String normalColor = "#EEEEEE";
- private final static String activeColor = "#9CCCFF";
- public final static String errorColor = "#FFD6AC";
- public final static String subscribedColor = "#FFCCAA";
- public final static String labelColor = "darkcyan";
- public static enum PreviewStyle {
- NONE, MAP, TASKS, NOTES, LOG, HYPEROPEN, NO_SUBSCRIBE_OR_FAVORITE;
-
- public static boolean contains(PreviewStyle[] styles, PreviewStyle style) {
- for (PreviewStyle st : styles) {
- if (st.equals(style)) {
- return true;
- }
- }
- return false;
- }
- };
- private StringBuilder html;
- public final static String labelFont = "<font color=\"darkcyan\" face=\"Arial\" size=\"-1\">";
- public final static int TABLE_WIDTH = 95;
- public boolean showTasks = false;
-
- public Overview() {
- clearHtml();
- }
-
- public void clearHtml() {
- html = new StringBuilder(1000);
- }
-
- /**
- * @return HTML page for browser display
- */
- public String getPage() {
- return "<html><body>\n" + html + "\n</body></html>";
- }
-
- /**
- * Return label with value converted to show html reserved characters
- *
- * @param label
- * @param value
- * @return string to embed into html
- */
- public String getLabelValue(String label, String value) {
- String valueStr = AHTML.textToHtml(value);
- return getLabel(label) + valueStr;
- }
-
- /**
- * Return label and value WITHOUT conversion to handle html reserved characters. Value will be as-is
- *
- * @param label
- * @param value
- * @return string to embed into html
- */
- public String getLabelValueNoConvert(String label, String value) {
- return getLabel(label) + value;
- }
-
- public static String getLabel(String label) {
- return AHTML.getLabelStr(labelFont, label + ": ");
- }
-
- public void addTable(String str) {
- addTable(new String[] {str});
- }
-
- public void addTable(String str, String str2) {
- addTable(new String[] {str, str2});
- }
-
- public void addTable(String str, String str2, String str3) {
- addTable(new String[] {str, str2, str3});
- }
-
- public void addTable(String[] strs) {
- addTable(strs, 100);
- }
-
- public void addHtml(String html) {
- this.html.append(html);
- }
-
- public void addTable(String[] strs, int width) {
- if (strs.length == 1) {
- this.html.append(AHTML.simpleTable(strs[0]));
- } else {
- this.html.append(AHTML.multiColumnTable(strs, width));
- }
- }
-
- public void addHeader(StateMachineArtifact sma, PreviewStyle... styles) throws OseeCoreException {
- startBorderTable(100, false, "");
- addTable(getLabelValue("Title", sma.getName()));
- this.html.append(AHTML.multiColumnTable(new String[] {
- AHTML.getLabelStr(labelFont, "State: ") + sma.getStateMgr().getCurrentStateName(),
- AHTML.getLabelStr(labelFont, "Type: ") + sma.getArtifactTypeName(),
- AHTML.getLabelStr(labelFont, "Id: ") + sma.getHumanReadableId()}));
- addTable(getLabelValue("Originator", sma.getOriginator().getName()), getLabelValue("Creation Date",
- XDate.getDateStr(sma.getLog().getCreationDate(), XDate.MMDDYYHHMM)));
- if (sma.isTeamWorkflow()) {
- addTable(getLabelValue("Team", ((TeamWorkFlowArtifact) sma).getTeamName()), getLabelValue("Assignees",
- Artifacts.toString("; ", sma.getStateMgr().getAssignees())));
- } else {
- addTable(getLabelValue("Assignees", Artifacts.toString("; ", sma.getStateMgr().getAssignees())));
- }
- addTable(getLabelValue("Description", sma.getDescription()));
- if (sma.isCancelled()) {
- LogItem item = sma.getLog().getStateEvent(LogType.StateCancelled);
- addTable(getLabelValue("Cancelled From", item.getState()));
- addTable(getLabelValue("Cancellation Reason", item.getMsg()));
- }
- if (sma instanceof TaskArtifact) {
- StateMachineArtifact parentArt = ((TaskArtifact) sma).getParentSMA();
- if (parentArt != null) {
- this.html.append(AHTML.multiColumnTable(new String[] {AHTML.getLabelStr(labelFont, "Parent Workflow: ") + parentArt.getName()}));
- this.html.append(AHTML.multiColumnTable(new String[] {AHTML.getLabelStr(labelFont, "Parent State: ") + ((TaskArtifact) sma).getStateMgr().getCurrentStateName()}));
- }
- this.html.append(AHTML.multiColumnTable(new String[] {AHTML.getLabelStr(labelFont, "Task Owner: ") + Artifacts.toString(
- "; ", sma.getStateMgr().getAssignees())}));
- }
- endBorderTable();
- }
-
- public void addFooter(StateMachineArtifact sma, PreviewStyle... styles) {
- this.html.append(AHTML.newline());
-
- if (PreviewStyle.contains(styles, PreviewStyle.HYPEROPEN)) {
- this.html.append("Start OSEE, select the ATS perspective and search by the Id shown.");
- }
- }
-
- public void addRelationsBlock(ATSArtifact artifact) {
- addRelationTable("Is Superceded By", CoreRelationTypes.Supercedes_Supercedes, artifact);
- addRelationTable("Supercedes", CoreRelationTypes.Supercedes_Superceded, artifact);
- addRelationTable("Supports", CoreRelationTypes.SupportingInfo_SupportedBy, artifact);
- addRelationTable("Is Supported By", CoreRelationTypes.SupportingInfo_SupportingInfo, artifact);
- }
-
- public void addNotes(Artifact artifact) {
- if (artifact instanceof StateMachineArtifact) {
- String notesHtml = ((StateMachineArtifact) artifact).getNotes().getTable(null);
- if (notesHtml.equals("")) {
- return;
- }
- this.html.append(notesHtml);
- }
- }
-
- public static String getGenericArtifactTable(String name, Collection<Artifact> arts) {
- return getGenericArtifactTable(name, arts, 100);
- }
-
- public static String getGenericArtifactTable(String name, Collection<Artifact> arts, int width) {
- StringBuilder builder = new StringBuilder();
- builder.append(AHTML.addSpace(1) + Overview.getLabel(name));
- if (arts.size() > 0) {
- builder.append("<TABLE BORDER=\"1\" align=\"center\" cellspacing=\"1\" cellpadding=\"3%\" width=\"" + width + "%\"><THEAD><TR><TH>Type</TH>" + "<TH>Name</TH></THEAD></TR>");
- for (Artifact art : arts) {
- builder.append("<TR>");
- builder.append("<TD>" + art.getArtifactTypeName() + "</TD>");
- builder.append("<TD>" + Overview.getOpenHyperlinkHtml(art) + "</TD>");
- builder.append("</TR>");
- }
- builder.append("</TABLE>");
- }
- return builder.toString();
- }
-
- @SuppressWarnings("deprecation")
- public void addRelationTable(String name, IRelationEnumeration side, Artifact parent) {
- try {
- List<Artifact> arts = parent.getRelatedArtifacts(side);
- if (arts.isEmpty()) {
- return;
- }
- startBorderTable(false, name);
- html.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "Name", "Rationale"}));
- for (Artifact art : arts) {
- String rationale = "";
- RelationLink link = parent.getRelations(side, art).iterator().next();
- if (!link.getRationale().equals("")) {
- rationale = link.getRationale();
- }
- String hyperStr = Overview.getOpenHyperlinkHtml(art);
- html.append(AHTML.addRowMultiColumnTable(new String[] {art.getArtifactTypeName(), hyperStr, rationale}));
- }
- endBorderTable();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public void addTeams(Collection<TeamWorkFlowArtifact> teams) throws OseeCoreException {
- startBorderTable(TABLE_WIDTH, false, "Team Workflows");
- String s = AHTML.beginMultiColumnTable(100, 1);
- s += AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "State"}, new Integer[] {70, 150});
- ArrayList<CellItem> cells = new ArrayList<CellItem>();
- for (TeamWorkFlowArtifact team : teams) {
- cells.add(new AHTML.CellItem(team.getHyperlinkHtml()));
- cells.add(new AHTML.CellItem(team.getStateMgr().getCurrentStateName()));
- s += AHTML.addRowMultiColumnTable(cells);
- cells.clear();
- }
- s += AHTML.endMultiColumnTable();
- html.append(s);
-
- endBorderTable();
- }
-
- public static String getOpenHyperlinkHtml(Artifact art) {
- return getOpenHyperlinkHtml(art.getName(), art);
- }
-
- public static String getOpenHyperlinkHtml(String name, String hrid) {
- return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openAction, hrid), name);
- }
-
- public static String getOpenArtEditHyperlinkHtml(String name, String hrid) {
- return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openArtifactEditor, hrid),
- name);
- }
-
- public static String getOpenHyperlinkHtml(String name, String guidOrHrid, int branchId) {
- return XResultData.getHyperlink(name, guidOrHrid, branchId);
- }
-
- public static String getOpenHyperlinkHtml(String name, Artifact art) {
- return AHTML.getHyperlink(
- XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openAction, art.getGuid()), name);
- }
-
- public void addLog(StateMachineArtifact artifact) throws OseeCoreException {
- ATSLog artifactLog = artifact.getLog();
- if (artifactLog != null && artifactLog.getLogItems().size() > 0) {
- addTable(artifact.getLog().getTable());
- }
- }
-
- public void startStateBorderTable(StateMachineArtifact sma, SMAState state) throws OseeCoreException {
- String caption = state.getName();
- String assgn = Artifacts.toString("; ", state.getAssignees());
- startStateBorderTable(sma.getStateMgr().getCurrentStateName().equals(state.getName()), caption, assgn);
- }
-
- public void startStateBorderTable(boolean active, String name, String assignee) {
- if (assignee != null && !assignee.equals("")) {
- startBorderTable(active, String.format("%s (%s)", name, assignee));
- } else {
- startBorderTable(active, String.format("%s", name));
- }
- }
-
- public void startBorderTable(boolean active, String caption) {
- this.html.append(AHTML.startBorderTable(TABLE_WIDTH, active ? activeColor : normalColor, caption));
- }
-
- public void startBorderTable(int width, boolean active, String caption) {
- this.html.append(AHTML.startBorderTable(width, active ? activeColor : normalColor, caption));
- }
-
- public void startBorderTable(int width, String caption, String backgroundColor) {
- this.html.append(AHTML.startBorderTable(width, backgroundColor, caption));
- }
-
- public void endBorderTable() {
- this.html.append(AHTML.endBorderTable());
- }
-
- public boolean isShowTasks() {
- return showTasks;
- }
-
- public void setShowTasks(boolean showTasks) {
- this.showTasks = showTasks;
- }
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.ATSArtifact;
+import org.eclipse.osee.ats.artifact.ATSLog;
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.LogItem;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.SMAState;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.AHTML.CellItem;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultBrowserHyperCmd;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+
+public class Overview {
+
+ public final static String normalColor = "#EEEEEE";
+ private final static String activeColor = "#9CCCFF";
+ public final static String errorColor = "#FFD6AC";
+ public final static String subscribedColor = "#FFCCAA";
+ public final static String labelColor = "darkcyan";
+ public static enum PreviewStyle {
+ NONE, MAP, TASKS, NOTES, LOG, HYPEROPEN, NO_SUBSCRIBE_OR_FAVORITE;
+
+ public static boolean contains(PreviewStyle[] styles, PreviewStyle style) {
+ for (PreviewStyle st : styles) {
+ if (st.equals(style)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ private StringBuilder html;
+ public final static String labelFont = "<font color=\"darkcyan\" face=\"Arial\" size=\"-1\">";
+ public final static int TABLE_WIDTH = 95;
+ public boolean showTasks = false;
+
+ public Overview() {
+ clearHtml();
+ }
+
+ public void clearHtml() {
+ html = new StringBuilder(1000);
+ }
+
+ /**
+ * @return HTML page for browser display
+ */
+ public String getPage() {
+ return "<html><body>\n" + html + "\n</body></html>";
+ }
+
+ /**
+ * Return label with value converted to show html reserved characters
+ *
+ * @param label
+ * @param value
+ * @return string to embed into html
+ */
+ public String getLabelValue(String label, String value) {
+ String valueStr = AHTML.textToHtml(value);
+ return getLabel(label) + valueStr;
+ }
+
+ /**
+ * Return label and value WITHOUT conversion to handle html reserved characters. Value will be as-is
+ *
+ * @param label
+ * @param value
+ * @return string to embed into html
+ */
+ public String getLabelValueNoConvert(String label, String value) {
+ return getLabel(label) + value;
+ }
+
+ public static String getLabel(String label) {
+ return AHTML.getLabelStr(labelFont, label + ": ");
+ }
+
+ public void addTable(String str) {
+ addTable(new String[] {str});
+ }
+
+ public void addTable(String str, String str2) {
+ addTable(new String[] {str, str2});
+ }
+
+ public void addTable(String str, String str2, String str3) {
+ addTable(new String[] {str, str2, str3});
+ }
+
+ public void addTable(String[] strs) {
+ addTable(strs, 100);
+ }
+
+ public void addHtml(String html) {
+ this.html.append(html);
+ }
+
+ public void addTable(String[] strs, int width) {
+ if (strs.length == 1) {
+ this.html.append(AHTML.simpleTable(strs[0]));
+ } else {
+ this.html.append(AHTML.multiColumnTable(strs, width));
+ }
+ }
+
+ public void addHeader(StateMachineArtifact sma, PreviewStyle... styles) throws OseeCoreException {
+ startBorderTable(100, false, "");
+ addTable(getLabelValue("Title", sma.getName()));
+ this.html.append(AHTML.multiColumnTable(new String[] {
+ AHTML.getLabelStr(labelFont, "State: ") + sma.getStateMgr().getCurrentStateName(),
+ AHTML.getLabelStr(labelFont, "Type: ") + sma.getArtifactTypeName(),
+ AHTML.getLabelStr(labelFont, "Id: ") + sma.getHumanReadableId()}));
+ addTable(getLabelValue("Originator", sma.getOriginator().getName()), getLabelValue("Creation Date",
+ XDate.getDateStr(sma.getLog().getCreationDate(), XDate.MMDDYYHHMM)));
+ if (sma.isTeamWorkflow()) {
+ addTable(getLabelValue("Team", ((TeamWorkFlowArtifact) sma).getTeamName()), getLabelValue("Assignees",
+ Artifacts.toString("; ", sma.getStateMgr().getAssignees())));
+ } else {
+ addTable(getLabelValue("Assignees", Artifacts.toString("; ", sma.getStateMgr().getAssignees())));
+ }
+ addTable(getLabelValue("Description", sma.getDescription()));
+ if (sma.isCancelled()) {
+ LogItem item = sma.getLog().getStateEvent(LogType.StateCancelled);
+ addTable(getLabelValue("Cancelled From", item.getState()));
+ addTable(getLabelValue("Cancellation Reason", item.getMsg()));
+ }
+ if (sma instanceof TaskArtifact) {
+ StateMachineArtifact parentArt = ((TaskArtifact) sma).getParentSMA();
+ if (parentArt != null) {
+ this.html.append(AHTML.multiColumnTable(new String[] {AHTML.getLabelStr(labelFont, "Parent Workflow: ") + parentArt.getName()}));
+ this.html.append(AHTML.multiColumnTable(new String[] {AHTML.getLabelStr(labelFont, "Parent State: ") + ((TaskArtifact) sma).getStateMgr().getCurrentStateName()}));
+ }
+ this.html.append(AHTML.multiColumnTable(new String[] {AHTML.getLabelStr(labelFont, "Task Owner: ") + Artifacts.toString(
+ "; ", sma.getStateMgr().getAssignees())}));
+ }
+ endBorderTable();
+ }
+
+ public void addFooter(StateMachineArtifact sma, PreviewStyle... styles) {
+ this.html.append(AHTML.newline());
+
+ if (PreviewStyle.contains(styles, PreviewStyle.HYPEROPEN)) {
+ this.html.append("Start OSEE, select the ATS perspective and search by the Id shown.");
+ }
+ }
+
+ public void addRelationsBlock(ATSArtifact artifact) {
+ addRelationTable("Is Superceded By", CoreRelationTypes.Supercedes_Supercedes, artifact);
+ addRelationTable("Supercedes", CoreRelationTypes.Supercedes_Superceded, artifact);
+ addRelationTable("Supports", CoreRelationTypes.SupportingInfo_SupportedBy, artifact);
+ addRelationTable("Is Supported By", CoreRelationTypes.SupportingInfo_SupportingInfo, artifact);
+ }
+
+ public void addNotes(Artifact artifact) {
+ if (artifact instanceof StateMachineArtifact) {
+ String notesHtml = ((StateMachineArtifact) artifact).getNotes().getTable(null);
+ if (notesHtml.equals("")) {
+ return;
+ }
+ this.html.append(notesHtml);
+ }
+ }
+
+ public static String getGenericArtifactTable(String name, Collection<Artifact> arts) {
+ return getGenericArtifactTable(name, arts, 100);
+ }
+
+ public static String getGenericArtifactTable(String name, Collection<Artifact> arts, int width) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(AHTML.addSpace(1) + Overview.getLabel(name));
+ if (arts.size() > 0) {
+ builder.append("<TABLE BORDER=\"1\" align=\"center\" cellspacing=\"1\" cellpadding=\"3%\" width=\"" + width + "%\"><THEAD><TR><TH>Type</TH>" + "<TH>Name</TH></THEAD></TR>");
+ for (Artifact art : arts) {
+ builder.append("<TR>");
+ builder.append("<TD>" + art.getArtifactTypeName() + "</TD>");
+ builder.append("<TD>" + Overview.getOpenHyperlinkHtml(art) + "</TD>");
+ builder.append("</TR>");
+ }
+ builder.append("</TABLE>");
+ }
+ return builder.toString();
+ }
+
+ @SuppressWarnings("deprecation")
+ public void addRelationTable(String name, IRelationEnumeration side, Artifact parent) {
+ try {
+ List<Artifact> arts = parent.getRelatedArtifacts(side);
+ if (arts.isEmpty()) {
+ return;
+ }
+ startBorderTable(false, name);
+ html.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "Name", "Rationale"}));
+ for (Artifact art : arts) {
+ String rationale = "";
+ RelationLink link = parent.getRelations(side, art).iterator().next();
+ if (!link.getRationale().equals("")) {
+ rationale = link.getRationale();
+ }
+ String hyperStr = Overview.getOpenHyperlinkHtml(art);
+ html.append(AHTML.addRowMultiColumnTable(new String[] {art.getArtifactTypeName(), hyperStr, rationale}));
+ }
+ endBorderTable();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public void addTeams(Collection<TeamWorkFlowArtifact> teams) throws OseeCoreException {
+ startBorderTable(TABLE_WIDTH, false, "Team Workflows");
+ String s = AHTML.beginMultiColumnTable(100, 1);
+ s += AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "State"}, new Integer[] {70, 150});
+ ArrayList<CellItem> cells = new ArrayList<CellItem>();
+ for (TeamWorkFlowArtifact team : teams) {
+ cells.add(new AHTML.CellItem(team.getHyperlinkHtml()));
+ cells.add(new AHTML.CellItem(team.getStateMgr().getCurrentStateName()));
+ s += AHTML.addRowMultiColumnTable(cells);
+ cells.clear();
+ }
+ s += AHTML.endMultiColumnTable();
+ html.append(s);
+
+ endBorderTable();
+ }
+
+ public static String getOpenHyperlinkHtml(Artifact art) {
+ return getOpenHyperlinkHtml(art.getName(), art);
+ }
+
+ public static String getOpenHyperlinkHtml(String name, String hrid) {
+ return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openAction, hrid), name);
+ }
+
+ public static String getOpenArtEditHyperlinkHtml(String name, String hrid) {
+ return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openArtifactEditor, hrid),
+ name);
+ }
+
+ public static String getOpenHyperlinkHtml(String name, String guidOrHrid, int branchId) {
+ return XResultData.getHyperlink(name, guidOrHrid, branchId);
+ }
+
+ public static String getOpenHyperlinkHtml(String name, Artifact art) {
+ return AHTML.getHyperlink(
+ XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openAction, art.getGuid()), name);
+ }
+
+ public void addLog(StateMachineArtifact artifact) throws OseeCoreException {
+ ATSLog artifactLog = artifact.getLog();
+ if (artifactLog != null && artifactLog.getLogItems().size() > 0) {
+ addTable(artifact.getLog().getTable());
+ }
+ }
+
+ public void startStateBorderTable(StateMachineArtifact sma, SMAState state) throws OseeCoreException {
+ String caption = state.getName();
+ String assgn = Artifacts.toString("; ", state.getAssignees());
+ startStateBorderTable(sma.getStateMgr().getCurrentStateName().equals(state.getName()), caption, assgn);
+ }
+
+ public void startStateBorderTable(boolean active, String name, String assignee) {
+ if (assignee != null && !assignee.equals("")) {
+ startBorderTable(active, String.format("%s (%s)", name, assignee));
+ } else {
+ startBorderTable(active, String.format("%s", name));
+ }
+ }
+
+ public void startBorderTable(boolean active, String caption) {
+ this.html.append(AHTML.startBorderTable(TABLE_WIDTH, active ? activeColor : normalColor, caption));
+ }
+
+ public void startBorderTable(int width, boolean active, String caption) {
+ this.html.append(AHTML.startBorderTable(width, active ? activeColor : normalColor, caption));
+ }
+
+ public void startBorderTable(int width, String caption, String backgroundColor) {
+ this.html.append(AHTML.startBorderTable(width, backgroundColor, caption));
+ }
+
+ public void endBorderTable() {
+ this.html.append(AHTML.endBorderTable());
+ }
+
+ public boolean isShowTasks() {
+ return showTasks;
+ }
+
+ public void setShowTasks(boolean showTasks) {
+ this.showTasks = showTasks;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/PromptChangeUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/PromptChangeUtil.java
index 0c49279917f..d1c3cb4d2f8 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/PromptChangeUtil.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/PromptChangeUtil.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.util;
-
+package org.eclipse.osee.ats.util;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -47,479 +47,479 @@ import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserCheckTreeDialog;
import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserGroupsCheckTreeDialog;
import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserListDialog;
import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Donald G. Dunne
- */
-public class PromptChangeUtil {
-
- public static boolean promptChangeGroups(StateMachineArtifact sma, boolean persist) throws OseeCoreException {
- return promptChangeGroups(Arrays.asList(sma), persist);
- }
-
- public static boolean promptChangeGroups(final Collection<? extends StateMachineArtifact> smas, boolean persist) throws OseeCoreException {
- Set<Artifact> selected = new HashSet<Artifact>();
- for (StateMachineArtifact sma : smas) {
- selected.addAll(sma.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Group));
- }
- Collection<Artifact> allGroups = UniversalGroup.getGroupsNotRoot(AtsUtil.getAtsBranch());
- UserGroupsCheckTreeDialog dialog = new UserGroupsCheckTreeDialog(allGroups);
- dialog.setTitle("Select Groups");
- dialog.setInitialSelections(selected.toArray());
- if (dialog.open() == 0) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Set Groups");
- for (StateMachineArtifact sma : smas) {
- sma.setRelations(CoreRelationTypes.Universal_Grouping__Group, dialog.getSelection());
- sma.persist(transaction);
- }
- transaction.execute();
- return true;
- }
- return false;
- }
-
- public static boolean promptChangeGoals(Artifact sma, boolean persist) throws OseeCoreException {
- return promptChangeGoals(Arrays.asList(sma), persist);
- }
-
- public static boolean promptChangeGoals(final Collection<? extends Artifact> smas, boolean persist) throws OseeCoreException {
- Set<Artifact> selected = new HashSet<Artifact>();
- for (Artifact sma : smas) {
- selected.addAll(sma.getRelatedArtifacts(AtsRelationTypes.Goal_Goal));
- }
- Collection<Artifact> allGoals =
- (new GoalSearchItem("", new ArrayList<TeamDefinitionArtifact>(), false, null)).performSearchGetResults();
- ArtifactCheckTreeDialog dialog = new ArtifactCheckTreeDialog(allGoals);
- dialog.setTitle("Select Goals");
- dialog.setInitialSelections(selected.toArray());
- if (dialog.open() == 0) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Set Goals");
- for (Artifact sma : smas) {
- sma.setRelations(AtsRelationTypes.Goal_Goal, dialog.getSelection());
- sma.persist(transaction);
- }
- transaction.execute();
- return true;
- }
- return false;
- }
-
- public static boolean promptChangeAssignees(StateMachineArtifact sma, boolean persist) throws OseeCoreException {
- return promptChangeAssignees(Arrays.asList(sma), persist);
- }
-
- public static boolean promptChangeAssignees(final Collection<? extends StateMachineArtifact> smas, boolean persist) throws OseeCoreException {
- for (StateMachineArtifact sma : smas) {
- if (sma.isCompleted()) {
- AWorkbench.popup("ERROR",
- "Can't assign completed " + sma.getArtifactTypeName() + " (" + sma.getHumanReadableId() + ")");
- return false;
- } else if (sma.isCancelled()) {
- AWorkbench.popup("ERROR",
- "Can't assign cancelled " + sma.getArtifactTypeName() + " (" + sma.getHumanReadableId() + ")");
- return false;
- }
- }
- UserCheckTreeDialog uld = new UserCheckTreeDialog();
- uld.setMessage("Select to assign.\nDeSelect to un-assign.");
- if (smas.iterator().next().getParentTeamWorkflow() != null) {
- uld.setTeamMembers(smas.iterator().next().getParentTeamWorkflow().getTeamDefinition().getMembersAndLeads());
- }
-
- if (smas.size() == 1) {
- uld.setInitialSelections(smas.iterator().next().getStateMgr().getAssignees());
- }
- if (uld.open() != 0) {
- return false;
- }
- Collection<User> users = uld.getUsersSelected();
- if (users.isEmpty()) {
- AWorkbench.popup("ERROR", "Must have at least one assignee");
- return false;
- }
- // As a convenience, remove the UnAssigned user if another user is selected
- if (users.size() > 1) {
- users.remove(UserManager.getUser(SystemUser.UnAssigned));
- }
- for (StateMachineArtifact sma : smas) {
- sma.getStateMgr().setAssignees(users);
- }
- if (persist) {
- Artifacts.persistInTransaction(smas);
- }
- return true;
- }
-
- public static boolean promptChangeOriginator(StateMachineArtifact sma) throws OseeCoreException {
- return promptChangeOriginator(Arrays.asList(sma));
- }
-
- public static boolean promptChangeOriginator(final Collection<? extends StateMachineArtifact> smas) throws OseeCoreException {
- UserListDialog ld = new UserListDialog(Displays.getActiveShell(), "Select New Originator");
- int result = ld.open();
- if (result == 0) {
- User selectedUser = ld.getSelection();
- for (StateMachineArtifact sma : smas) {
- sma.setOriginator(selectedUser);
- }
- return true;
- }
- return false;
- }
-
- public static boolean promptChangeVersion(StateMachineArtifact sma, VersionReleaseType versionReleaseType, boolean persist) throws OseeCoreException {
- if (AtsUtil.isAtsAdmin() && !sma.isTeamWorkflow()) {
- AWorkbench.popup("ERROR ", "Cannot set version for: \n\n" + sma.getName());
- return false;
- }
- return promptChangeVersion(Arrays.asList((TeamWorkFlowArtifact) sma), versionReleaseType, persist);
- }
-
- public static boolean promptChangeVersion(final Collection<? extends TeamWorkFlowArtifact> smas, VersionReleaseType versionReleaseType, final boolean persist) throws OseeCoreException {
- TeamDefinitionArtifact teamDefHoldingVersions = null;
- for (TeamWorkFlowArtifact teamArt : smas) {
- if (!teamArt.getTeamDefinition().isTeamUsesVersions()) {
- AWorkbench.popup("ERROR", "Team \"" + teamArt.getTeamDefinition().getName() + "\" doesn't use versions.");
- return false;
- }
- if (teamArt.isReleased() || teamArt.isVersionLocked()) {
- String error =
- "Team Workflow\n \"" + teamArt.getName() + "\"\n targeted version is locked or already released.";
- if (AtsUtil.isAtsAdmin() && !MessageDialog.openConfirm(Displays.getActiveShell(),
- "Change Version", error + "\n\nOverride?")) {
- return false;
- } else if (!AtsUtil.isAtsAdmin()) {
- AWorkbench.popup("ERROR", error);
- }
- }
- if (teamDefHoldingVersions != null) {
- if (teamDefHoldingVersions != teamArt.getTeamDefinition().getTeamDefinitionHoldingVersions()) {
- AWorkbench.popup("ERROR", "Can't change version on Workflows that have different release version sets.");
- return false;
- }
- }
- if (teamDefHoldingVersions == null) {
- teamDefHoldingVersions = teamArt.getTeamDefinition().getTeamDefinitionHoldingVersions();
- }
- }
- if (teamDefHoldingVersions == null) {
- AWorkbench.popup("ERROR", "No versions configured for impacted team(s).");
- return false;
- }
- final VersionListDialog vld =
- new VersionListDialog("Select Version", "Select Version",
- teamDefHoldingVersions.getVersionsArtifacts(versionReleaseType));
- if (smas.size() == 1 && smas.iterator().next().getWorldViewTargetedVersion() != null) {
- Object[] objs = new Object[1];
- objs[0] = smas.iterator().next().getWorldViewTargetedVersion();
- vld.setInitialSelections(objs);
- }
- int result = vld.open();
- if (result != 0) {
- return false;
- }
- Object obj = vld.getResult()[0];
- VersionArtifact newVersion = (VersionArtifact) obj;
- //now check selected version
- if (newVersion.isVersionLocked()) {
- String error = "Version \"" + newVersion.getFullDisplayName() + "\" is locked or already released.";
- if (AtsUtil.isAtsAdmin() && !MessageDialog.openConfirm(Displays.getActiveShell(),
- "Change Version", error + "\n\nOverride?")) {
- return false;
- } else if (!AtsUtil.isAtsAdmin()) {
- AWorkbench.popup("ERROR", error);
- }
- }
-
- for (TeamWorkFlowArtifact teamArt : smas) {
- teamArt.setRelations(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version,
- java.util.Collections.singleton(newVersion));
- }
- if (persist) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Prompt Change Version");
- for (TeamWorkFlowArtifact teamArt : smas) {
- teamArt.persist(transaction);
- }
- transaction.execute();
- }
- return true;
- }
-
- public static boolean promptChangeType(StateMachineArtifact sma, boolean persist) throws OseeStateException {
- if (sma.isTeamWorkflow()) {
- return promptChangeType(Arrays.asList((TeamWorkFlowArtifact) sma), persist);
- }
- return false;
- }
-
- public static boolean promptChangeType(final Collection<? extends TeamWorkFlowArtifact> teams, boolean persist) throws OseeStateException {
-
- for (TeamWorkFlowArtifact team : teams) {
- if (team.isReleased() || team.isVersionLocked()) {
- AWorkbench.popup("ERROR",
- "Team Workflow\n \"" + team.getName() + "\"\n version is locked or already released.");
- return false;
- }
- }
- final ChangeTypeDialog dialog = new ChangeTypeDialog(Displays.getActiveShell());
- try {
- if (teams.size() == 1) {
- dialog.setSelected(teams.iterator().next().getChangeType());
- }
- if (dialog.open() == 0) {
-
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Prompt Change Type");
-
- for (TeamWorkFlowArtifact team : teams) {
- if (team.getChangeType() != dialog.getSelection()) {
- team.setChangeType(dialog.getSelection());
- team.saveSMA(transaction);
- }
- }
- transaction.execute();
- }
- return true;
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't change priority", ex);
- return false;
- }
- }
-
- public static boolean promptChangePoints(StateMachineArtifact sma, boolean persist) throws OseeStateException {
- if (sma.isTeamWorkflow()) {
- return promptChangePoints(Arrays.asList((TeamWorkFlowArtifact) sma), persist);
- }
- return false;
- }
-
- public static boolean promptChangePoints(final Collection<? extends TeamWorkFlowArtifact> teams, boolean persist) throws OseeStateException {
-
- final ChangePointDialog dialog = new ChangePointDialog(Displays.getActiveShell());
- try {
- if (teams.size() == 1) {
- dialog.setSelected(teams.iterator().next().getWorldViewPoint());
- }
- if (dialog.open() == 0) {
-
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Prompt Change Points");
-
- for (TeamWorkFlowArtifact team : teams) {
- if (dialog.isClearSelected() || !team.getWorldViewPoint().equals(dialog.getSelection())) {
- if (dialog.isClearSelected()) {
- team.deleteAttributes(ATSAttributes.POINTS_ATTRIBUTE.getStoreName());
- } else {
- team.setSoleAttributeFromString(ATSAttributes.POINTS_ATTRIBUTE.getStoreName(),
- dialog.getSelection());
- }
- team.saveSMA(transaction);
- }
- }
- transaction.execute();
- }
- return true;
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't change points", ex);
- return false;
- }
- }
-
- public static boolean promptChangePriority(StateMachineArtifact sma, boolean persist) throws OseeStateException {
- if (sma.isTeamWorkflow()) {
- return promptChangePriority(Arrays.asList((TeamWorkFlowArtifact) sma), persist);
- }
- return false;
- }
-
- public static boolean promptChangePriority(final Collection<? extends TeamWorkFlowArtifact> teams, boolean persist) {
-
- for (TeamWorkFlowArtifact team : teams) {
- if (team.isReleased() || team.isVersionLocked()) {
- AWorkbench.popup("ERROR",
- "Team Workflow\n \"" + team.getName() + "\"\n version is locked or already released.");
- return false;
- }
- }
- final AtsPriorityDialog ald = new AtsPriorityDialog(Displays.getActiveShell());
- try {
- if (teams.size() == 1) {
- ald.setSelected(teams.iterator().next().getPriority());
- }
- if (ald.open() == 0) {
-
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Prompt Change Priority");
- for (TeamWorkFlowArtifact team : teams) {
- if (team.getPriority() != ald.getSelection()) {
- team.setPriority(ald.getSelection());
- team.saveSMA(transaction);
- }
- }
- transaction.execute();
- }
- return true;
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't change priority", ex);
- return false;
- }
- }
-
- public static boolean promptChangeFloatAttribute(StateMachineArtifact sma, ATSAttributes atsAttr, boolean persist) {
- try {
- return ArtifactPromptChange.promptChangeFloatAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
- Arrays.asList(sma), persist);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public static boolean promptChangeIntegerAttribute(StateMachineArtifact sma, ATSAttributes atsAttr, boolean persist) {
- try {
- return ArtifactPromptChange.promptChangeIntegerAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
- Arrays.asList(sma), persist);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public static boolean promptChangePercentAttribute(StateMachineArtifact sma, ATSAttributes atsAttr, boolean persist) {
- try {
- return ArtifactPromptChange.promptChangePercentAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
- Arrays.asList(new Artifact[] {sma}), persist);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public static boolean promptChangeBoolean(StateMachineArtifact sma, ATSAttributes atsAttr, String toggleMessage, boolean persist) {
- try {
- return ArtifactPromptChange.promptChangeBoolean(atsAttr.getStoreName(), atsAttr.getDisplayName(),
- Arrays.asList(sma), toggleMessage, persist);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public static boolean promptChangeAttribute(final Collection<? extends StateMachineArtifact> smas, ATSAttributes atsAttr, boolean persist, boolean multiLine) throws OseeCoreException {
- return ArtifactPromptChange.promptChangeStringAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(), smas,
- persist, multiLine);
- }
-
- public static boolean promptChangeAttribute(final Artifact sma, ATSAttributes atsAttr, boolean persist, boolean multiLine) {
- try {
- return ArtifactPromptChange.promptChangeStringAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
- Arrays.asList(new Artifact[] {sma}), persist, multiLine);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public static boolean promptChangeAttribute(StateMachineArtifact sma, ATSAttributes atsAttr, final boolean persist, boolean multiLine) {
- try {
- return ArtifactPromptChange.promptChangeStringAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
- Arrays.asList(sma), persist, multiLine);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public static boolean promptChangeDate(StateMachineArtifact sma, ATSAttributes atsAttr, boolean persist) throws OseeStateException {
- try {
- return ArtifactPromptChange.promptChangeDate(atsAttr.getStoreName(), atsAttr.getDisplayName(), sma, persist);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP,
- "Can't save " + atsAttr.getDisplayName() + " date to artifact " + sma.getHumanReadableId(), ex);
- }
- return false;
- }
-
- public static boolean promptChangeReleaseDate(StateMachineArtifact sma) throws OseeStateException {
- if (sma.isReleased() || sma.isVersionLocked()) {
- AWorkbench.popup("ERROR", "Team Workflow\n \"" + sma.getName() + "\"\n version is locked or already released.");
- return false;
- }
- try {
- VersionArtifact verArt = sma.getTargetedForVersion();
- if (verArt != null) {
- // prompt that this object is assigned to a version that is targeted
- // for release xxx - want to change?
- DateSelectionDialog diag =
- new DateSelectionDialog(
- "Select Release Date Date",
- "Warning: " + sma.getArtifactTypeName() + "'s release date is handled\n" + "by targeted for version \"" + verArt.getName() + "\"\n" + "changing the date here will change the\n" + "date for this entire release.\n\nSelect date to change.\n",
- verArt.getReleaseDate());
- if (verArt.getReleaseDate() != null) {
- diag.setSelectedDate(verArt.getReleaseDate());
- }
- if (diag.open() == 0) {
- verArt.setSoleAttributeValue(ATSAttributes.RELEASE_DATE_ATTRIBUTE.getStoreName(), diag.getSelectedDate());
- verArt.persist();
- return true;
- }
- } else {
- // prompt that current release is (get from attribute) - want to change?
- DateSelectionDialog diag =
- new DateSelectionDialog("Select Release Date", "Select Release Date", sma.getWorldViewReleaseDate());
- if (sma.getWorldViewReleaseDate() != null) {
- diag.setSelectedDate(sma.getWorldViewReleaseDate());
- }
- if (diag.open() == 0) {
- sma.setSoleAttributeValue(ATSAttributes.RELEASE_DATE_ATTRIBUTE.getStoreName(), diag.getSelectedDate());
- sma.persist();
- return true;
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't save release date " + sma.getHumanReadableId(), ex);
- }
- return false;
- }
-
- public static boolean promptChangeEstimatedReleaseDate(StateMachineArtifact sma) throws OseeStateException {
- try {
- VersionArtifact verArt = sma.getTargetedForVersion();
- if (verArt != null) {
- // prompt that this object is assigned to a version that is targeted for release xxx -
- // want to change?
- DateSelectionDialog diag =
- new DateSelectionDialog(
- "Select Estimated Release Date Date",
- "Warning: " + sma.getArtifactTypeName() + "'s estimated release date is handled\n" + "by targeted for version \"" + verArt.getName() + "\"\n" + "changing the date here will change the\n" + "date for this entire release.\n\nSelect date to change.\n",
- verArt.getEstimatedReleaseDate());
- if (verArt.getEstimatedReleaseDate() != null) {
- diag.setSelectedDate(verArt.getEstimatedReleaseDate());
- }
- if (diag.open() == 0) {
- verArt.setSoleAttributeValue(ATSAttributes.ESTIMATED_RELEASE_DATE_ATTRIBUTE.getStoreName(),
- diag.getSelectedDate());
- verArt.persist();
- return true;
- }
- } else {
- // prompt that current est release is (get from attribute); want to
- // change
- DateSelectionDialog diag =
- new DateSelectionDialog("Select Estimate Release Date", "Select Estimated Release Date",
- sma.getWorldViewEstimatedReleaseDate());
- if (sma.getWorldViewEstimatedReleaseDate() != null) {
- diag.setSelectedDate(sma.getWorldViewEstimatedReleaseDate());
- }
- if (diag.open() == 0) {
- sma.setSoleAttributeValue(ATSAttributes.ESTIMATED_RELEASE_DATE_ATTRIBUTE.getStoreName(),
- diag.getSelectedDate());
- sma.persist();
- return true;
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP,
- "Can't save est release date " + sma.getHumanReadableId(), ex);
- }
- return false;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class PromptChangeUtil {
+
+ public static boolean promptChangeGroups(StateMachineArtifact sma, boolean persist) throws OseeCoreException {
+ return promptChangeGroups(Arrays.asList(sma), persist);
+ }
+
+ public static boolean promptChangeGroups(final Collection<? extends StateMachineArtifact> smas, boolean persist) throws OseeCoreException {
+ Set<Artifact> selected = new HashSet<Artifact>();
+ for (StateMachineArtifact sma : smas) {
+ selected.addAll(sma.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Group));
+ }
+ Collection<Artifact> allGroups = UniversalGroup.getGroupsNotRoot(AtsUtil.getAtsBranch());
+ UserGroupsCheckTreeDialog dialog = new UserGroupsCheckTreeDialog(allGroups);
+ dialog.setTitle("Select Groups");
+ dialog.setInitialSelections(selected.toArray());
+ if (dialog.open() == 0) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Set Groups");
+ for (StateMachineArtifact sma : smas) {
+ sma.setRelations(CoreRelationTypes.Universal_Grouping__Group, dialog.getSelection());
+ sma.persist(transaction);
+ }
+ transaction.execute();
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean promptChangeGoals(Artifact sma, boolean persist) throws OseeCoreException {
+ return promptChangeGoals(Arrays.asList(sma), persist);
+ }
+
+ public static boolean promptChangeGoals(final Collection<? extends Artifact> smas, boolean persist) throws OseeCoreException {
+ Set<Artifact> selected = new HashSet<Artifact>();
+ for (Artifact sma : smas) {
+ selected.addAll(sma.getRelatedArtifacts(AtsRelationTypes.Goal_Goal));
+ }
+ Collection<Artifact> allGoals =
+ (new GoalSearchItem("", new ArrayList<TeamDefinitionArtifact>(), false, null)).performSearchGetResults();
+ ArtifactCheckTreeDialog dialog = new ArtifactCheckTreeDialog(allGoals);
+ dialog.setTitle("Select Goals");
+ dialog.setInitialSelections(selected.toArray());
+ if (dialog.open() == 0) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Set Goals");
+ for (Artifact sma : smas) {
+ sma.setRelations(AtsRelationTypes.Goal_Goal, dialog.getSelection());
+ sma.persist(transaction);
+ }
+ transaction.execute();
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean promptChangeAssignees(StateMachineArtifact sma, boolean persist) throws OseeCoreException {
+ return promptChangeAssignees(Arrays.asList(sma), persist);
+ }
+
+ public static boolean promptChangeAssignees(final Collection<? extends StateMachineArtifact> smas, boolean persist) throws OseeCoreException {
+ for (StateMachineArtifact sma : smas) {
+ if (sma.isCompleted()) {
+ AWorkbench.popup("ERROR",
+ "Can't assign completed " + sma.getArtifactTypeName() + " (" + sma.getHumanReadableId() + ")");
+ return false;
+ } else if (sma.isCancelled()) {
+ AWorkbench.popup("ERROR",
+ "Can't assign cancelled " + sma.getArtifactTypeName() + " (" + sma.getHumanReadableId() + ")");
+ return false;
+ }
+ }
+ UserCheckTreeDialog uld = new UserCheckTreeDialog();
+ uld.setMessage("Select to assign.\nDeSelect to un-assign.");
+ if (smas.iterator().next().getParentTeamWorkflow() != null) {
+ uld.setTeamMembers(smas.iterator().next().getParentTeamWorkflow().getTeamDefinition().getMembersAndLeads());
+ }
+
+ if (smas.size() == 1) {
+ uld.setInitialSelections(smas.iterator().next().getStateMgr().getAssignees());
+ }
+ if (uld.open() != 0) {
+ return false;
+ }
+ Collection<User> users = uld.getUsersSelected();
+ if (users.isEmpty()) {
+ AWorkbench.popup("ERROR", "Must have at least one assignee");
+ return false;
+ }
+ // As a convenience, remove the UnAssigned user if another user is selected
+ if (users.size() > 1) {
+ users.remove(UserManager.getUser(SystemUser.UnAssigned));
+ }
+ for (StateMachineArtifact sma : smas) {
+ sma.getStateMgr().setAssignees(users);
+ }
+ if (persist) {
+ Artifacts.persistInTransaction(smas);
+ }
+ return true;
+ }
+
+ public static boolean promptChangeOriginator(StateMachineArtifact sma) throws OseeCoreException {
+ return promptChangeOriginator(Arrays.asList(sma));
+ }
+
+ public static boolean promptChangeOriginator(final Collection<? extends StateMachineArtifact> smas) throws OseeCoreException {
+ UserListDialog ld = new UserListDialog(Displays.getActiveShell(), "Select New Originator");
+ int result = ld.open();
+ if (result == 0) {
+ User selectedUser = ld.getSelection();
+ for (StateMachineArtifact sma : smas) {
+ sma.setOriginator(selectedUser);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean promptChangeVersion(StateMachineArtifact sma, VersionReleaseType versionReleaseType, boolean persist) throws OseeCoreException {
+ if (AtsUtil.isAtsAdmin() && !sma.isTeamWorkflow()) {
+ AWorkbench.popup("ERROR ", "Cannot set version for: \n\n" + sma.getName());
+ return false;
+ }
+ return promptChangeVersion(Arrays.asList((TeamWorkFlowArtifact) sma), versionReleaseType, persist);
+ }
+
+ public static boolean promptChangeVersion(final Collection<? extends TeamWorkFlowArtifact> smas, VersionReleaseType versionReleaseType, final boolean persist) throws OseeCoreException {
+ TeamDefinitionArtifact teamDefHoldingVersions = null;
+ for (TeamWorkFlowArtifact teamArt : smas) {
+ if (!teamArt.getTeamDefinition().isTeamUsesVersions()) {
+ AWorkbench.popup("ERROR", "Team \"" + teamArt.getTeamDefinition().getName() + "\" doesn't use versions.");
+ return false;
+ }
+ if (teamArt.isReleased() || teamArt.isVersionLocked()) {
+ String error =
+ "Team Workflow\n \"" + teamArt.getName() + "\"\n targeted version is locked or already released.";
+ if (AtsUtil.isAtsAdmin() && !MessageDialog.openConfirm(Displays.getActiveShell(),
+ "Change Version", error + "\n\nOverride?")) {
+ return false;
+ } else if (!AtsUtil.isAtsAdmin()) {
+ AWorkbench.popup("ERROR", error);
+ }
+ }
+ if (teamDefHoldingVersions != null) {
+ if (teamDefHoldingVersions != teamArt.getTeamDefinition().getTeamDefinitionHoldingVersions()) {
+ AWorkbench.popup("ERROR", "Can't change version on Workflows that have different release version sets.");
+ return false;
+ }
+ }
+ if (teamDefHoldingVersions == null) {
+ teamDefHoldingVersions = teamArt.getTeamDefinition().getTeamDefinitionHoldingVersions();
+ }
+ }
+ if (teamDefHoldingVersions == null) {
+ AWorkbench.popup("ERROR", "No versions configured for impacted team(s).");
+ return false;
+ }
+ final VersionListDialog vld =
+ new VersionListDialog("Select Version", "Select Version",
+ teamDefHoldingVersions.getVersionsArtifacts(versionReleaseType));
+ if (smas.size() == 1 && smas.iterator().next().getWorldViewTargetedVersion() != null) {
+ Object[] objs = new Object[1];
+ objs[0] = smas.iterator().next().getWorldViewTargetedVersion();
+ vld.setInitialSelections(objs);
+ }
+ int result = vld.open();
+ if (result != 0) {
+ return false;
+ }
+ Object obj = vld.getResult()[0];
+ VersionArtifact newVersion = (VersionArtifact) obj;
+ //now check selected version
+ if (newVersion.isVersionLocked()) {
+ String error = "Version \"" + newVersion.getFullDisplayName() + "\" is locked or already released.";
+ if (AtsUtil.isAtsAdmin() && !MessageDialog.openConfirm(Displays.getActiveShell(),
+ "Change Version", error + "\n\nOverride?")) {
+ return false;
+ } else if (!AtsUtil.isAtsAdmin()) {
+ AWorkbench.popup("ERROR", error);
+ }
+ }
+
+ for (TeamWorkFlowArtifact teamArt : smas) {
+ teamArt.setRelations(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version,
+ java.util.Collections.singleton(newVersion));
+ }
+ if (persist) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Prompt Change Version");
+ for (TeamWorkFlowArtifact teamArt : smas) {
+ teamArt.persist(transaction);
+ }
+ transaction.execute();
+ }
+ return true;
+ }
+
+ public static boolean promptChangeType(StateMachineArtifact sma, boolean persist) throws OseeStateException {
+ if (sma.isTeamWorkflow()) {
+ return promptChangeType(Arrays.asList((TeamWorkFlowArtifact) sma), persist);
+ }
+ return false;
+ }
+
+ public static boolean promptChangeType(final Collection<? extends TeamWorkFlowArtifact> teams, boolean persist) throws OseeStateException {
+
+ for (TeamWorkFlowArtifact team : teams) {
+ if (team.isReleased() || team.isVersionLocked()) {
+ AWorkbench.popup("ERROR",
+ "Team Workflow\n \"" + team.getName() + "\"\n version is locked or already released.");
+ return false;
+ }
+ }
+ final ChangeTypeDialog dialog = new ChangeTypeDialog(Displays.getActiveShell());
+ try {
+ if (teams.size() == 1) {
+ dialog.setSelected(teams.iterator().next().getChangeType());
+ }
+ if (dialog.open() == 0) {
+
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Prompt Change Type");
+
+ for (TeamWorkFlowArtifact team : teams) {
+ if (team.getChangeType() != dialog.getSelection()) {
+ team.setChangeType(dialog.getSelection());
+ team.saveSMA(transaction);
+ }
+ }
+ transaction.execute();
+ }
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't change priority", ex);
+ return false;
+ }
+ }
+
+ public static boolean promptChangePoints(StateMachineArtifact sma, boolean persist) throws OseeStateException {
+ if (sma.isTeamWorkflow()) {
+ return promptChangePoints(Arrays.asList((TeamWorkFlowArtifact) sma), persist);
+ }
+ return false;
+ }
+
+ public static boolean promptChangePoints(final Collection<? extends TeamWorkFlowArtifact> teams, boolean persist) throws OseeStateException {
+
+ final ChangePointDialog dialog = new ChangePointDialog(Displays.getActiveShell());
+ try {
+ if (teams.size() == 1) {
+ dialog.setSelected(teams.iterator().next().getWorldViewPoint());
+ }
+ if (dialog.open() == 0) {
+
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Prompt Change Points");
+
+ for (TeamWorkFlowArtifact team : teams) {
+ if (dialog.isClearSelected() || !team.getWorldViewPoint().equals(dialog.getSelection())) {
+ if (dialog.isClearSelected()) {
+ team.deleteAttributes(ATSAttributes.POINTS_ATTRIBUTE.getStoreName());
+ } else {
+ team.setSoleAttributeFromString(ATSAttributes.POINTS_ATTRIBUTE.getStoreName(),
+ dialog.getSelection());
+ }
+ team.saveSMA(transaction);
+ }
+ }
+ transaction.execute();
+ }
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't change points", ex);
+ return false;
+ }
+ }
+
+ public static boolean promptChangePriority(StateMachineArtifact sma, boolean persist) throws OseeStateException {
+ if (sma.isTeamWorkflow()) {
+ return promptChangePriority(Arrays.asList((TeamWorkFlowArtifact) sma), persist);
+ }
+ return false;
+ }
+
+ public static boolean promptChangePriority(final Collection<? extends TeamWorkFlowArtifact> teams, boolean persist) {
+
+ for (TeamWorkFlowArtifact team : teams) {
+ if (team.isReleased() || team.isVersionLocked()) {
+ AWorkbench.popup("ERROR",
+ "Team Workflow\n \"" + team.getName() + "\"\n version is locked or already released.");
+ return false;
+ }
+ }
+ final AtsPriorityDialog ald = new AtsPriorityDialog(Displays.getActiveShell());
+ try {
+ if (teams.size() == 1) {
+ ald.setSelected(teams.iterator().next().getPriority());
+ }
+ if (ald.open() == 0) {
+
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Prompt Change Priority");
+ for (TeamWorkFlowArtifact team : teams) {
+ if (team.getPriority() != ald.getSelection()) {
+ team.setPriority(ald.getSelection());
+ team.saveSMA(transaction);
+ }
+ }
+ transaction.execute();
+ }
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't change priority", ex);
+ return false;
+ }
+ }
+
+ public static boolean promptChangeFloatAttribute(StateMachineArtifact sma, ATSAttributes atsAttr, boolean persist) {
+ try {
+ return ArtifactPromptChange.promptChangeFloatAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
+ Arrays.asList(sma), persist);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public static boolean promptChangeIntegerAttribute(StateMachineArtifact sma, ATSAttributes atsAttr, boolean persist) {
+ try {
+ return ArtifactPromptChange.promptChangeIntegerAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
+ Arrays.asList(sma), persist);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public static boolean promptChangePercentAttribute(StateMachineArtifact sma, ATSAttributes atsAttr, boolean persist) {
+ try {
+ return ArtifactPromptChange.promptChangePercentAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
+ Arrays.asList(new Artifact[] {sma}), persist);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public static boolean promptChangeBoolean(StateMachineArtifact sma, ATSAttributes atsAttr, String toggleMessage, boolean persist) {
+ try {
+ return ArtifactPromptChange.promptChangeBoolean(atsAttr.getStoreName(), atsAttr.getDisplayName(),
+ Arrays.asList(sma), toggleMessage, persist);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public static boolean promptChangeAttribute(final Collection<? extends StateMachineArtifact> smas, ATSAttributes atsAttr, boolean persist, boolean multiLine) throws OseeCoreException {
+ return ArtifactPromptChange.promptChangeStringAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(), smas,
+ persist, multiLine);
+ }
+
+ public static boolean promptChangeAttribute(final Artifact sma, ATSAttributes atsAttr, boolean persist, boolean multiLine) {
+ try {
+ return ArtifactPromptChange.promptChangeStringAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
+ Arrays.asList(new Artifact[] {sma}), persist, multiLine);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public static boolean promptChangeAttribute(StateMachineArtifact sma, ATSAttributes atsAttr, final boolean persist, boolean multiLine) {
+ try {
+ return ArtifactPromptChange.promptChangeStringAttribute(atsAttr.getStoreName(), atsAttr.getDisplayName(),
+ Arrays.asList(sma), persist, multiLine);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public static boolean promptChangeDate(StateMachineArtifact sma, ATSAttributes atsAttr, boolean persist) throws OseeStateException {
+ try {
+ return ArtifactPromptChange.promptChangeDate(atsAttr.getStoreName(), atsAttr.getDisplayName(), sma, persist);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP,
+ "Can't save " + atsAttr.getDisplayName() + " date to artifact " + sma.getHumanReadableId(), ex);
+ }
+ return false;
+ }
+
+ public static boolean promptChangeReleaseDate(StateMachineArtifact sma) throws OseeStateException {
+ if (sma.isReleased() || sma.isVersionLocked()) {
+ AWorkbench.popup("ERROR", "Team Workflow\n \"" + sma.getName() + "\"\n version is locked or already released.");
+ return false;
+ }
+ try {
+ VersionArtifact verArt = sma.getTargetedForVersion();
+ if (verArt != null) {
+ // prompt that this object is assigned to a version that is targeted
+ // for release xxx - want to change?
+ DateSelectionDialog diag =
+ new DateSelectionDialog(
+ "Select Release Date Date",
+ "Warning: " + sma.getArtifactTypeName() + "'s release date is handled\n" + "by targeted for version \"" + verArt.getName() + "\"\n" + "changing the date here will change the\n" + "date for this entire release.\n\nSelect date to change.\n",
+ verArt.getReleaseDate());
+ if (verArt.getReleaseDate() != null) {
+ diag.setSelectedDate(verArt.getReleaseDate());
+ }
+ if (diag.open() == 0) {
+ verArt.setSoleAttributeValue(ATSAttributes.RELEASE_DATE_ATTRIBUTE.getStoreName(), diag.getSelectedDate());
+ verArt.persist();
+ return true;
+ }
+ } else {
+ // prompt that current release is (get from attribute) - want to change?
+ DateSelectionDialog diag =
+ new DateSelectionDialog("Select Release Date", "Select Release Date", sma.getWorldViewReleaseDate());
+ if (sma.getWorldViewReleaseDate() != null) {
+ diag.setSelectedDate(sma.getWorldViewReleaseDate());
+ }
+ if (diag.open() == 0) {
+ sma.setSoleAttributeValue(ATSAttributes.RELEASE_DATE_ATTRIBUTE.getStoreName(), diag.getSelectedDate());
+ sma.persist();
+ return true;
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't save release date " + sma.getHumanReadableId(), ex);
+ }
+ return false;
+ }
+
+ public static boolean promptChangeEstimatedReleaseDate(StateMachineArtifact sma) throws OseeStateException {
+ try {
+ VersionArtifact verArt = sma.getTargetedForVersion();
+ if (verArt != null) {
+ // prompt that this object is assigned to a version that is targeted for release xxx -
+ // want to change?
+ DateSelectionDialog diag =
+ new DateSelectionDialog(
+ "Select Estimated Release Date Date",
+ "Warning: " + sma.getArtifactTypeName() + "'s estimated release date is handled\n" + "by targeted for version \"" + verArt.getName() + "\"\n" + "changing the date here will change the\n" + "date for this entire release.\n\nSelect date to change.\n",
+ verArt.getEstimatedReleaseDate());
+ if (verArt.getEstimatedReleaseDate() != null) {
+ diag.setSelectedDate(verArt.getEstimatedReleaseDate());
+ }
+ if (diag.open() == 0) {
+ verArt.setSoleAttributeValue(ATSAttributes.ESTIMATED_RELEASE_DATE_ATTRIBUTE.getStoreName(),
+ diag.getSelectedDate());
+ verArt.persist();
+ return true;
+ }
+ } else {
+ // prompt that current est release is (get from attribute); want to
+ // change
+ DateSelectionDialog diag =
+ new DateSelectionDialog("Select Estimate Release Date", "Select Estimated Release Date",
+ sma.getWorldViewEstimatedReleaseDate());
+ if (sma.getWorldViewEstimatedReleaseDate() != null) {
+ diag.setSelectedDate(sma.getWorldViewEstimatedReleaseDate());
+ }
+ if (diag.open() == 0) {
+ sma.setSoleAttributeValue(ATSAttributes.ESTIMATED_RELEASE_DATE_ATTRIBUTE.getStoreName(),
+ diag.getSelectedDate());
+ sma.persist();
+ return true;
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP,
+ "Can't save est release date " + sma.getHumanReadableId(), ex);
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAMetrics.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAMetrics.java
index 7aae34505dc..3eb0e85d9a6 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAMetrics.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAMetrics.java
@@ -1,458 +1,458 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.GoalArtifact;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.HashCollection;
-import org.eclipse.osee.framework.jdk.core.util.DateUtil;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-
-/**
- * @author Donald G. Dunne
- */
-public class SMAMetrics {
-
- double estHours = 0;
- double hrsRemainFromEstimates = 0;
- double hrsSpent = 0;
- double manDaysNeeded = 0;
- double cummulativeWorkflowPercentComplete = 0;
- double percentCompleteByWorkflowPercents = 0;
-
- Date estimatedReleaseDate;
- long daysTillRel = 0;
- VersionArtifact versionArtifact = null;
- String str = "";
- Set<TeamWorkFlowArtifact> teamArts = new HashSet<TeamWorkFlowArtifact>();
- Set<ActionArtifact> actionArts = new HashSet<ActionArtifact>();
- Set<TaskArtifact> taskArts = new HashSet<TaskArtifact>();
- Set<ReviewSMArtifact> reviewArts = new HashSet<ReviewSMArtifact>();
- Set<StateMachineArtifact> smas = new HashSet<StateMachineArtifact>();
- Set<User> assignees = new HashSet<User>();
- Set<User> assigneesAssignedOrCompleted = new HashSet<User>();
-
- private final HashCollection<User, Artifact> userToAssignedSmas =
- new HashCollection<User, Artifact>(true, HashSet.class, 100);
- private final HashCollection<User, Artifact> userToCompletedSmas =
- new HashCollection<User, Artifact>(true, HashSet.class, 100);
- private final double manHoursPerDay;
-
- public SMAMetrics(Collection<? extends Artifact> artifacts, VersionArtifact versionArtifact, double manHoursPerDay, Date estimatedReleaseDate) throws OseeCoreException {
- this.manHoursPerDay = manHoursPerDay;
- this.versionArtifact = versionArtifact;
- this.estimatedReleaseDate = estimatedReleaseDate;
- if (artifacts.isEmpty()) return;
- Set<Artifact> resolvedArts = new HashSet<Artifact>(artifacts);
- for (Artifact art : artifacts) {
- if (art instanceof GoalArtifact) {
- resolvedArts.addAll(((GoalArtifact) art).getMembers());
- }
- }
-
- for (Artifact art : resolvedArts) {
- if (art instanceof ActionArtifact) {
- actionArts.add((ActionArtifact) art);
- }
- }
- for (Artifact art : resolvedArts) {
- if (art instanceof TeamWorkFlowArtifact) {
- teamArts.add((TeamWorkFlowArtifact) art);
- } else if (art instanceof TaskArtifact) {
- taskArts.add((TaskArtifact) art);
- } else if (art instanceof ReviewSMArtifact) {
- reviewArts.add((ReviewSMArtifact) art);
- }
- if (art instanceof StateMachineArtifact) {
- smas.add((StateMachineArtifact) art);
- Collection<User> users = ((StateMachineArtifact) art).getStateMgr().getAssignees();
- assignees.addAll(users);
- assigneesAssignedOrCompleted.addAll(users);
- for (User user : users) {
- userToAssignedSmas.put(user, art);
- }
- if (((StateMachineArtifact) art).isCompleted()) {
- Collection<User> implementers = ((StateMachineArtifact) art).getImplementers();
- assigneesAssignedOrCompleted.addAll(implementers);
- for (User user : implementers) {
- userToCompletedSmas.put(user, art);
- }
- }
- }
- }
- estHours = 0;
- hrsRemainFromEstimates = 0;
- hrsSpent = 0;
- manDaysNeeded = 0;
- cummulativeWorkflowPercentComplete = 0;
- manDaysNeeded = 0;
- for (StateMachineArtifact team : smas) {
- hrsRemainFromEstimates += team.getWorldViewRemainHours();
- estHours += team.getWorldViewEstimatedHours();
- hrsSpent += team.getWorldViewHoursSpentTotal();
- manDaysNeeded += team.getWorldViewManDaysNeeded();
- cummulativeWorkflowPercentComplete += team.getWorldViewPercentCompleteTotal();
- }
- if (hrsRemainFromEstimates != 0) manDaysNeeded = hrsRemainFromEstimates / manHoursPerDay;
- percentCompleteByWorkflowPercents = 0;
- if (getNumSMAs() > 0 && cummulativeWorkflowPercentComplete > 0) {
- percentCompleteByWorkflowPercents = cummulativeWorkflowPercentComplete / getNumSMAs();
- }
-
- Date today = new Date();
- daysTillRel = 0;
- if (versionArtifact != null && estimatedReleaseDate == null) {
- estimatedReleaseDate = versionArtifact.getEstimatedReleaseDate();
- }
- if (estimatedReleaseDate != null && estimatedReleaseDate.after(today)) {
- daysTillRel = DateUtil.getWorkingDaysBetween(today, estimatedReleaseDate);
- }
- str =
- String.format("TeamWFs: %s Tasks: %s EstHrs: %5.2f %sCmp: %5.2f RmnHrs: %5.2f HrsSpnt: %5.2f %s %s",
- getNumTeamWfs(), getNumTasks(), estHours, "%", percentCompleteByWorkflowPercents,
- hrsRemainFromEstimates, hrsSpent, (manDaysNeeded > 0 ? String.format("ManDaysNeeded: %5.2f ",
- manDaysNeeded) : ""),
- (versionArtifact != null ? String.format("Version: %s EstRelDate: %s DaysLeft: %d ",
- versionArtifact.getName(), (estimatedReleaseDate == null ? "Not Set" : XDate.getDateStr(
- estimatedReleaseDate, XDate.MMDDYY)), daysTillRel) : ""));
- }
-
- /**
- * @return the userToCompletedSmas
- */
- public HashCollection<User, Artifact> getUserToCompletedSmas() {
- return userToCompletedSmas;
- }
-
- public <A extends StateMachineArtifact> Collection<A> getUserToCompletedSmas(User user) {
- return getUserToCompletedSmas(user, null);
- }
-
- @SuppressWarnings("unchecked")
- public <A extends StateMachineArtifact> Collection<A> getUserToCompletedSmas(User user, Class<A> clazz) {
- if (!userToCompletedSmas.containsKey(user)) return Collections.emptyList();
- List<A> smas = new ArrayList<A>();
- for (Artifact art : userToCompletedSmas.getValues(user)) {
- if (clazz == null || art.getClass().isInstance(clazz)) {
- smas.add((A) art);
- }
- }
- return smas;
- }
-
- @SuppressWarnings("unchecked")
- public <A extends StateMachineArtifact> Collection<A> getUserToAssignedSmas(User user, Class<A> clazz) {
- if (!userToAssignedSmas.containsKey(user)) return Collections.emptyList();
- List<A> smas = new ArrayList<A>();
- for (Artifact art : userToAssignedSmas.getValues(user)) {
- if (clazz == null || art.getClass().equals(clazz)) {
- smas.add((A) art);
- }
- }
- return smas;
- }
-
- public Collection<TeamWorkFlowArtifact> getCompletedTeamWorkflows() throws OseeCoreException {
- Set<TeamWorkFlowArtifact> teams = new HashSet<TeamWorkFlowArtifact>();
- for (TeamWorkFlowArtifact team : getTeamArts()) {
- if (team.isCancelledOrCompleted()) {
- teams.add(team);
- }
- }
- return teams;
- }
-
- public Collection<StateMachineArtifact> getCompletedWorkflows() throws OseeCoreException {
- Set<StateMachineArtifact> completed = new HashSet<StateMachineArtifact>();
- for (StateMachineArtifact sma : smas) {
- if (sma.isCancelledOrCompleted()) {
- completed.add(sma);
- }
- }
- return completed;
- }
-
- public double getPercentCompleteByTeamWorkflow() throws OseeCoreException {
- if (getTeamArts().isEmpty()) return 0;
- double completed = getCompletedTeamWorkflows().size();
- if (completed == 0) return 0;
- return completed / getTeamArts().size() * 100;
- }
-
- public double getPercentCompleteByWorkflow() throws OseeCoreException {
- if (smas.isEmpty()) return 0;
- double completed = getCompletedWorkflows().size();
- if (completed == 0) return 0;
- return completed / smas.size() * 100;
- }
-
- public Collection<TaskArtifact> getCompletedTaskWorkflows() throws OseeCoreException {
- Set<TaskArtifact> tasks = new HashSet<TaskArtifact>();
- for (TaskArtifact team : getTaskArts()) {
- if (team.isCancelledOrCompleted()) {
- tasks.add(team);
- }
- }
- return tasks;
- }
-
- public double getPercentCompleteByTaskWorkflow() throws OseeCoreException {
- if (getTaskArts().isEmpty()) return 0;
- double completed = getCompletedTaskWorkflows().size();
- if (completed == 0) return 0;
- return completed / getTaskArts().size() * 100;
- }
-
- /**
- * @return the str
- */
- @Override
- public String toString() {
- return str;
- }
-
- public static String getEstRemainMetrics(Collection<? extends Artifact> smas, VersionArtifact versionArtifact, double manHoursPerDay, Date estimatedrelDate) throws OseeCoreException {
- return new SMAMetrics(smas, versionArtifact, manHoursPerDay, estimatedrelDate).str;
- }
-
- /**
- * @return the assigneesAssignedOrCompleted
- */
- public Set<User> getAssigneesAssignedOrCompleted() {
- return assigneesAssignedOrCompleted;
- }
-
- public String toStringObjectBreakout() {
- return String.format("Actions: %s - Team Workflows: %s - Task Workflows: %s - Review Workflows: %s ",
- getNumActions(), getNumTeamWfs(), getNumTasks(), getNumReviews());
- }
-
- public String toStringLong() {
- return String.format(
- "%s\nEstimated Hours: %5.2f Percent Complete: %5.2f Remaining Hours: %5.2f ManDaysNeeded: %5.2f \nHours Spent: %5.2f %s",
- toStringObjectBreakout(), estHours, percentCompleteByWorkflowPercents, hrsRemainFromEstimates,
- manDaysNeeded, hrsSpent, (versionArtifact != null ? String.format(
- "\nVersion: %s Estimated Release Date: %s Days Left: %d ", versionArtifact.getName(),
- (estimatedReleaseDate == null ? "Not Set" : XDate.getDateStr(estimatedReleaseDate, XDate.MMDDYY)),
- daysTillRel) : ""));
- }
-
- /**
- * @return the estRelDate
- */
- public Date getEstRelDate() {
- return estimatedReleaseDate;
- }
-
- /**
- * @param estRelDate the estRelDate to set
- */
- public void setEstRelDate(Date estRelDate) {
- this.estimatedReleaseDate = estRelDate;
- }
-
- /**
- * @return the daysTillRel
- */
- public long getDaysTillRel() {
- return daysTillRel;
- }
-
- /**
- * @return the hours till release
- */
- public double getHoursTillRel() {
- return daysTillRel * manHoursPerDay;
- }
-
- public String getHoursTillRelStr() {
- return String.format("%5.2f hours = %d days till release * %5.2f Man Hours Per Day", getHoursTillRel(),
- daysTillRel, manHoursPerDay);
- }
-
- public String getDaysTillRelStr() {
- return String.format("%d workdays (M-F) till release", daysTillRel);
- }
-
- /**
- * @param daysTillRel the daysTillRel to set
- */
- public void setDaysTillRel(int daysTillRel) {
- this.daysTillRel = daysTillRel;
- }
-
- /**
- * @return the versionArtifact
- */
- public VersionArtifact getVersionArtifact() {
- return versionArtifact;
- }
-
- /**
- * @param versionArtifact the versionArtifact to set
- */
- public void setVersionArtifact(VersionArtifact versionArtifact) {
- this.versionArtifact = versionArtifact;
- }
-
- /**
- * @return the numTeamWfs
- */
- public int getNumTeamWfs() {
- return teamArts.size();
- }
-
- /**
- * @return the numTasks
- */
- public int getNumTasks() {
- return taskArts.size();
- }
-
- public int getNumSMAs() {
- return smas.size();
- }
-
- public int getNumNotEstimated() throws OseeCoreException {
- int count = 0;
- for (StateMachineArtifact sma : smas) {
- if (sma.getWorldViewEstimatedHours() == 0) count++;
- }
- return count;
- }
-
- /**
- * @return the numTasks
- */
- public int getNumActions() {
- return actionArts.size();
- }
-
- /**
- * @return the numTasks
- */
- public int getNumReviews() {
- return reviewArts.size();
- }
-
- /**
- * @return the estHours
- */
- public double getEstHours() {
- return estHours;
- }
-
- /**
- * @param estHours the estHours to set
- */
- public void setEstHours(double estHours) {
- this.estHours = estHours;
- }
-
- /**
- * @return the hrsRemain
- */
- public double getHrsRemainFromEstimates() {
- return hrsRemainFromEstimates;
- }
-
- /**
- * @return the hrsSpent
- */
- public double getHrsSpent() {
- return hrsSpent;
- }
-
- /**
- * @return the manDaysNeeded
- */
- public double getManDaysNeeded() {
- return manDaysNeeded;
- }
-
- /**
- * @return the cummulativePercentComplete
- */
- public double getCummulativeWorkflowPercentComplete() {
- return cummulativeWorkflowPercentComplete;
- }
-
- /**
- * @return the percentComplete
- */
- public double getPercentCompleteByWorkflowPercents() {
- return percentCompleteByWorkflowPercents;
- }
-
- /**
- * @return the manDayHrs
- */
- public double getHoursPerManDay() {
- return manHoursPerDay;
- }
-
- /**
- * @return the teamArts
- */
- public Set<TeamWorkFlowArtifact> getTeamArts() {
- return teamArts;
- }
-
- /**
- * @return the actionArts
- */
- public Set<ActionArtifact> getActionArts() {
- return actionArts;
- }
-
- /**
- * @return the taskArts
- */
- public Set<TaskArtifact> getTaskArts() {
- return taskArts;
- }
-
- /**
- * @return the reviewArts
- */
- public Set<ReviewSMArtifact> getReviewArts() {
- return reviewArts;
- }
-
- /**
- * Return all SMAs including Review and Tasks
- *
- * @return the userToSmas
- */
- public HashCollection<User, Artifact> getUserToAssignedSmas() {
- return userToAssignedSmas;
- }
-
- public <A extends StateMachineArtifact> Collection<A> getUserToAssignedSmas(User user) {
- return getUserToAssignedSmas(user, 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.ats.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.GoalArtifact;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.jdk.core.util.DateUtil;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SMAMetrics {
+
+ double estHours = 0;
+ double hrsRemainFromEstimates = 0;
+ double hrsSpent = 0;
+ double manDaysNeeded = 0;
+ double cummulativeWorkflowPercentComplete = 0;
+ double percentCompleteByWorkflowPercents = 0;
+
+ Date estimatedReleaseDate;
+ long daysTillRel = 0;
+ VersionArtifact versionArtifact = null;
+ String str = "";
+ Set<TeamWorkFlowArtifact> teamArts = new HashSet<TeamWorkFlowArtifact>();
+ Set<ActionArtifact> actionArts = new HashSet<ActionArtifact>();
+ Set<TaskArtifact> taskArts = new HashSet<TaskArtifact>();
+ Set<ReviewSMArtifact> reviewArts = new HashSet<ReviewSMArtifact>();
+ Set<StateMachineArtifact> smas = new HashSet<StateMachineArtifact>();
+ Set<User> assignees = new HashSet<User>();
+ Set<User> assigneesAssignedOrCompleted = new HashSet<User>();
+
+ private final HashCollection<User, Artifact> userToAssignedSmas =
+ new HashCollection<User, Artifact>(true, HashSet.class, 100);
+ private final HashCollection<User, Artifact> userToCompletedSmas =
+ new HashCollection<User, Artifact>(true, HashSet.class, 100);
+ private final double manHoursPerDay;
+
+ public SMAMetrics(Collection<? extends Artifact> artifacts, VersionArtifact versionArtifact, double manHoursPerDay, Date estimatedReleaseDate) throws OseeCoreException {
+ this.manHoursPerDay = manHoursPerDay;
+ this.versionArtifact = versionArtifact;
+ this.estimatedReleaseDate = estimatedReleaseDate;
+ if (artifacts.isEmpty()) return;
+ Set<Artifact> resolvedArts = new HashSet<Artifact>(artifacts);
+ for (Artifact art : artifacts) {
+ if (art instanceof GoalArtifact) {
+ resolvedArts.addAll(((GoalArtifact) art).getMembers());
+ }
+ }
+
+ for (Artifact art : resolvedArts) {
+ if (art instanceof ActionArtifact) {
+ actionArts.add((ActionArtifact) art);
+ }
+ }
+ for (Artifact art : resolvedArts) {
+ if (art instanceof TeamWorkFlowArtifact) {
+ teamArts.add((TeamWorkFlowArtifact) art);
+ } else if (art instanceof TaskArtifact) {
+ taskArts.add((TaskArtifact) art);
+ } else if (art instanceof ReviewSMArtifact) {
+ reviewArts.add((ReviewSMArtifact) art);
+ }
+ if (art instanceof StateMachineArtifact) {
+ smas.add((StateMachineArtifact) art);
+ Collection<User> users = ((StateMachineArtifact) art).getStateMgr().getAssignees();
+ assignees.addAll(users);
+ assigneesAssignedOrCompleted.addAll(users);
+ for (User user : users) {
+ userToAssignedSmas.put(user, art);
+ }
+ if (((StateMachineArtifact) art).isCompleted()) {
+ Collection<User> implementers = ((StateMachineArtifact) art).getImplementers();
+ assigneesAssignedOrCompleted.addAll(implementers);
+ for (User user : implementers) {
+ userToCompletedSmas.put(user, art);
+ }
+ }
+ }
+ }
+ estHours = 0;
+ hrsRemainFromEstimates = 0;
+ hrsSpent = 0;
+ manDaysNeeded = 0;
+ cummulativeWorkflowPercentComplete = 0;
+ manDaysNeeded = 0;
+ for (StateMachineArtifact team : smas) {
+ hrsRemainFromEstimates += team.getWorldViewRemainHours();
+ estHours += team.getWorldViewEstimatedHours();
+ hrsSpent += team.getWorldViewHoursSpentTotal();
+ manDaysNeeded += team.getWorldViewManDaysNeeded();
+ cummulativeWorkflowPercentComplete += team.getWorldViewPercentCompleteTotal();
+ }
+ if (hrsRemainFromEstimates != 0) manDaysNeeded = hrsRemainFromEstimates / manHoursPerDay;
+ percentCompleteByWorkflowPercents = 0;
+ if (getNumSMAs() > 0 && cummulativeWorkflowPercentComplete > 0) {
+ percentCompleteByWorkflowPercents = cummulativeWorkflowPercentComplete / getNumSMAs();
+ }
+
+ Date today = new Date();
+ daysTillRel = 0;
+ if (versionArtifact != null && estimatedReleaseDate == null) {
+ estimatedReleaseDate = versionArtifact.getEstimatedReleaseDate();
+ }
+ if (estimatedReleaseDate != null && estimatedReleaseDate.after(today)) {
+ daysTillRel = DateUtil.getWorkingDaysBetween(today, estimatedReleaseDate);
+ }
+ str =
+ String.format("TeamWFs: %s Tasks: %s EstHrs: %5.2f %sCmp: %5.2f RmnHrs: %5.2f HrsSpnt: %5.2f %s %s",
+ getNumTeamWfs(), getNumTasks(), estHours, "%", percentCompleteByWorkflowPercents,
+ hrsRemainFromEstimates, hrsSpent, (manDaysNeeded > 0 ? String.format("ManDaysNeeded: %5.2f ",
+ manDaysNeeded) : ""),
+ (versionArtifact != null ? String.format("Version: %s EstRelDate: %s DaysLeft: %d ",
+ versionArtifact.getName(), (estimatedReleaseDate == null ? "Not Set" : XDate.getDateStr(
+ estimatedReleaseDate, XDate.MMDDYY)), daysTillRel) : ""));
+ }
+
+ /**
+ * @return the userToCompletedSmas
+ */
+ public HashCollection<User, Artifact> getUserToCompletedSmas() {
+ return userToCompletedSmas;
+ }
+
+ public <A extends StateMachineArtifact> Collection<A> getUserToCompletedSmas(User user) {
+ return getUserToCompletedSmas(user, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <A extends StateMachineArtifact> Collection<A> getUserToCompletedSmas(User user, Class<A> clazz) {
+ if (!userToCompletedSmas.containsKey(user)) return Collections.emptyList();
+ List<A> smas = new ArrayList<A>();
+ for (Artifact art : userToCompletedSmas.getValues(user)) {
+ if (clazz == null || art.getClass().isInstance(clazz)) {
+ smas.add((A) art);
+ }
+ }
+ return smas;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <A extends StateMachineArtifact> Collection<A> getUserToAssignedSmas(User user, Class<A> clazz) {
+ if (!userToAssignedSmas.containsKey(user)) return Collections.emptyList();
+ List<A> smas = new ArrayList<A>();
+ for (Artifact art : userToAssignedSmas.getValues(user)) {
+ if (clazz == null || art.getClass().equals(clazz)) {
+ smas.add((A) art);
+ }
+ }
+ return smas;
+ }
+
+ public Collection<TeamWorkFlowArtifact> getCompletedTeamWorkflows() throws OseeCoreException {
+ Set<TeamWorkFlowArtifact> teams = new HashSet<TeamWorkFlowArtifact>();
+ for (TeamWorkFlowArtifact team : getTeamArts()) {
+ if (team.isCancelledOrCompleted()) {
+ teams.add(team);
+ }
+ }
+ return teams;
+ }
+
+ public Collection<StateMachineArtifact> getCompletedWorkflows() throws OseeCoreException {
+ Set<StateMachineArtifact> completed = new HashSet<StateMachineArtifact>();
+ for (StateMachineArtifact sma : smas) {
+ if (sma.isCancelledOrCompleted()) {
+ completed.add(sma);
+ }
+ }
+ return completed;
+ }
+
+ public double getPercentCompleteByTeamWorkflow() throws OseeCoreException {
+ if (getTeamArts().isEmpty()) return 0;
+ double completed = getCompletedTeamWorkflows().size();
+ if (completed == 0) return 0;
+ return completed / getTeamArts().size() * 100;
+ }
+
+ public double getPercentCompleteByWorkflow() throws OseeCoreException {
+ if (smas.isEmpty()) return 0;
+ double completed = getCompletedWorkflows().size();
+ if (completed == 0) return 0;
+ return completed / smas.size() * 100;
+ }
+
+ public Collection<TaskArtifact> getCompletedTaskWorkflows() throws OseeCoreException {
+ Set<TaskArtifact> tasks = new HashSet<TaskArtifact>();
+ for (TaskArtifact team : getTaskArts()) {
+ if (team.isCancelledOrCompleted()) {
+ tasks.add(team);
+ }
+ }
+ return tasks;
+ }
+
+ public double getPercentCompleteByTaskWorkflow() throws OseeCoreException {
+ if (getTaskArts().isEmpty()) return 0;
+ double completed = getCompletedTaskWorkflows().size();
+ if (completed == 0) return 0;
+ return completed / getTaskArts().size() * 100;
+ }
+
+ /**
+ * @return the str
+ */
+ @Override
+ public String toString() {
+ return str;
+ }
+
+ public static String getEstRemainMetrics(Collection<? extends Artifact> smas, VersionArtifact versionArtifact, double manHoursPerDay, Date estimatedrelDate) throws OseeCoreException {
+ return new SMAMetrics(smas, versionArtifact, manHoursPerDay, estimatedrelDate).str;
+ }
+
+ /**
+ * @return the assigneesAssignedOrCompleted
+ */
+ public Set<User> getAssigneesAssignedOrCompleted() {
+ return assigneesAssignedOrCompleted;
+ }
+
+ public String toStringObjectBreakout() {
+ return String.format("Actions: %s - Team Workflows: %s - Task Workflows: %s - Review Workflows: %s ",
+ getNumActions(), getNumTeamWfs(), getNumTasks(), getNumReviews());
+ }
+
+ public String toStringLong() {
+ return String.format(
+ "%s\nEstimated Hours: %5.2f Percent Complete: %5.2f Remaining Hours: %5.2f ManDaysNeeded: %5.2f \nHours Spent: %5.2f %s",
+ toStringObjectBreakout(), estHours, percentCompleteByWorkflowPercents, hrsRemainFromEstimates,
+ manDaysNeeded, hrsSpent, (versionArtifact != null ? String.format(
+ "\nVersion: %s Estimated Release Date: %s Days Left: %d ", versionArtifact.getName(),
+ (estimatedReleaseDate == null ? "Not Set" : XDate.getDateStr(estimatedReleaseDate, XDate.MMDDYY)),
+ daysTillRel) : ""));
+ }
+
+ /**
+ * @return the estRelDate
+ */
+ public Date getEstRelDate() {
+ return estimatedReleaseDate;
+ }
+
+ /**
+ * @param estRelDate the estRelDate to set
+ */
+ public void setEstRelDate(Date estRelDate) {
+ this.estimatedReleaseDate = estRelDate;
+ }
+
+ /**
+ * @return the daysTillRel
+ */
+ public long getDaysTillRel() {
+ return daysTillRel;
+ }
+
+ /**
+ * @return the hours till release
+ */
+ public double getHoursTillRel() {
+ return daysTillRel * manHoursPerDay;
+ }
+
+ public String getHoursTillRelStr() {
+ return String.format("%5.2f hours = %d days till release * %5.2f Man Hours Per Day", getHoursTillRel(),
+ daysTillRel, manHoursPerDay);
+ }
+
+ public String getDaysTillRelStr() {
+ return String.format("%d workdays (M-F) till release", daysTillRel);
+ }
+
+ /**
+ * @param daysTillRel the daysTillRel to set
+ */
+ public void setDaysTillRel(int daysTillRel) {
+ this.daysTillRel = daysTillRel;
+ }
+
+ /**
+ * @return the versionArtifact
+ */
+ public VersionArtifact getVersionArtifact() {
+ return versionArtifact;
+ }
+
+ /**
+ * @param versionArtifact the versionArtifact to set
+ */
+ public void setVersionArtifact(VersionArtifact versionArtifact) {
+ this.versionArtifact = versionArtifact;
+ }
+
+ /**
+ * @return the numTeamWfs
+ */
+ public int getNumTeamWfs() {
+ return teamArts.size();
+ }
+
+ /**
+ * @return the numTasks
+ */
+ public int getNumTasks() {
+ return taskArts.size();
+ }
+
+ public int getNumSMAs() {
+ return smas.size();
+ }
+
+ public int getNumNotEstimated() throws OseeCoreException {
+ int count = 0;
+ for (StateMachineArtifact sma : smas) {
+ if (sma.getWorldViewEstimatedHours() == 0) count++;
+ }
+ return count;
+ }
+
+ /**
+ * @return the numTasks
+ */
+ public int getNumActions() {
+ return actionArts.size();
+ }
+
+ /**
+ * @return the numTasks
+ */
+ public int getNumReviews() {
+ return reviewArts.size();
+ }
+
+ /**
+ * @return the estHours
+ */
+ public double getEstHours() {
+ return estHours;
+ }
+
+ /**
+ * @param estHours the estHours to set
+ */
+ public void setEstHours(double estHours) {
+ this.estHours = estHours;
+ }
+
+ /**
+ * @return the hrsRemain
+ */
+ public double getHrsRemainFromEstimates() {
+ return hrsRemainFromEstimates;
+ }
+
+ /**
+ * @return the hrsSpent
+ */
+ public double getHrsSpent() {
+ return hrsSpent;
+ }
+
+ /**
+ * @return the manDaysNeeded
+ */
+ public double getManDaysNeeded() {
+ return manDaysNeeded;
+ }
+
+ /**
+ * @return the cummulativePercentComplete
+ */
+ public double getCummulativeWorkflowPercentComplete() {
+ return cummulativeWorkflowPercentComplete;
+ }
+
+ /**
+ * @return the percentComplete
+ */
+ public double getPercentCompleteByWorkflowPercents() {
+ return percentCompleteByWorkflowPercents;
+ }
+
+ /**
+ * @return the manDayHrs
+ */
+ public double getHoursPerManDay() {
+ return manHoursPerDay;
+ }
+
+ /**
+ * @return the teamArts
+ */
+ public Set<TeamWorkFlowArtifact> getTeamArts() {
+ return teamArts;
+ }
+
+ /**
+ * @return the actionArts
+ */
+ public Set<ActionArtifact> getActionArts() {
+ return actionArts;
+ }
+
+ /**
+ * @return the taskArts
+ */
+ public Set<TaskArtifact> getTaskArts() {
+ return taskArts;
+ }
+
+ /**
+ * @return the reviewArts
+ */
+ public Set<ReviewSMArtifact> getReviewArts() {
+ return reviewArts;
+ }
+
+ /**
+ * Return all SMAs including Review and Tasks
+ *
+ * @return the userToSmas
+ */
+ public HashCollection<User, Artifact> getUserToAssignedSmas() {
+ return userToAssignedSmas;
+ }
+
+ public <A extends StateMachineArtifact> Collection<A> getUserToAssignedSmas(User user) {
+ return getUserToAssignedSmas(user, null);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAUtil.java
index 92741bc9a62..59d8c13300a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAUtil.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/SMAUtil.java
@@ -1,221 +1,221 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.LogItem;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
-
-/**
- * This utility class provides methods to filter out certain types of state machine artifacts based on criteria
- *
- * @author Donald G. Dunne
- */
-public class SMAUtil {
-
- public static Collection<StateMachineArtifact> getCompletedCancelled(Collection<StateMachineArtifact> smas) throws OseeCoreException {
- List<StateMachineArtifact> artifactsToReturn = new ArrayList<StateMachineArtifact>(smas.size());
- for (StateMachineArtifact sma : smas) {
- if (sma.isCancelledOrCompleted()) {
- artifactsToReturn.add(sma);
- }
- }
- return artifactsToReturn;
- }
-
- public static Collection<StateMachineArtifact> getInWork(Collection<StateMachineArtifact> smas) throws OseeCoreException {
- List<StateMachineArtifact> artifactsToReturn = new ArrayList<StateMachineArtifact>(smas.size());
- for (StateMachineArtifact sma : smas) {
- if (!sma.isCancelledOrCompleted()) {
- artifactsToReturn.add(sma);
- }
- }
- return artifactsToReturn;
- }
-
- public static Collection<StateMachineArtifact> filterOutState(Collection<StateMachineArtifact> smas, Collection<String> stateNames) throws OseeCoreException {
- List<StateMachineArtifact> artifactsToReturn = new ArrayList<StateMachineArtifact>(smas.size());
- for (StateMachineArtifact sma : smas) {
- if (!stateNames.contains(sma.getStateMgr().getCurrentStateName())) {
- artifactsToReturn.add(sma);
- }
- }
- return artifactsToReturn;
- }
-
- public static Collection<StateMachineArtifact> filterOutTypes(Collection<StateMachineArtifact> smas, Collection<Class<?>> classes) throws OseeCoreException {
- List<StateMachineArtifact> artifactsToReturn = new ArrayList<StateMachineArtifact>(smas.size());
- for (StateMachineArtifact sma : smas) {
- boolean found = false;
- for (Class<?> clazz : classes) {
- if (clazz.isInstance(sma)) {
- found = true;
- }
- }
- if (!found) {
- artifactsToReturn.add(sma);
- }
- }
- return artifactsToReturn;
- }
-
- public static Collection<StateMachineArtifact> getOpenAtDate(Date date, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
- List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
- for (StateMachineArtifact sma : artifacts) {
- Date createDate = sma.getWorldViewCreatedDate();
- Date completedCancelDate = null;
- if (sma.isCancelledOrCompleted()) {
- if (sma.isCancelled()) {
- completedCancelDate = sma.getWorldViewCancelledDate();
- } else {
- completedCancelDate = sma.getWorldViewCompletedDate();
- }
- }
- if (createDate.before(date) && (completedCancelDate == null || completedCancelDate.after(date))) {
- smas.add(sma);
- }
- }
- return smas;
- }
-
- public static Collection<StateMachineArtifact> getCompletedCancelledBetweenDate(Date startDate, Date endDate, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
- List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
- for (StateMachineArtifact sma : artifacts) {
- Date completedCancelDate = null;
- if (sma.isCancelledOrCompleted()) {
- if (sma.isCancelled()) {
- completedCancelDate = sma.getWorldViewCancelledDate();
- } else {
- completedCancelDate = sma.getWorldViewCompletedDate();
- }
- }
- if (completedCancelDate == null) {
- continue;
- }
- if (completedCancelDate.after(startDate) && completedCancelDate.before(endDate)) {
- smas.add(sma);
- }
- }
- return smas;
- }
-
- public static Double getHoursSpent(Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
- Double hoursSpent = 0.0;
- for (StateMachineArtifact sma : artifacts) {
- hoursSpent += sma.getWorldViewHoursSpentTotal();
- }
- return hoursSpent;
- }
-
- public static Collection<StateMachineArtifact> getStateAtDate(Date date, Collection<String> states, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
- List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
- for (StateMachineArtifact sma : artifacts) {
- Date createDate = sma.getWorldViewCreatedDate();
- if (createDate.after(date)) {
- continue;
- }
- // Find state at date
- String currentState = sma.getStateMgr().getCurrentStateName();
- for (LogItem item : sma.getLog().getLogItems()) {
- if (item.getDate().before(date)) {
- currentState = item.getState();
- }
- }
- if (states.contains(currentState)) {
- smas.add(sma);
- }
- }
- return smas;
- }
-
- /**
- * Returns sma if change type, or parent team workflow's change type is in specified set
- *
- * @param changeTypes
- * @param artifacts
- * @throws OseeCoreException
- */
- public static Collection<StateMachineArtifact> getChangeType(Collection<ChangeType> changeTypes, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
- List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
- for (StateMachineArtifact sma : artifacts) {
- TeamWorkFlowArtifact teamArt = sma.getParentTeamWorkflow();
- if (changeTypes.contains(teamArt.getChangeType())) {
- smas.add(sma);
- }
- }
- return smas;
-
- }
-
- /**
- * Returns sma if priority type, or parent team workflow's priority type is in specified set
- *
- * @param priorityTypes
- * @param artifacts
- * @throws OseeCoreException
- */
- public static Collection<StateMachineArtifact> getPriorityType(Collection<PriorityType> priorityTypes, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
- List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
- for (StateMachineArtifact sma : artifacts) {
- TeamWorkFlowArtifact teamArt = sma.getParentTeamWorkflow();
- if (priorityTypes.contains(teamArt.getPriority())) {
- smas.add(sma);
- }
- }
- return smas;
-
- }
-
- public static Collection<StateMachineArtifact> getTeamDefinitionWorkflows(Collection<? extends Artifact> artifacts, Collection<TeamDefinitionArtifact> teamDefs) throws OseeCoreException {
- List<StateMachineArtifact> returnSmas = new ArrayList<StateMachineArtifact>();
- for (StateMachineArtifact sma : getSMAs(artifacts)) {
- if (sma.getParentTeamWorkflow() == null) {
- continue;
- }
- if (teamDefs.contains(sma.getParentTeamWorkflow().getTeamDefinition())) {
- returnSmas.add(sma);
- }
- }
- return returnSmas;
- }
-
- public static Collection<StateMachineArtifact> getVersionWorkflows(Collection<? extends Artifact> artifacts, Collection<VersionArtifact> versionArts) throws OseeCoreException {
- List<StateMachineArtifact> returnSmas = new ArrayList<StateMachineArtifact>();
- for (StateMachineArtifact sma : getSMAs(artifacts)) {
- if (sma.getParentTeamWorkflow() == null) {
- continue;
- }
- if (sma.getWorldViewTargetedVersion() == null) {
- continue;
- }
- if (versionArts.contains(sma.getWorldViewTargetedVersion())) {
- returnSmas.add(sma);
- }
- }
- return returnSmas;
- }
-
- public static Collection<StateMachineArtifact> getSMAs(Collection<? extends Artifact> artifacts) throws OseeCoreException {
- return Collections.castMatching(StateMachineArtifact.class, artifacts);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.LogItem;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
+
+/**
+ * This utility class provides methods to filter out certain types of state machine artifacts based on criteria
+ *
+ * @author Donald G. Dunne
+ */
+public class SMAUtil {
+
+ public static Collection<StateMachineArtifact> getCompletedCancelled(Collection<StateMachineArtifact> smas) throws OseeCoreException {
+ List<StateMachineArtifact> artifactsToReturn = new ArrayList<StateMachineArtifact>(smas.size());
+ for (StateMachineArtifact sma : smas) {
+ if (sma.isCancelledOrCompleted()) {
+ artifactsToReturn.add(sma);
+ }
+ }
+ return artifactsToReturn;
+ }
+
+ public static Collection<StateMachineArtifact> getInWork(Collection<StateMachineArtifact> smas) throws OseeCoreException {
+ List<StateMachineArtifact> artifactsToReturn = new ArrayList<StateMachineArtifact>(smas.size());
+ for (StateMachineArtifact sma : smas) {
+ if (!sma.isCancelledOrCompleted()) {
+ artifactsToReturn.add(sma);
+ }
+ }
+ return artifactsToReturn;
+ }
+
+ public static Collection<StateMachineArtifact> filterOutState(Collection<StateMachineArtifact> smas, Collection<String> stateNames) throws OseeCoreException {
+ List<StateMachineArtifact> artifactsToReturn = new ArrayList<StateMachineArtifact>(smas.size());
+ for (StateMachineArtifact sma : smas) {
+ if (!stateNames.contains(sma.getStateMgr().getCurrentStateName())) {
+ artifactsToReturn.add(sma);
+ }
+ }
+ return artifactsToReturn;
+ }
+
+ public static Collection<StateMachineArtifact> filterOutTypes(Collection<StateMachineArtifact> smas, Collection<Class<?>> classes) throws OseeCoreException {
+ List<StateMachineArtifact> artifactsToReturn = new ArrayList<StateMachineArtifact>(smas.size());
+ for (StateMachineArtifact sma : smas) {
+ boolean found = false;
+ for (Class<?> clazz : classes) {
+ if (clazz.isInstance(sma)) {
+ found = true;
+ }
+ }
+ if (!found) {
+ artifactsToReturn.add(sma);
+ }
+ }
+ return artifactsToReturn;
+ }
+
+ public static Collection<StateMachineArtifact> getOpenAtDate(Date date, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
+ List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
+ for (StateMachineArtifact sma : artifacts) {
+ Date createDate = sma.getWorldViewCreatedDate();
+ Date completedCancelDate = null;
+ if (sma.isCancelledOrCompleted()) {
+ if (sma.isCancelled()) {
+ completedCancelDate = sma.getWorldViewCancelledDate();
+ } else {
+ completedCancelDate = sma.getWorldViewCompletedDate();
+ }
+ }
+ if (createDate.before(date) && (completedCancelDate == null || completedCancelDate.after(date))) {
+ smas.add(sma);
+ }
+ }
+ return smas;
+ }
+
+ public static Collection<StateMachineArtifact> getCompletedCancelledBetweenDate(Date startDate, Date endDate, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
+ List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
+ for (StateMachineArtifact sma : artifacts) {
+ Date completedCancelDate = null;
+ if (sma.isCancelledOrCompleted()) {
+ if (sma.isCancelled()) {
+ completedCancelDate = sma.getWorldViewCancelledDate();
+ } else {
+ completedCancelDate = sma.getWorldViewCompletedDate();
+ }
+ }
+ if (completedCancelDate == null) {
+ continue;
+ }
+ if (completedCancelDate.after(startDate) && completedCancelDate.before(endDate)) {
+ smas.add(sma);
+ }
+ }
+ return smas;
+ }
+
+ public static Double getHoursSpent(Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
+ Double hoursSpent = 0.0;
+ for (StateMachineArtifact sma : artifacts) {
+ hoursSpent += sma.getWorldViewHoursSpentTotal();
+ }
+ return hoursSpent;
+ }
+
+ public static Collection<StateMachineArtifact> getStateAtDate(Date date, Collection<String> states, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
+ List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
+ for (StateMachineArtifact sma : artifacts) {
+ Date createDate = sma.getWorldViewCreatedDate();
+ if (createDate.after(date)) {
+ continue;
+ }
+ // Find state at date
+ String currentState = sma.getStateMgr().getCurrentStateName();
+ for (LogItem item : sma.getLog().getLogItems()) {
+ if (item.getDate().before(date)) {
+ currentState = item.getState();
+ }
+ }
+ if (states.contains(currentState)) {
+ smas.add(sma);
+ }
+ }
+ return smas;
+ }
+
+ /**
+ * Returns sma if change type, or parent team workflow's change type is in specified set
+ *
+ * @param changeTypes
+ * @param artifacts
+ * @throws OseeCoreException
+ */
+ public static Collection<StateMachineArtifact> getChangeType(Collection<ChangeType> changeTypes, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
+ List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
+ for (StateMachineArtifact sma : artifacts) {
+ TeamWorkFlowArtifact teamArt = sma.getParentTeamWorkflow();
+ if (changeTypes.contains(teamArt.getChangeType())) {
+ smas.add(sma);
+ }
+ }
+ return smas;
+
+ }
+
+ /**
+ * Returns sma if priority type, or parent team workflow's priority type is in specified set
+ *
+ * @param priorityTypes
+ * @param artifacts
+ * @throws OseeCoreException
+ */
+ public static Collection<StateMachineArtifact> getPriorityType(Collection<PriorityType> priorityTypes, Collection<StateMachineArtifact> artifacts) throws OseeCoreException {
+ List<StateMachineArtifact> smas = new ArrayList<StateMachineArtifact>();
+ for (StateMachineArtifact sma : artifacts) {
+ TeamWorkFlowArtifact teamArt = sma.getParentTeamWorkflow();
+ if (priorityTypes.contains(teamArt.getPriority())) {
+ smas.add(sma);
+ }
+ }
+ return smas;
+
+ }
+
+ public static Collection<StateMachineArtifact> getTeamDefinitionWorkflows(Collection<? extends Artifact> artifacts, Collection<TeamDefinitionArtifact> teamDefs) throws OseeCoreException {
+ List<StateMachineArtifact> returnSmas = new ArrayList<StateMachineArtifact>();
+ for (StateMachineArtifact sma : getSMAs(artifacts)) {
+ if (sma.getParentTeamWorkflow() == null) {
+ continue;
+ }
+ if (teamDefs.contains(sma.getParentTeamWorkflow().getTeamDefinition())) {
+ returnSmas.add(sma);
+ }
+ }
+ return returnSmas;
+ }
+
+ public static Collection<StateMachineArtifact> getVersionWorkflows(Collection<? extends Artifact> artifacts, Collection<VersionArtifact> versionArts) throws OseeCoreException {
+ List<StateMachineArtifact> returnSmas = new ArrayList<StateMachineArtifact>();
+ for (StateMachineArtifact sma : getSMAs(artifacts)) {
+ if (sma.getParentTeamWorkflow() == null) {
+ continue;
+ }
+ if (sma.getWorldViewTargetedVersion() == null) {
+ continue;
+ }
+ if (versionArts.contains(sma.getWorldViewTargetedVersion())) {
+ returnSmas.add(sma);
+ }
+ }
+ return returnSmas;
+ }
+
+ public static Collection<StateMachineArtifact> getSMAs(Collection<? extends Artifact> artifacts) throws OseeCoreException {
+ return Collections.castMatching(StateMachineArtifact.class, artifacts);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/StateManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/StateManager.java
index 8fffff4399c..d9000b30406 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/StateManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/StateManager.java
@@ -1,387 +1,387 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.LogItem;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.util.widgets.SMAState;
-import org.eclipse.osee.ats.util.widgets.XCurrentStateDam;
-import org.eclipse.osee.ats.util.widgets.XStateDam;
-import org.eclipse.osee.framework.core.data.SystemUser;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-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;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class StateManager {
-
- private final XCurrentStateDam currentStateDam;
- private final XStateDam stateDam;
- private final StateMachineArtifact sma;
-
- public StateManager(StateMachineArtifact sma) throws OseeStateException {
- super();
- this.sma = sma;
- currentStateDam = new XCurrentStateDam(sma);
- stateDam = new XStateDam(sma);
- }
-
- /**
- * Get state and create if not there.
- *
- * @param name
- * @param create
- * @return state matching name
- */
- private SMAState getSMAState(String name, boolean create) throws OseeCoreException {
- if (currentStateDam.getState().getName().equals(name))
- return currentStateDam.getState();
- else
- return (stateDam.getState(name, create));
- }
-
- /**
- * Discouraged Access. This method should not normally be called except in cases were state data is being manually
- * created.
- *
- * @param name
- * @throws OseeCoreException
- */
- public void internalCreateIfNotExists(String name) throws OseeCoreException {
- if (isStateVisited(name)) {
- return;
- }
- SMAState smaState = getSMAState(name, true);
- putState(smaState);
- }
-
- /**
- * This method will create an assignee relation for each current assignee. Assignees are related to user artifacts to
- * speed up ATS searching. This does not persist the artifact.<br>
- * <br>
- * The "UnAssigned" user is no longer related due to the performance and event service issues with having a single
- * user related to > 5000 items. Since these relations are only used for searching, no need to have them for
- * "UnAssigned".
- */
- public static void updateAssigneeRelations(StateMachineArtifact sma) throws OseeCoreException {
- Collection<User> assignees = sma.getStateMgr().getAssignees();
- assignees.remove(UserManager.getUser(SystemUser.UnAssigned));
- sma.setRelations(CoreRelationTypes.Users_User, assignees);
- }
-
- /**
- * @return true if UnAssigned user is currently an assignee
- * @throws OseeCoreException
- */
- public boolean isUnAssigned() throws OseeCoreException {
- return getAssignees().contains(UserManager.getUser(SystemUser.UnAssigned));
- }
-
- public boolean isUnAssignedSolely() throws OseeCoreException {
- return getAssignees().size() == 1 && isUnAssigned();
- }
-
- /**
- * Return Hours Spent for State
- *
- * @param stateName
- * @return hours spent or 0 if none
- */
- public double getHoursSpent(String stateName) throws OseeCoreException {
- SMAState state = getSMAState(stateName, false);
- if (state == null) return 0.0;
- return state.getHoursSpent();
- }
-
- public double getHoursSpent() throws OseeCoreException {
- return getHoursSpent(getCurrentStateName());
- }
-
- /**
- * Return Percent Complete for State
- *
- * @param stateName
- * @return percent complete or 0 if none
- */
- public int getPercentComplete(String stateName) throws OseeCoreException {
- if (stateName.equals(DefaultTeamState.Completed.name()) || stateName.equals(DefaultTeamState.Cancelled.name())) return 100;
- SMAState state = getSMAState(stateName, false);
- if (state == null) return 0;
- return state.getPercentComplete();
-
- }
-
- public int getPercentComplete() throws OseeCoreException {
- return getPercentComplete(getCurrentStateName());
- }
-
- public String getCurrentStateName() throws OseeCoreException {
- return currentStateDam.getState().getName();
- }
-
- public String getAssigneesStr() throws OseeCoreException {
- return Artifacts.toString("; ", sma.getStateMgr().getAssignees());
- }
-
- public String getAssigneesStr(int length) throws OseeCoreException {
- String str = getAssigneesStr();
- if (str.length() > length) {
- return str.substring(0, length - 1) + "...";
- }
- return str;
- }
-
- public Collection<User> getAssignees() throws OseeCoreException {
- return getAssignees(getCurrentStateName());
- }
-
- public Collection<User> getAssignees(String stateName) throws OseeCoreException {
- SMAState state = getSMAState(stateName, false);
- if (state != null)
- return state.getAssignees();
- else
- return Collections.emptyList();
- }
-
- public void updateMetrics(double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException {
- updateMetrics(getCurrentStateName(), additionalHours, percentComplete, logMetrics);
- }
-
- public void updateMetrics(String stateName, double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException {
- if (stateName.equals(getCurrentStateName()))
- currentStateDam.updateMetrics(additionalHours, percentComplete, logMetrics);
- else
- stateDam.updateMetrics(stateName, additionalHours, percentComplete, logMetrics);
- }
-
- public void setMetrics(double hours, int percentComplete, boolean logMetrics) throws OseeCoreException {
- currentStateDam.setMetrics(hours, percentComplete, logMetrics);
- }
-
- /**
- * Sets the assignees as attributes and relations AND writes to SMA. Does not persist.
- *
- * @param assignees
- * @throws Exception
- */
- public void setAssignees(Collection<User> assignees) throws OseeCoreException {
- SMAState state = getSMAState(getCurrentStateName(), false);
- state.setAssignees(assignees);
- putState(state);
- }
-
- /**
- * Sets the assignee AND writes to SMA. Does not persist.
- *
- * @param assignee
- * @throws Exception
- */
- public void setAssignee(String stateName, User assignee) throws OseeCoreException {
- if (!isStateVisited(stateName)) throw new OseeArgumentException("State " + stateName + " does not exist.");
- SMAState state = getSMAState(stateName, false);
- state.setAssignee(assignee);
- putState(state);
- }
-
- /**
- * Sets the assignee AND writes to SMA. Does not persist.
- *
- * @param assignee
- * @throws Exception
- */
- public void setAssignee(User assignee) throws OseeCoreException {
- SMAState state = getSMAState(getCurrentStateName(), false);
- state.setAssignee(assignee);
- putState(state);
- }
-
- /**
- * Removes the assignee from stateName state AND writes to SMA. Does not persist.
- *
- * @param stateName
- * @param assignee
- * @throws Exception
- */
- public void removeAssignee(String stateName, User assignee) throws OseeCoreException {
- if (!isStateVisited(stateName)) return;
- SMAState state = getSMAState(stateName, false);
- state.removeAssignee(assignee);
- putState(state);
- }
-
- /**
- * Removes the assignee AND writes to SMA. Does not persist.
- *
- * @param assignee
- * @throws Exception
- */
- public void removeAssignee(User assignee) throws OseeCoreException {
- SMAState state = getSMAState(getCurrentStateName(), false);
- state.removeAssignee(assignee);
- putState(state);
- }
-
- /**
- * Adds the assignee AND writes to SMA. Does not persist. Will remove UnAssigned user if another assignee exists.
- *
- * @param assignee
- * @throws Exception
- */
- public void addAssignee(User assignee) throws OseeCoreException {
- SMAState state = getSMAState(getCurrentStateName(), false);
- state.addAssignee(assignee);
- if (state.getAssignees().size() > 1 && state.getAssignees().contains(UserManager.getUser(SystemUser.UnAssigned))) {
- state.removeAssignee(UserManager.getUser(SystemUser.UnAssigned));
- }
- putState(state);
- }
-
- /**
- * Removes ALL assignees AND writes to SMA. Does not persist.
- *
- * @param assignee
- * @throws Exception
- */
- public void clearAssignees() throws OseeCoreException {
- SMAState state = getSMAState(getCurrentStateName(), false);
- state.clearAssignees();
- putState(state);
- }
-
- public boolean isStateVisited(String name) throws OseeCoreException {
- return getVisitedStateNames().contains(name);
- }
-
- public void transitionHelper(Collection<User> toAssignees, boolean persist, WorkPageDefinition fromPage, WorkPageDefinition toPage, String toStateName, String cancelReason) throws OseeCoreException {
- // Set XCurrentState info to XState
- stateDam.setState(currentStateDam.getState());
-
- // Set XCurrentState; If been to this state, copy state info from prev state; else create new
- SMAState previousState = stateDam.getState(toStateName, false);
- if (previousState != null) {
- if (toAssignees.size() > 0) previousState.setAssignees(toAssignees);
- currentStateDam.setState(previousState);
- } else {
- currentStateDam.setState(new SMAState(toStateName, toAssignees));
- }
- }
-
- /**
- * Initializes state machine and sets the current state to stateName
- *
- * @param stateName
- * @throws Exception
- */
- public void initializeStateMachine(String stateName) throws OseeCoreException {
- initializeStateMachine(stateName, null);
- }
-
- /**
- * Initializes state machine and sets the current state to stateName
- *
- * @param stateName
- * @param assignees
- * @throws Exception
- */
- public void initializeStateMachine(String stateName, Collection<User> assignees) throws OseeCoreException {
- SMAState smaState = null;
- if (getVisitedStateNames().contains(stateName)) {
- smaState = getSMAState(stateName, false);
- } else {
- if (assignees == null) {
- smaState = new SMAState(stateName, UserManager.getUser());
- } else {
- smaState = new SMAState(stateName, assignees);
- }
- }
- currentStateDam.setState(smaState);
- }
-
- private void putState(SMAState state) throws OseeCoreException {
- if (getCurrentStateName().equals(state.getName()))
- currentStateDam.setState(state);
- else
- stateDam.setState(state);
- }
-
- public Collection<String> getVisitedStateNames() throws OseeCoreException {
- Set<String> names = new HashSet<String>();
- for (SMAState state : stateDam.getStates()) {
- names.add(state.getName());
- }
- names.add(getCurrentStateName());
- return names;
- }
-
- public long getTimeInState() throws OseeCoreException {
- return getTimeInState(getCurrentStateName());
- }
-
- public long getTimeInState(String stateName) throws OseeCoreException {
- SMAState state = getSMAState(stateName, false);
- if (state == null) return 0;
- LogItem logItem = sma.getLog().getLastEvent(LogType.StateEntered);
- if (logItem == null) return 0;
- return (new Date()).getTime() - logItem.getDate().getTime();
- }
-
- /**
- * return currently assigned state machine artifacts
- */
- public static Set<Artifact> getAssigned(User user) throws OseeCoreException {
- return getAssigned(user, null);
- }
-
- /**
- * return currently assigned state machine artifacts that match clazz
- *
- * @param clazz to match or all if null
- */
- public static Set<Artifact> getAssigned(User user, Class<?> clazz) throws OseeCoreException {
- return getAssigned(user.getUserId(), clazz);
- }
-
- /**
- * return currently assigned state machine artifacts that match clazz
- *
- * @param clazz to match or all if null
- */
- public static Set<Artifact> getAssigned(String userId, Class<?> clazz) throws OseeCoreException {
- Set<Artifact> assigned = new HashSet<Artifact>();
- for (Artifact artifact : ArtifactQuery.getArtifactListFromAttribute(
- ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName(), "%<" + userId + ">%", AtsUtil.getAtsBranch())) {
- if (clazz == null || clazz.isInstance(artifact)) {
- assigned.add(artifact);
- }
- }
- return assigned;
-
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.LogItem;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.util.widgets.SMAState;
+import org.eclipse.osee.ats.util.widgets.XCurrentStateDam;
+import org.eclipse.osee.ats.util.widgets.XStateDam;
+import org.eclipse.osee.framework.core.data.SystemUser;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+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;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class StateManager {
+
+ private final XCurrentStateDam currentStateDam;
+ private final XStateDam stateDam;
+ private final StateMachineArtifact sma;
+
+ public StateManager(StateMachineArtifact sma) throws OseeStateException {
+ super();
+ this.sma = sma;
+ currentStateDam = new XCurrentStateDam(sma);
+ stateDam = new XStateDam(sma);
+ }
+
+ /**
+ * Get state and create if not there.
+ *
+ * @param name
+ * @param create
+ * @return state matching name
+ */
+ private SMAState getSMAState(String name, boolean create) throws OseeCoreException {
+ if (currentStateDam.getState().getName().equals(name))
+ return currentStateDam.getState();
+ else
+ return (stateDam.getState(name, create));
+ }
+
+ /**
+ * Discouraged Access. This method should not normally be called except in cases were state data is being manually
+ * created.
+ *
+ * @param name
+ * @throws OseeCoreException
+ */
+ public void internalCreateIfNotExists(String name) throws OseeCoreException {
+ if (isStateVisited(name)) {
+ return;
+ }
+ SMAState smaState = getSMAState(name, true);
+ putState(smaState);
+ }
+
+ /**
+ * This method will create an assignee relation for each current assignee. Assignees are related to user artifacts to
+ * speed up ATS searching. This does not persist the artifact.<br>
+ * <br>
+ * The "UnAssigned" user is no longer related due to the performance and event service issues with having a single
+ * user related to > 5000 items. Since these relations are only used for searching, no need to have them for
+ * "UnAssigned".
+ */
+ public static void updateAssigneeRelations(StateMachineArtifact sma) throws OseeCoreException {
+ Collection<User> assignees = sma.getStateMgr().getAssignees();
+ assignees.remove(UserManager.getUser(SystemUser.UnAssigned));
+ sma.setRelations(CoreRelationTypes.Users_User, assignees);
+ }
+
+ /**
+ * @return true if UnAssigned user is currently an assignee
+ * @throws OseeCoreException
+ */
+ public boolean isUnAssigned() throws OseeCoreException {
+ return getAssignees().contains(UserManager.getUser(SystemUser.UnAssigned));
+ }
+
+ public boolean isUnAssignedSolely() throws OseeCoreException {
+ return getAssignees().size() == 1 && isUnAssigned();
+ }
+
+ /**
+ * Return Hours Spent for State
+ *
+ * @param stateName
+ * @return hours spent or 0 if none
+ */
+ public double getHoursSpent(String stateName) throws OseeCoreException {
+ SMAState state = getSMAState(stateName, false);
+ if (state == null) return 0.0;
+ return state.getHoursSpent();
+ }
+
+ public double getHoursSpent() throws OseeCoreException {
+ return getHoursSpent(getCurrentStateName());
+ }
+
+ /**
+ * Return Percent Complete for State
+ *
+ * @param stateName
+ * @return percent complete or 0 if none
+ */
+ public int getPercentComplete(String stateName) throws OseeCoreException {
+ if (stateName.equals(DefaultTeamState.Completed.name()) || stateName.equals(DefaultTeamState.Cancelled.name())) return 100;
+ SMAState state = getSMAState(stateName, false);
+ if (state == null) return 0;
+ return state.getPercentComplete();
+
+ }
+
+ public int getPercentComplete() throws OseeCoreException {
+ return getPercentComplete(getCurrentStateName());
+ }
+
+ public String getCurrentStateName() throws OseeCoreException {
+ return currentStateDam.getState().getName();
+ }
+
+ public String getAssigneesStr() throws OseeCoreException {
+ return Artifacts.toString("; ", sma.getStateMgr().getAssignees());
+ }
+
+ public String getAssigneesStr(int length) throws OseeCoreException {
+ String str = getAssigneesStr();
+ if (str.length() > length) {
+ return str.substring(0, length - 1) + "...";
+ }
+ return str;
+ }
+
+ public Collection<User> getAssignees() throws OseeCoreException {
+ return getAssignees(getCurrentStateName());
+ }
+
+ public Collection<User> getAssignees(String stateName) throws OseeCoreException {
+ SMAState state = getSMAState(stateName, false);
+ if (state != null)
+ return state.getAssignees();
+ else
+ return Collections.emptyList();
+ }
+
+ public void updateMetrics(double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException {
+ updateMetrics(getCurrentStateName(), additionalHours, percentComplete, logMetrics);
+ }
+
+ public void updateMetrics(String stateName, double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException {
+ if (stateName.equals(getCurrentStateName()))
+ currentStateDam.updateMetrics(additionalHours, percentComplete, logMetrics);
+ else
+ stateDam.updateMetrics(stateName, additionalHours, percentComplete, logMetrics);
+ }
+
+ public void setMetrics(double hours, int percentComplete, boolean logMetrics) throws OseeCoreException {
+ currentStateDam.setMetrics(hours, percentComplete, logMetrics);
+ }
+
+ /**
+ * Sets the assignees as attributes and relations AND writes to SMA. Does not persist.
+ *
+ * @param assignees
+ * @throws Exception
+ */
+ public void setAssignees(Collection<User> assignees) throws OseeCoreException {
+ SMAState state = getSMAState(getCurrentStateName(), false);
+ state.setAssignees(assignees);
+ putState(state);
+ }
+
+ /**
+ * Sets the assignee AND writes to SMA. Does not persist.
+ *
+ * @param assignee
+ * @throws Exception
+ */
+ public void setAssignee(String stateName, User assignee) throws OseeCoreException {
+ if (!isStateVisited(stateName)) throw new OseeArgumentException("State " + stateName + " does not exist.");
+ SMAState state = getSMAState(stateName, false);
+ state.setAssignee(assignee);
+ putState(state);
+ }
+
+ /**
+ * Sets the assignee AND writes to SMA. Does not persist.
+ *
+ * @param assignee
+ * @throws Exception
+ */
+ public void setAssignee(User assignee) throws OseeCoreException {
+ SMAState state = getSMAState(getCurrentStateName(), false);
+ state.setAssignee(assignee);
+ putState(state);
+ }
+
+ /**
+ * Removes the assignee from stateName state AND writes to SMA. Does not persist.
+ *
+ * @param stateName
+ * @param assignee
+ * @throws Exception
+ */
+ public void removeAssignee(String stateName, User assignee) throws OseeCoreException {
+ if (!isStateVisited(stateName)) return;
+ SMAState state = getSMAState(stateName, false);
+ state.removeAssignee(assignee);
+ putState(state);
+ }
+
+ /**
+ * Removes the assignee AND writes to SMA. Does not persist.
+ *
+ * @param assignee
+ * @throws Exception
+ */
+ public void removeAssignee(User assignee) throws OseeCoreException {
+ SMAState state = getSMAState(getCurrentStateName(), false);
+ state.removeAssignee(assignee);
+ putState(state);
+ }
+
+ /**
+ * Adds the assignee AND writes to SMA. Does not persist. Will remove UnAssigned user if another assignee exists.
+ *
+ * @param assignee
+ * @throws Exception
+ */
+ public void addAssignee(User assignee) throws OseeCoreException {
+ SMAState state = getSMAState(getCurrentStateName(), false);
+ state.addAssignee(assignee);
+ if (state.getAssignees().size() > 1 && state.getAssignees().contains(UserManager.getUser(SystemUser.UnAssigned))) {
+ state.removeAssignee(UserManager.getUser(SystemUser.UnAssigned));
+ }
+ putState(state);
+ }
+
+ /**
+ * Removes ALL assignees AND writes to SMA. Does not persist.
+ *
+ * @param assignee
+ * @throws Exception
+ */
+ public void clearAssignees() throws OseeCoreException {
+ SMAState state = getSMAState(getCurrentStateName(), false);
+ state.clearAssignees();
+ putState(state);
+ }
+
+ public boolean isStateVisited(String name) throws OseeCoreException {
+ return getVisitedStateNames().contains(name);
+ }
+
+ public void transitionHelper(Collection<User> toAssignees, boolean persist, WorkPageDefinition fromPage, WorkPageDefinition toPage, String toStateName, String cancelReason) throws OseeCoreException {
+ // Set XCurrentState info to XState
+ stateDam.setState(currentStateDam.getState());
+
+ // Set XCurrentState; If been to this state, copy state info from prev state; else create new
+ SMAState previousState = stateDam.getState(toStateName, false);
+ if (previousState != null) {
+ if (toAssignees.size() > 0) previousState.setAssignees(toAssignees);
+ currentStateDam.setState(previousState);
+ } else {
+ currentStateDam.setState(new SMAState(toStateName, toAssignees));
+ }
+ }
+
+ /**
+ * Initializes state machine and sets the current state to stateName
+ *
+ * @param stateName
+ * @throws Exception
+ */
+ public void initializeStateMachine(String stateName) throws OseeCoreException {
+ initializeStateMachine(stateName, null);
+ }
+
+ /**
+ * Initializes state machine and sets the current state to stateName
+ *
+ * @param stateName
+ * @param assignees
+ * @throws Exception
+ */
+ public void initializeStateMachine(String stateName, Collection<User> assignees) throws OseeCoreException {
+ SMAState smaState = null;
+ if (getVisitedStateNames().contains(stateName)) {
+ smaState = getSMAState(stateName, false);
+ } else {
+ if (assignees == null) {
+ smaState = new SMAState(stateName, UserManager.getUser());
+ } else {
+ smaState = new SMAState(stateName, assignees);
+ }
+ }
+ currentStateDam.setState(smaState);
+ }
+
+ private void putState(SMAState state) throws OseeCoreException {
+ if (getCurrentStateName().equals(state.getName()))
+ currentStateDam.setState(state);
+ else
+ stateDam.setState(state);
+ }
+
+ public Collection<String> getVisitedStateNames() throws OseeCoreException {
+ Set<String> names = new HashSet<String>();
+ for (SMAState state : stateDam.getStates()) {
+ names.add(state.getName());
+ }
+ names.add(getCurrentStateName());
+ return names;
+ }
+
+ public long getTimeInState() throws OseeCoreException {
+ return getTimeInState(getCurrentStateName());
+ }
+
+ public long getTimeInState(String stateName) throws OseeCoreException {
+ SMAState state = getSMAState(stateName, false);
+ if (state == null) return 0;
+ LogItem logItem = sma.getLog().getLastEvent(LogType.StateEntered);
+ if (logItem == null) return 0;
+ return (new Date()).getTime() - logItem.getDate().getTime();
+ }
+
+ /**
+ * return currently assigned state machine artifacts
+ */
+ public static Set<Artifact> getAssigned(User user) throws OseeCoreException {
+ return getAssigned(user, null);
+ }
+
+ /**
+ * return currently assigned state machine artifacts that match clazz
+ *
+ * @param clazz to match or all if null
+ */
+ public static Set<Artifact> getAssigned(User user, Class<?> clazz) throws OseeCoreException {
+ return getAssigned(user.getUserId(), clazz);
+ }
+
+ /**
+ * return currently assigned state machine artifacts that match clazz
+ *
+ * @param clazz to match or all if null
+ */
+ public static Set<Artifact> getAssigned(String userId, Class<?> clazz) throws OseeCoreException {
+ Set<Artifact> assigned = new HashSet<Artifact>();
+ for (Artifact artifact : ArtifactQuery.getArtifactListFromAttribute(
+ ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName(), "%<" + userId + ">%", AtsUtil.getAtsBranch())) {
+ if (clazz == null || clazz.isInstance(artifact)) {
+ assigned.add(artifact);
+ }
+ }
+ return assigned;
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionMetrics.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionMetrics.java
index d84adf79375..508565099c6 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionMetrics.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionMetrics.java
@@ -1,114 +1,114 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-
-/**
- * @author Donald G. Dunne
- */
-public class VersionMetrics {
-
- private final VersionArtifact verArt;
- private final VersionTeamMetrics verTeamMet;
-
- public VersionMetrics(VersionArtifact verArt, VersionTeamMetrics verTeamMet) {
- this.verArt = verArt;
- this.verTeamMet = verTeamMet;
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer(verArt.getName() + "\n");
- try {
- sb.append("Workflows: " + verArt.getTargetedForTeamArtifacts().size());
- sb.append(" Problem: " + getTeamWorkFlows(ChangeType.Problem).size() + " Improve: " + getTeamWorkFlows(
- ChangeType.Improvement).size() + " Support: " + getTeamWorkFlows(ChangeType.Support).size());
- sb.append(" Release Date: " + verArt.getReleaseDate());
- VersionMetrics prevVerMet = getPreviousVerMetViaReleaseDate();
- if (prevVerMet == null) {
- sb.append(" Prev Release Version: <not found>");
- } else {
- sb.append(" Prev Release Version \"" + prevVerMet + "\" Release Date: " + verArt.getReleaseDate());
- }
- sb.append(" Start Date: " + getReleaseStartDate());
- sb.append(" Num Days: " + getNumberDaysInRelease());
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- return sb.toString();
- }
-
- public Integer getNumberDaysInRelease() throws OseeCoreException {
- Date startDate = getReleaseStartDate();
- if (startDate == null) return null;
- if (verArt.getReleaseDate() == null) return null;
- return XDate.calculateDifference(startDate, verArt.getReleaseDate());
- }
-
- public Date getReleaseStartDate() throws OseeCoreException {
- VersionMetrics prevVerMet = getPreviousVerMetViaReleaseDate();
- if (prevVerMet == null) return null;
- return prevVerMet.getVerArt().getReleaseDate();
- }
-
- public Collection<TeamWorkFlowArtifact> getTeamWorkFlows(ChangeType... changeType) throws OseeCoreException {
- List<ChangeType> changeTypes = Arrays.asList(changeType);
- Set<TeamWorkFlowArtifact> teams = new HashSet<TeamWorkFlowArtifact>();
- for (TeamWorkFlowArtifact team : verArt.getTargetedForTeamArtifacts()) {
- if (changeTypes.contains(team.getChangeType())) teams.add(team);
- }
- return teams;
- }
-
- public VersionMetrics getPreviousVerMetViaReleaseDate() throws OseeCoreException {
- if (verArt.getReleaseDate() == null) return null;
- int index = verTeamMet.getReleasedOrderedVersions().indexOf(this);
- if (index > 0) return verTeamMet.getReleasedOrderedVersions().get(index - 1);
- return null;
- }
-
- public VersionMetrics getNextVerMetViaReleaseDate() throws OseeCoreException {
- if (verArt.getReleaseDate() == null) return null;
- int index = verTeamMet.getReleasedOrderedVersions().indexOf(this);
- if (index < verTeamMet.getReleasedOrderedVersions().size() - 1) {
- return verTeamMet.getReleasedOrderedVersions().get(index + 1);
- }
- return null;
- }
-
- /**
- * @return the verArt
- */
- public VersionArtifact getVerArt() {
- return verArt;
- }
-
- /**
- * @return the verTeamMet
- */
- public VersionTeamMetrics getVerTeamMet() {
- return verTeamMet;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class VersionMetrics {
+
+ private final VersionArtifact verArt;
+ private final VersionTeamMetrics verTeamMet;
+
+ public VersionMetrics(VersionArtifact verArt, VersionTeamMetrics verTeamMet) {
+ this.verArt = verArt;
+ this.verTeamMet = verTeamMet;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer(verArt.getName() + "\n");
+ try {
+ sb.append("Workflows: " + verArt.getTargetedForTeamArtifacts().size());
+ sb.append(" Problem: " + getTeamWorkFlows(ChangeType.Problem).size() + " Improve: " + getTeamWorkFlows(
+ ChangeType.Improvement).size() + " Support: " + getTeamWorkFlows(ChangeType.Support).size());
+ sb.append(" Release Date: " + verArt.getReleaseDate());
+ VersionMetrics prevVerMet = getPreviousVerMetViaReleaseDate();
+ if (prevVerMet == null) {
+ sb.append(" Prev Release Version: <not found>");
+ } else {
+ sb.append(" Prev Release Version \"" + prevVerMet + "\" Release Date: " + verArt.getReleaseDate());
+ }
+ sb.append(" Start Date: " + getReleaseStartDate());
+ sb.append(" Num Days: " + getNumberDaysInRelease());
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ return sb.toString();
+ }
+
+ public Integer getNumberDaysInRelease() throws OseeCoreException {
+ Date startDate = getReleaseStartDate();
+ if (startDate == null) return null;
+ if (verArt.getReleaseDate() == null) return null;
+ return XDate.calculateDifference(startDate, verArt.getReleaseDate());
+ }
+
+ public Date getReleaseStartDate() throws OseeCoreException {
+ VersionMetrics prevVerMet = getPreviousVerMetViaReleaseDate();
+ if (prevVerMet == null) return null;
+ return prevVerMet.getVerArt().getReleaseDate();
+ }
+
+ public Collection<TeamWorkFlowArtifact> getTeamWorkFlows(ChangeType... changeType) throws OseeCoreException {
+ List<ChangeType> changeTypes = Arrays.asList(changeType);
+ Set<TeamWorkFlowArtifact> teams = new HashSet<TeamWorkFlowArtifact>();
+ for (TeamWorkFlowArtifact team : verArt.getTargetedForTeamArtifacts()) {
+ if (changeTypes.contains(team.getChangeType())) teams.add(team);
+ }
+ return teams;
+ }
+
+ public VersionMetrics getPreviousVerMetViaReleaseDate() throws OseeCoreException {
+ if (verArt.getReleaseDate() == null) return null;
+ int index = verTeamMet.getReleasedOrderedVersions().indexOf(this);
+ if (index > 0) return verTeamMet.getReleasedOrderedVersions().get(index - 1);
+ return null;
+ }
+
+ public VersionMetrics getNextVerMetViaReleaseDate() throws OseeCoreException {
+ if (verArt.getReleaseDate() == null) return null;
+ int index = verTeamMet.getReleasedOrderedVersions().indexOf(this);
+ if (index < verTeamMet.getReleasedOrderedVersions().size() - 1) {
+ return verTeamMet.getReleasedOrderedVersions().get(index + 1);
+ }
+ return null;
+ }
+
+ /**
+ * @return the verArt
+ */
+ public VersionArtifact getVerArt() {
+ return verArt;
+ }
+
+ /**
+ * @return the verTeamMet
+ */
+ public VersionTeamMetrics getVerTeamMet() {
+ return verTeamMet;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionTeamMetrics.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionTeamMetrics.java
index 8ef25463ef1..40132a0eacb 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionTeamMetrics.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/VersionTeamMetrics.java
@@ -1,120 +1,120 @@
-/*******************************************************************************
- * 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.ats.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class VersionTeamMetrics {
-
- private final TeamDefinitionArtifact verTeamDef;
- private List<VersionMetrics> releasedOrderedVersions = new ArrayList<VersionMetrics>();
- private Set<VersionMetrics> verMets = new HashSet<VersionMetrics>();
- Map<Date, VersionMetrics> relDateToVerMet = new HashMap<Date, VersionMetrics>();
-
- public VersionTeamMetrics(TeamDefinitionArtifact verTeamDef) throws OseeCoreException {
- this.verTeamDef = verTeamDef;
- loadMetrics();
- }
-
- private void loadMetrics() throws OseeCoreException {
- bulkLoadArtifacts();
- orderReleasedVersions();
- }
-
- private void bulkLoadArtifacts() throws OseeCoreException {
- RelationManager.getRelatedArtifacts(Arrays.asList(this.verTeamDef), 6,
- CoreRelationTypes.Default_Hierarchical__Child, AtsRelationTypes.TeamDefinitionToVersion_Version,
- AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow, AtsRelationTypes.SmaToTask_Task,
- AtsRelationTypes.ActionToWorkflow_Action);
- }
-
- private Map<TeamWorkFlowArtifact, Date> teamWorkflowToOrigDate = null;
-
- public Collection<TeamWorkFlowArtifact> getWorkflowsOriginatedBetween(Date startDate, Date endDate) throws OseeCoreException {
- if (teamWorkflowToOrigDate == null) {
- teamWorkflowToOrigDate = new HashMap<TeamWorkFlowArtifact, Date>();
- for (VersionArtifact verArt : verTeamDef.getVersionsArtifacts()) {
- for (TeamWorkFlowArtifact team : verArt.getTargetedForTeamArtifacts()) {
- Date origDate = team.getLog().getCreationDate();
- teamWorkflowToOrigDate.put(team, origDate);
- }
- }
- }
- Set<TeamWorkFlowArtifact> teams = new HashSet<TeamWorkFlowArtifact>();
- for (Entry<TeamWorkFlowArtifact, Date> entry : teamWorkflowToOrigDate.entrySet()) {
- if (entry.getValue() != null && entry.getValue().after(startDate) && entry.getValue().before(endDate)) {
- teams.add(entry.getKey());
- }
- }
- return teams;
- }
-
- private void orderReleasedVersions() throws OseeCoreException {
- for (VersionArtifact ver : verTeamDef.getVersionsArtifacts()) {
- VersionMetrics verMet = new VersionMetrics(ver, this);
- if (ver.getReleaseDate() != null) {
- relDateToVerMet.put(ver.getReleaseDate(), verMet);
- }
- verMets.add(verMet);
- }
- Date[] releases = relDateToVerMet.keySet().toArray(new Date[relDateToVerMet.keySet().size()]);
- Arrays.sort(releases);
- for (Date date : releases) {
- releasedOrderedVersions.add(relDateToVerMet.get(date));
- }
- }
-
- /**
- * @return the verTeamDef
- */
- public TeamDefinitionArtifact getVerTeamDef() {
- return verTeamDef;
- }
-
- /**
- * @return the releasedOrderedVersions
- */
- public List<VersionMetrics> getReleasedOrderedVersions() {
- return releasedOrderedVersions;
- }
-
- /**
- * @return the verMets
- */
- public Set<VersionMetrics> getVerMets() {
- return verMets;
- }
-
- /**
- * @return the relDateToVerMet
- */
- public Map<Date, VersionMetrics> getRelDateToVerMet() {
- return relDateToVerMet;
- }
-}
+/*******************************************************************************
+ * 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.ats.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class VersionTeamMetrics {
+
+ private final TeamDefinitionArtifact verTeamDef;
+ private List<VersionMetrics> releasedOrderedVersions = new ArrayList<VersionMetrics>();
+ private Set<VersionMetrics> verMets = new HashSet<VersionMetrics>();
+ Map<Date, VersionMetrics> relDateToVerMet = new HashMap<Date, VersionMetrics>();
+
+ public VersionTeamMetrics(TeamDefinitionArtifact verTeamDef) throws OseeCoreException {
+ this.verTeamDef = verTeamDef;
+ loadMetrics();
+ }
+
+ private void loadMetrics() throws OseeCoreException {
+ bulkLoadArtifacts();
+ orderReleasedVersions();
+ }
+
+ private void bulkLoadArtifacts() throws OseeCoreException {
+ RelationManager.getRelatedArtifacts(Arrays.asList(this.verTeamDef), 6,
+ CoreRelationTypes.Default_Hierarchical__Child, AtsRelationTypes.TeamDefinitionToVersion_Version,
+ AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow, AtsRelationTypes.SmaToTask_Task,
+ AtsRelationTypes.ActionToWorkflow_Action);
+ }
+
+ private Map<TeamWorkFlowArtifact, Date> teamWorkflowToOrigDate = null;
+
+ public Collection<TeamWorkFlowArtifact> getWorkflowsOriginatedBetween(Date startDate, Date endDate) throws OseeCoreException {
+ if (teamWorkflowToOrigDate == null) {
+ teamWorkflowToOrigDate = new HashMap<TeamWorkFlowArtifact, Date>();
+ for (VersionArtifact verArt : verTeamDef.getVersionsArtifacts()) {
+ for (TeamWorkFlowArtifact team : verArt.getTargetedForTeamArtifacts()) {
+ Date origDate = team.getLog().getCreationDate();
+ teamWorkflowToOrigDate.put(team, origDate);
+ }
+ }
+ }
+ Set<TeamWorkFlowArtifact> teams = new HashSet<TeamWorkFlowArtifact>();
+ for (Entry<TeamWorkFlowArtifact, Date> entry : teamWorkflowToOrigDate.entrySet()) {
+ if (entry.getValue() != null && entry.getValue().after(startDate) && entry.getValue().before(endDate)) {
+ teams.add(entry.getKey());
+ }
+ }
+ return teams;
+ }
+
+ private void orderReleasedVersions() throws OseeCoreException {
+ for (VersionArtifact ver : verTeamDef.getVersionsArtifacts()) {
+ VersionMetrics verMet = new VersionMetrics(ver, this);
+ if (ver.getReleaseDate() != null) {
+ relDateToVerMet.put(ver.getReleaseDate(), verMet);
+ }
+ verMets.add(verMet);
+ }
+ Date[] releases = relDateToVerMet.keySet().toArray(new Date[relDateToVerMet.keySet().size()]);
+ Arrays.sort(releases);
+ for (Date date : releases) {
+ releasedOrderedVersions.add(relDateToVerMet.get(date));
+ }
+ }
+
+ /**
+ * @return the verTeamDef
+ */
+ public TeamDefinitionArtifact getVerTeamDef() {
+ return verTeamDef;
+ }
+
+ /**
+ * @return the releasedOrderedVersions
+ */
+ public List<VersionMetrics> getReleasedOrderedVersions() {
+ return releasedOrderedVersions;
+ }
+
+ /**
+ * @return the verMets
+ */
+ public Set<VersionMetrics> getVerMets() {
+ return verMets;
+ }
+
+ /**
+ * @return the relDateToVerMet
+ */
+ public Map<Date, VersionMetrics> getRelDateToVerMet() {
+ return relDateToVerMet;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java
index 28c7c08e8b3..4bbc7a67f83 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsAttributeXWidgetProvider.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.util.widgets;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DefaultAttributeXWidgetProvider;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemAttributes;
-
-/**
- * Provides XFlatDam as default widget for specified attribute types
- *
- * @author Donald G. Dunne
- */
-public class AtsAttributeXWidgetProvider extends DefaultAttributeXWidgetProvider {
-
- List<String> attributeNames =
- Arrays.asList(WorkItemAttributes.TRANSITION.getAttributeTypeName(),
- WorkItemAttributes.WORK_DATA.getAttributeTypeName(), ATSAttributes.STATE_ATTRIBUTE.getStoreName(),
- ATSAttributes.ACTIONABLE_ITEM_GUID_ATTRIBUTE.getStoreName(),
- ATSAttributes.TEAM_DEFINITION_GUID_ATTRIBUTE.getStoreName(),
- ATSAttributes.TEAM_DEFINITION_GUID_ATTRIBUTE.getStoreName());
-
- @Override
- public List<DynamicXWidgetLayoutData> getDynamicXWidgetLayoutData(AttributeType attributeType) throws OseeCoreException {
- DynamicXWidgetLayoutData layoutData = super.getDynamicXWidgetLayoutData(attributeType).iterator().next();
- if (attributeNames.contains(attributeType.getName())) {
- layoutData.setXWidgetName("XFlatDam");
- }
- return Arrays.asList(layoutData);
- }
-}
+/*******************************************************************************
+ * 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.ats.util.widgets;
+
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DefaultAttributeXWidgetProvider;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemAttributes;
+
+/**
+ * Provides XFlatDam as default widget for specified attribute types
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsAttributeXWidgetProvider extends DefaultAttributeXWidgetProvider {
+
+ List<String> attributeNames =
+ Arrays.asList(WorkItemAttributes.TRANSITION.getAttributeTypeName(),
+ WorkItemAttributes.WORK_DATA.getAttributeTypeName(), ATSAttributes.STATE_ATTRIBUTE.getStoreName(),
+ ATSAttributes.ACTIONABLE_ITEM_GUID_ATTRIBUTE.getStoreName(),
+ ATSAttributes.TEAM_DEFINITION_GUID_ATTRIBUTE.getStoreName(),
+ ATSAttributes.TEAM_DEFINITION_GUID_ATTRIBUTE.getStoreName());
+
+ @Override
+ public List<DynamicXWidgetLayoutData> getDynamicXWidgetLayoutData(AttributeType attributeType) throws OseeCoreException {
+ DynamicXWidgetLayoutData layoutData = super.getDynamicXWidgetLayoutData(attributeType).iterator().next();
+ if (attributeNames.contains(attributeType.getName())) {
+ layoutData.setXWidgetName("XFlatDam");
+ }
+ return Arrays.asList(layoutData);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java
index 8bf860cd3b4..938431d2775 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * 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.ats.util.widgets;
-
-import org.eclipse.osee.ats.util.widgets.commit.XCommitManager;
-import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlabelGroupSelection;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetProvider;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsWidgetProvider implements IXWidgetProvider {
-
- @Override
- public XWidget createXWidget(String widgetName, String name, DynamicXWidgetLayoutData widgetLayoutData) {
- XWidget toReturn = null;
- if (widgetName.equals(XHyperlabelTeamDefinitionSelection.WIDGET_ID)) {
- XHyperlabelTeamDefinitionSelection widget = new XHyperlabelTeamDefinitionSelection(name);
- widget.setToolTip(widgetLayoutData.getToolTip());
- toReturn = widget;
- }
- if (widgetName.equals(XHyperlabelGroupSelection.WIDGET_ID)) {
- XHyperlabelGroupSelection widget = new XHyperlabelGroupSelection(name);
- widget.setToolTip(widgetLayoutData.getToolTip());
- toReturn = widget;
- }
- if (name.equals("Commit Manager") || widgetName.equals("XCommitManager")) {
- return new XCommitManager();
- }
- if (name.equals("Working Branch") || widgetName.equals("XWorkingBranch")) {
- return new XWorkingBranch();
- }
- 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.ats.util.widgets;
+
+import org.eclipse.osee.ats.util.widgets.commit.XCommitManager;
+import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlabelGroupSelection;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetProvider;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsWidgetProvider implements IXWidgetProvider {
+
+ @Override
+ public XWidget createXWidget(String widgetName, String name, DynamicXWidgetLayoutData widgetLayoutData) {
+ XWidget toReturn = null;
+ if (widgetName.equals(XHyperlabelTeamDefinitionSelection.WIDGET_ID)) {
+ XHyperlabelTeamDefinitionSelection widget = new XHyperlabelTeamDefinitionSelection(name);
+ widget.setToolTip(widgetLayoutData.getToolTip());
+ toReturn = widget;
+ }
+ if (widgetName.equals(XHyperlabelGroupSelection.WIDGET_ID)) {
+ XHyperlabelGroupSelection widget = new XHyperlabelGroupSelection(name);
+ widget.setToolTip(widgetLayoutData.getToolTip());
+ toReturn = widget;
+ }
+ if (name.equals("Commit Manager") || widgetName.equals("XCommitManager")) {
+ return new XCommitManager();
+ }
+ if (name.equals("Working Branch") || widgetName.equals("XWorkingBranch")) {
+ return new XWorkingBranch();
+ }
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/DecisionOption.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/DecisionOption.java
index 1743df150e0..4554585abbe 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/DecisionOption.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/DecisionOption.java
@@ -1,178 +1,178 @@
-/*******************************************************************************
- * 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.ats.util.widgets;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-
-public class DecisionOption {
- private String name;
- private Collection<User> assignees = new HashSet<User>();
- private boolean followupRequired;
-
- @Override
- public int hashCode() {
- int result = 17;
- result = 31 * result + name.hashCode();
-
- return result;
- }
-
- public DecisionOption(String name, Collection<User> assignees, boolean followup) {
- this.name = name;
- this.followupRequired = followup;
- if (assignees != null)
- this.assignees = assignees;
- }
-
- public DecisionOption(String name, User assignee, boolean followup) {
- this.name = name;
- this.followupRequired = followup;
- if (assignee != null)
- this.assignees.add(assignee);
- }
-
- public DecisionOption(String name) {
- this(name, (User) null, false);
- }
-
- public DecisionOption() {
- this("", (User) null, false);
- }
-
- @Override
- public String toString() {
- return name;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof DecisionOption) {
- DecisionOption state = (DecisionOption) obj;
- if (!state.name.equals(name))
- return false;
- return true;
- }
- return super.equals(obj);
- }
-
- public Collection<User> getAssignees() {
- return assignees;
- }
-
- /**
- * Sets the assigness but DOES NOT write to SMA. This method should NOT be called outside the StateMachineArtifact.
- *
- * @param assignees
- */
- public void setAssignees(Collection<User> assignees) {
- this.assignees.clear();
- if (assignees != null)
- this.assignees.addAll(assignees);
- }
-
- /**
- * Sets the assignes but DOES NOT write to SMA. This method should NOT be called outside the StateMachineArtifact.
- *
- * @param assignee
- */
- public void setAssignee(User assignee) {
- this.assignees.clear();
- if (assignee != null)
- this.assignees.add(assignee);
- }
-
- /**
- * @param assignee
- */
- public void addAssignee(User assignee) {
- if (assignee != null)
- this.assignees.add(assignee);
- }
-
- /**
- * @return Returns the name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- public String toXml() throws OseeCoreException {
- StringBuffer sb = new StringBuffer(name);
- sb.append(";");
- for (User u : assignees)
- sb.append("<" + u.getUserId() + ">");
- sb.append(";");
- sb.append(followupRequired);
- return sb.toString();
- }
-
- public Result setFromXml(String xml) {
- Matcher m = Pattern.compile("^(.*?);(.*?);(.*)$").matcher(xml);
- if (m.find()) {
- name = m.group(1);
- if (name.equals(""))
- return new Result("Invalid name");
- if (m.group(2).toLowerCase().equals("followup"))
- followupRequired = true;
- else if (m.group(2).toLowerCase().equals("completed"))
- followupRequired = false;
- else
- return new Result("Invalid followup string \"" + m.group(2) + "\"\nShould be followup or completed");
- m = Pattern.compile("<(.*?)>").matcher(m.group(3));
- while (m.find()) {
- try {
- assignees.add(UserManager.getUserByUserId(m.group(1)));
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- if (followupRequired && assignees.isEmpty())
- return new Result("If followup is specified, must set assignees.\nShould be: <userid><userid>");
- else if (!followupRequired && assignees.size() > 0)
- return new Result("If completed is specified, don't specify assigness. Leave blank.\n");
- } else
- return new Result(
- "Can't unpack decision option data => " + xml + "\n\n" + "must be in format: \"Name;(followup|completed);<userid1><userid2>\"" + "where true if followup is required; false if not. If followup required, assignees will be userid1, userid2.");
- return Result.TrueResult;
- }
-
- /**
- * @return the followupRequired
- */
- public boolean isFollowupRequired() {
- return followupRequired;
- }
-
- /**
- * @param followupRequired the followupRequired to set
- */
- public void setFollowupRequired(boolean followupRequired) {
- this.followupRequired = followupRequired;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+
+public class DecisionOption {
+ private String name;
+ private Collection<User> assignees = new HashSet<User>();
+ private boolean followupRequired;
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + name.hashCode();
+
+ return result;
+ }
+
+ public DecisionOption(String name, Collection<User> assignees, boolean followup) {
+ this.name = name;
+ this.followupRequired = followup;
+ if (assignees != null)
+ this.assignees = assignees;
+ }
+
+ public DecisionOption(String name, User assignee, boolean followup) {
+ this.name = name;
+ this.followupRequired = followup;
+ if (assignee != null)
+ this.assignees.add(assignee);
+ }
+
+ public DecisionOption(String name) {
+ this(name, (User) null, false);
+ }
+
+ public DecisionOption() {
+ this("", (User) null, false);
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof DecisionOption) {
+ DecisionOption state = (DecisionOption) obj;
+ if (!state.name.equals(name))
+ return false;
+ return true;
+ }
+ return super.equals(obj);
+ }
+
+ public Collection<User> getAssignees() {
+ return assignees;
+ }
+
+ /**
+ * Sets the assigness but DOES NOT write to SMA. This method should NOT be called outside the StateMachineArtifact.
+ *
+ * @param assignees
+ */
+ public void setAssignees(Collection<User> assignees) {
+ this.assignees.clear();
+ if (assignees != null)
+ this.assignees.addAll(assignees);
+ }
+
+ /**
+ * Sets the assignes but DOES NOT write to SMA. This method should NOT be called outside the StateMachineArtifact.
+ *
+ * @param assignee
+ */
+ public void setAssignee(User assignee) {
+ this.assignees.clear();
+ if (assignee != null)
+ this.assignees.add(assignee);
+ }
+
+ /**
+ * @param assignee
+ */
+ public void addAssignee(User assignee) {
+ if (assignee != null)
+ this.assignees.add(assignee);
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String toXml() throws OseeCoreException {
+ StringBuffer sb = new StringBuffer(name);
+ sb.append(";");
+ for (User u : assignees)
+ sb.append("<" + u.getUserId() + ">");
+ sb.append(";");
+ sb.append(followupRequired);
+ return sb.toString();
+ }
+
+ public Result setFromXml(String xml) {
+ Matcher m = Pattern.compile("^(.*?);(.*?);(.*)$").matcher(xml);
+ if (m.find()) {
+ name = m.group(1);
+ if (name.equals(""))
+ return new Result("Invalid name");
+ if (m.group(2).toLowerCase().equals("followup"))
+ followupRequired = true;
+ else if (m.group(2).toLowerCase().equals("completed"))
+ followupRequired = false;
+ else
+ return new Result("Invalid followup string \"" + m.group(2) + "\"\nShould be followup or completed");
+ m = Pattern.compile("<(.*?)>").matcher(m.group(3));
+ while (m.find()) {
+ try {
+ assignees.add(UserManager.getUserByUserId(m.group(1)));
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ if (followupRequired && assignees.isEmpty())
+ return new Result("If followup is specified, must set assignees.\nShould be: <userid><userid>");
+ else if (!followupRequired && assignees.size() > 0)
+ return new Result("If completed is specified, don't specify assigness. Leave blank.\n");
+ } else
+ return new Result(
+ "Can't unpack decision option data => " + xml + "\n\n" + "must be in format: \"Name;(followup|completed);<userid1><userid2>\"" + "where true if followup is required; false if not. If followup required, assignees will be userid1, userid2.");
+ return Result.TrueResult;
+ }
+
+ /**
+ * @return the followupRequired
+ */
+ public boolean isFollowupRequired() {
+ return followupRequired;
+ }
+
+ /**
+ * @param followupRequired the followupRequired to set
+ */
+ public void setFollowupRequired(boolean followupRequired) {
+ this.followupRequired = followupRequired;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/SMAState.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/SMAState.java
index 084a60af60d..7541ea95360 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/SMAState.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/SMAState.java
@@ -1,225 +1,225 @@
-/*******************************************************************************
- * 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.ats.util.widgets;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.framework.core.data.SystemUser;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.utility.UsersByIds;
-
-public class SMAState {
- private String name;
- private Collection<User> assignees = new HashSet<User>();
- private int percentComplete = 0;
- private double hoursSpent = 0;
-
- @Override
- public int hashCode() {
- int result = 17;
- result = result * 31 + name.hashCode();
- result = result * 31 + assignees.hashCode();
-
- return result;
- }
-
- public SMAState(String name, Collection<User> assignees) {
- this.name = Strings.intern(name);
- if (assignees != null) {
- this.assignees = assignees;
- }
- }
-
- public SMAState(String name, User assignee) {
- this.name = Strings.intern(name);
- if (assignee != null) {
- this.assignees.add(assignee);
- }
- }
-
- public SMAState(String name) {
- this(name, (User) null);
- }
-
- public SMAState() {
- this("", (User) null);
- }
-
- @Override
- public String toString() {
- return name;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof SMAState) {
- SMAState state = (SMAState) obj;
- if (!state.name.equals(name)) {
- return false;
- }
- if (!state.assignees.equals(this.assignees)) {
- return false;
- }
- return true;
- }
- return super.equals(obj);
- }
-
- public Collection<User> getAssignees() {
- return assignees;
- }
-
- /**
- * Sets the assignees but DOES NOT write to SMA. This method should NOT be called outside the StateMachineArtifact.
- *
- * @param assignees
- * @throws OseeCoreException
- */
- public void setAssignees(Collection<User> assignees) throws OseeCoreException {
- if (assignees != null) {
- if (assignees.contains(UserManager.getUser(SystemUser.OseeSystem)) || assignees.contains(UserManager.getUser(SystemUser.Guest))) {
- throw new OseeArgumentException("Can not assign workflow to OseeSystem or Guest");
- }
- if (assignees.size() > 1 && assignees.contains(UserManager.getUser(SystemUser.UnAssigned))) {
- throw new OseeArgumentException("Can not assign to user and UnAssigned");
- }
- if (assignees.size() > 0 && (name.equals(DefaultTeamState.Completed.name()) || name.equals(DefaultTeamState.Cancelled.name()))) {
- throw new OseeStateException("Can't assign completed/cancelled states.");
- }
- } else {
- assignees = new HashSet<User>();
- }
- this.assignees.clear();
- this.assignees.addAll(assignees);
-
- }
-
- public void clearAssignees() {
- this.assignees.clear();
- }
-
- /**
- * Sets the assignees but DOES NOT write to SMA. This method should NOT be called outside the StateMachineArtifact.
- *
- * @param assignee
- * @throws OseeCoreException
- * @throws IllegalOseeArgumentException
- */
- public void setAssignee(User assignee) throws OseeCoreException {
- if (assignee != null && (name.equals(DefaultTeamState.Completed.name()) || name.equals(DefaultTeamState.Cancelled.name()))) {
- throw new OseeStateException("Can't assign completed/cancelled states.");
- }
- if (assignee == UserManager.getUser(SystemUser.OseeSystem) || assignee == UserManager.getUser(SystemUser.Guest)) {
- throw new OseeArgumentException("Can not assign workflow to OseeSystem or Guest");
- }
- this.assignees.clear();
- if (assignee != null) {
- this.assignees.add(assignee);
- }
- }
-
- /**
- * @param assignee
- */
- public void addAssignee(User assignee) throws OseeCoreException {
- if (assignee == UserManager.getUser(SystemUser.OseeSystem) || assignee == UserManager.getUser(SystemUser.Guest)) {
- throw new OseeArgumentException("Can not assign workflow to OseeSystem or Guest");
- }
- if (assignee != null) {
- this.assignees.add(assignee);
- }
- }
-
- public void removeAssignee(User assignee) {
- if (assignee != null) {
- this.assignees.remove(assignee);
- }
- }
-
- /**
- * @return Returns the name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- public String toXml() throws OseeCoreException {
- StringBuffer sb = new StringBuffer(name);
- sb.append(";");
- sb.append(UsersByIds.getStorageString(assignees));
- sb.append(";");
- if (hoursSpent > 0) {
- sb.append(getHoursSpentStr());
- }
- sb.append(";");
- if (percentComplete > 0) {
- sb.append(percentComplete);
- }
- return sb.toString();
- }
-
- public static Pattern storagePattern = Pattern.compile("^(.*?);(.*?);(.*?);(.*?)$");
-
- public void setFromXml(String xml) throws OseeCoreException {
- if (xml == null || xml.equals("")) {
- name = "Unknown";
- return;
- }
- Matcher m = storagePattern.matcher(xml);
- if (m.find()) {
- name = m.group(1);
- if (!m.group(3).equals("")) {
- hoursSpent = new Float(m.group(3)).doubleValue();
- }
- if (!m.group(4).equals("")) {
- percentComplete = new Integer(m.group(4)).intValue();
- }
- assignees = UsersByIds.getUsers(m.group(2));
- } else {
- throw new OseeArgumentException("Can't unpack state data => " + xml);
- }
- }
-
- public double getHoursSpent() {
- return hoursSpent;
- }
-
- public String getHoursSpentStr() {
- return String.valueOf(hoursSpent);
- }
-
- public void setHoursSpent(double hoursSpent) {
- this.hoursSpent = hoursSpent;
- }
-
- public int getPercentComplete() {
- return percentComplete;
- }
-
- public void setPercentComplete(int percentComplete) {
- this.percentComplete = percentComplete;
- }
-}
+/*******************************************************************************
+ * 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.ats.util.widgets;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.framework.core.data.SystemUser;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.utility.UsersByIds;
+
+public class SMAState {
+ private String name;
+ private Collection<User> assignees = new HashSet<User>();
+ private int percentComplete = 0;
+ private double hoursSpent = 0;
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = result * 31 + name.hashCode();
+ result = result * 31 + assignees.hashCode();
+
+ return result;
+ }
+
+ public SMAState(String name, Collection<User> assignees) {
+ this.name = Strings.intern(name);
+ if (assignees != null) {
+ this.assignees = assignees;
+ }
+ }
+
+ public SMAState(String name, User assignee) {
+ this.name = Strings.intern(name);
+ if (assignee != null) {
+ this.assignees.add(assignee);
+ }
+ }
+
+ public SMAState(String name) {
+ this(name, (User) null);
+ }
+
+ public SMAState() {
+ this("", (User) null);
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof SMAState) {
+ SMAState state = (SMAState) obj;
+ if (!state.name.equals(name)) {
+ return false;
+ }
+ if (!state.assignees.equals(this.assignees)) {
+ return false;
+ }
+ return true;
+ }
+ return super.equals(obj);
+ }
+
+ public Collection<User> getAssignees() {
+ return assignees;
+ }
+
+ /**
+ * Sets the assignees but DOES NOT write to SMA. This method should NOT be called outside the StateMachineArtifact.
+ *
+ * @param assignees
+ * @throws OseeCoreException
+ */
+ public void setAssignees(Collection<User> assignees) throws OseeCoreException {
+ if (assignees != null) {
+ if (assignees.contains(UserManager.getUser(SystemUser.OseeSystem)) || assignees.contains(UserManager.getUser(SystemUser.Guest))) {
+ throw new OseeArgumentException("Can not assign workflow to OseeSystem or Guest");
+ }
+ if (assignees.size() > 1 && assignees.contains(UserManager.getUser(SystemUser.UnAssigned))) {
+ throw new OseeArgumentException("Can not assign to user and UnAssigned");
+ }
+ if (assignees.size() > 0 && (name.equals(DefaultTeamState.Completed.name()) || name.equals(DefaultTeamState.Cancelled.name()))) {
+ throw new OseeStateException("Can't assign completed/cancelled states.");
+ }
+ } else {
+ assignees = new HashSet<User>();
+ }
+ this.assignees.clear();
+ this.assignees.addAll(assignees);
+
+ }
+
+ public void clearAssignees() {
+ this.assignees.clear();
+ }
+
+ /**
+ * Sets the assignees but DOES NOT write to SMA. This method should NOT be called outside the StateMachineArtifact.
+ *
+ * @param assignee
+ * @throws OseeCoreException
+ * @throws IllegalOseeArgumentException
+ */
+ public void setAssignee(User assignee) throws OseeCoreException {
+ if (assignee != null && (name.equals(DefaultTeamState.Completed.name()) || name.equals(DefaultTeamState.Cancelled.name()))) {
+ throw new OseeStateException("Can't assign completed/cancelled states.");
+ }
+ if (assignee == UserManager.getUser(SystemUser.OseeSystem) || assignee == UserManager.getUser(SystemUser.Guest)) {
+ throw new OseeArgumentException("Can not assign workflow to OseeSystem or Guest");
+ }
+ this.assignees.clear();
+ if (assignee != null) {
+ this.assignees.add(assignee);
+ }
+ }
+
+ /**
+ * @param assignee
+ */
+ public void addAssignee(User assignee) throws OseeCoreException {
+ if (assignee == UserManager.getUser(SystemUser.OseeSystem) || assignee == UserManager.getUser(SystemUser.Guest)) {
+ throw new OseeArgumentException("Can not assign workflow to OseeSystem or Guest");
+ }
+ if (assignee != null) {
+ this.assignees.add(assignee);
+ }
+ }
+
+ public void removeAssignee(User assignee) {
+ if (assignee != null) {
+ this.assignees.remove(assignee);
+ }
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String toXml() throws OseeCoreException {
+ StringBuffer sb = new StringBuffer(name);
+ sb.append(";");
+ sb.append(UsersByIds.getStorageString(assignees));
+ sb.append(";");
+ if (hoursSpent > 0) {
+ sb.append(getHoursSpentStr());
+ }
+ sb.append(";");
+ if (percentComplete > 0) {
+ sb.append(percentComplete);
+ }
+ return sb.toString();
+ }
+
+ public static Pattern storagePattern = Pattern.compile("^(.*?);(.*?);(.*?);(.*?)$");
+
+ public void setFromXml(String xml) throws OseeCoreException {
+ if (xml == null || xml.equals("")) {
+ name = "Unknown";
+ return;
+ }
+ Matcher m = storagePattern.matcher(xml);
+ if (m.find()) {
+ name = m.group(1);
+ if (!m.group(3).equals("")) {
+ hoursSpent = new Float(m.group(3)).doubleValue();
+ }
+ if (!m.group(4).equals("")) {
+ percentComplete = new Integer(m.group(4)).intValue();
+ }
+ assignees = UsersByIds.getUsers(m.group(2));
+ } else {
+ throw new OseeArgumentException("Can't unpack state data => " + xml);
+ }
+ }
+
+ public double getHoursSpent() {
+ return hoursSpent;
+ }
+
+ public String getHoursSpentStr() {
+ return String.valueOf(hoursSpent);
+ }
+
+ public void setHoursSpent(double hoursSpent) {
+ this.hoursSpent = hoursSpent;
+ }
+
+ public int getPercentComplete() {
+ return percentComplete;
+ }
+
+ public void setPercentComplete(int percentComplete) {
+ this.percentComplete = percentComplete;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XCurrentStateDam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XCurrentStateDam.java
index 62a2d3ce8d8..31c957c56a8 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XCurrentStateDam.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XCurrentStateDam.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * 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.ats.util.widgets;
-
-import java.util.Date;
-import java.util.Set;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.LogItem;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.StateManager;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class XCurrentStateDam extends XStateAssigneesDam {
-
- public XCurrentStateDam(StateMachineArtifact sma) {
- super(sma, ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName());
- }
-
- public SMAState getState() throws OseeCoreException {
- Set<SMAState> states = getStates();
- if (states.size() != 1) {
- throw new OseeArgumentException(
- "Must be one current state. Found " + states.size() + " for " + getSma().getGuid());
- }
- return states.iterator().next();
- }
-
- @Override
- public void setState(SMAState state) throws OseeCoreException {
- getSma().setSoleAttributeValue(attributeTypeName, state.toXml());
- StateManager.updateAssigneeRelations(getSma());
- }
-
- public void updateMetrics(double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException {
- SMAState currState = getState();
- currState.setHoursSpent(currState.getHoursSpent() + additionalHours);
- currState.setPercentComplete(percentComplete);
- setState(currState);
- if (logMetrics) {
- logMetrics();
- }
- }
-
- public void setMetrics(double hours, int percentComplete, boolean logMetrics) throws OseeCoreException {
- SMAState currState = getState();
- currState.setHoursSpent(hours);
- currState.setPercentComplete(percentComplete);
- setState(currState);
- if (logMetrics) {
- logMetrics();
- }
- }
-
- public void logMetrics() throws OseeCoreException {
- logMetrics(getSma(), getSma().getPercentCompleteSMATotal() + "",
- AtsUtil.doubleToI18nString(getSma().getHoursSpentSMATotal()), "", UserManager.getUser(), new Date());
- }
-
- public static void logMetrics(StateMachineArtifact sma, String percent, String hours, String stateName, User user, Date date) throws OseeCoreException {
- LogItem logItem =
- new LogItem(LogType.Metrics, date, user, stateName, String.format("Percent %s Hours %s", percent, hours),
- sma.getHumanReadableId());
- sma.getLog().addLogItem(logItem);
- }
+/*******************************************************************************
+ * 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.ats.util.widgets;
+
+import java.util.Date;
+import java.util.Set;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.LogItem;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.StateManager;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XCurrentStateDam extends XStateAssigneesDam {
+
+ public XCurrentStateDam(StateMachineArtifact sma) {
+ super(sma, ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName());
+ }
+
+ public SMAState getState() throws OseeCoreException {
+ Set<SMAState> states = getStates();
+ if (states.size() != 1) {
+ throw new OseeArgumentException(
+ "Must be one current state. Found " + states.size() + " for " + getSma().getGuid());
+ }
+ return states.iterator().next();
+ }
+
+ @Override
+ public void setState(SMAState state) throws OseeCoreException {
+ getSma().setSoleAttributeValue(attributeTypeName, state.toXml());
+ StateManager.updateAssigneeRelations(getSma());
+ }
+
+ public void updateMetrics(double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException {
+ SMAState currState = getState();
+ currState.setHoursSpent(currState.getHoursSpent() + additionalHours);
+ currState.setPercentComplete(percentComplete);
+ setState(currState);
+ if (logMetrics) {
+ logMetrics();
+ }
+ }
+
+ public void setMetrics(double hours, int percentComplete, boolean logMetrics) throws OseeCoreException {
+ SMAState currState = getState();
+ currState.setHoursSpent(hours);
+ currState.setPercentComplete(percentComplete);
+ setState(currState);
+ if (logMetrics) {
+ logMetrics();
+ }
+ }
+
+ public void logMetrics() throws OseeCoreException {
+ logMetrics(getSma(), getSma().getPercentCompleteSMATotal() + "",
+ AtsUtil.doubleToI18nString(getSma().getHoursSpentSMATotal()), "", UserManager.getUser(), new Date());
+ }
+
+ public static void logMetrics(StateMachineArtifact sma, String percent, String hours, String stateName, User user, Date date) throws OseeCoreException {
+ LogItem logItem =
+ new LogItem(LogType.Metrics, date, user, stateName, String.format("Percent %s Hours %s", percent, hours),
+ sma.getHumanReadableId());
+ sma.getLog().addLogItem(logItem);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XHyperlabelTeamDefinitionSelection.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XHyperlabelTeamDefinitionSelection.java
index 65166f7e24a..b013a75f5ae 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XHyperlabelTeamDefinitionSelection.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XHyperlabelTeamDefinitionSelection.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * 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.ats.util.widgets;
-
-import java.util.Collection;
-import java.util.HashSet;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.util.widgets.dialog.TeamDefinitionTreeWithChildrenDialog;
-import org.eclipse.osee.ats.world.WorldEditor;
-import org.eclipse.osee.framework.core.enums.Active;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlinkLabelCmdValueSelection;
-
-/**
- * @author Donald G. Dunne
- */
-public class XHyperlabelTeamDefinitionSelection extends XHyperlinkLabelCmdValueSelection {
-
- public static final String WIDGET_ID = XHyperlabelTeamDefinitionSelection.class.getSimpleName();
- Collection<TeamDefinitionArtifact> selectedTeamDefs = new HashSet<TeamDefinitionArtifact>();
- Collection<TeamDefinitionArtifact> teamDefs;
- TeamDefinitionTreeWithChildrenDialog dialog = null;
-
- public XHyperlabelTeamDefinitionSelection(String label) {
- super(label, true, WorldEditor.TITLE_MAX_LENGTH);
- }
-
- public Collection<TeamDefinitionArtifact> getSelectedTeamDefintions() {
- return selectedTeamDefs;
- }
-
- @Override
- public String getCurrentValue() {
- return Artifacts.commaArts(selectedTeamDefs);
- }
-
- public void setSelectedTeamDefs(Collection<TeamDefinitionArtifact> selectedTeamDefs) {
- this.selectedTeamDefs = selectedTeamDefs;
- refresh();
- notifyXModifiedListeners();
- }
-
- @Override
- public boolean handleClear() {
- selectedTeamDefs.clear();
- notifyXModifiedListeners();
- return true;
- }
-
- @Override
- public boolean handleSelection() {
- try {
- if (teamDefs == null) {
- dialog = new TeamDefinitionTreeWithChildrenDialog(Active.Both);
- } else {
- dialog = new TeamDefinitionTreeWithChildrenDialog(Active.Both, teamDefs);
- }
- int result = dialog.open();
- if (result == 0) {
- selectedTeamDefs.clear();
- for (Object obj : dialog.getResultAndRecursedTeamDefs()) {
- selectedTeamDefs.add((TeamDefinitionArtifact) obj);
- }
- notifyXModifiedListeners();
- }
- return true;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public void setTeamDefs(Collection<TeamDefinitionArtifact> teamDefs) {
- this.teamDefs = teamDefs;
- if (dialog != null) {
- dialog.setInput(teamDefs);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets;
+
+import java.util.Collection;
+import java.util.HashSet;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.util.widgets.dialog.TeamDefinitionTreeWithChildrenDialog;
+import org.eclipse.osee.ats.world.WorldEditor;
+import org.eclipse.osee.framework.core.enums.Active;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlinkLabelCmdValueSelection;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XHyperlabelTeamDefinitionSelection extends XHyperlinkLabelCmdValueSelection {
+
+ public static final String WIDGET_ID = XHyperlabelTeamDefinitionSelection.class.getSimpleName();
+ Collection<TeamDefinitionArtifact> selectedTeamDefs = new HashSet<TeamDefinitionArtifact>();
+ Collection<TeamDefinitionArtifact> teamDefs;
+ TeamDefinitionTreeWithChildrenDialog dialog = null;
+
+ public XHyperlabelTeamDefinitionSelection(String label) {
+ super(label, true, WorldEditor.TITLE_MAX_LENGTH);
+ }
+
+ public Collection<TeamDefinitionArtifact> getSelectedTeamDefintions() {
+ return selectedTeamDefs;
+ }
+
+ @Override
+ public String getCurrentValue() {
+ return Artifacts.commaArts(selectedTeamDefs);
+ }
+
+ public void setSelectedTeamDefs(Collection<TeamDefinitionArtifact> selectedTeamDefs) {
+ this.selectedTeamDefs = selectedTeamDefs;
+ refresh();
+ notifyXModifiedListeners();
+ }
+
+ @Override
+ public boolean handleClear() {
+ selectedTeamDefs.clear();
+ notifyXModifiedListeners();
+ return true;
+ }
+
+ @Override
+ public boolean handleSelection() {
+ try {
+ if (teamDefs == null) {
+ dialog = new TeamDefinitionTreeWithChildrenDialog(Active.Both);
+ } else {
+ dialog = new TeamDefinitionTreeWithChildrenDialog(Active.Both, teamDefs);
+ }
+ int result = dialog.open();
+ if (result == 0) {
+ selectedTeamDefs.clear();
+ for (Object obj : dialog.getResultAndRecursedTeamDefs()) {
+ selectedTeamDefs.add((TeamDefinitionArtifact) obj);
+ }
+ notifyXModifiedListeners();
+ }
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public void setTeamDefs(Collection<TeamDefinitionArtifact> teamDefs) {
+ this.teamDefs = teamDefs;
+ if (dialog != null) {
+ dialog.setInput(teamDefs);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XStateAssigneesDam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XStateAssigneesDam.java
index ab550bc3f40..ca2d424b391 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XStateAssigneesDam.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XStateAssigneesDam.java
@@ -1,135 +1,135 @@
-/*******************************************************************************
- * 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.ats.util.widgets;
-
-import java.lang.ref.WeakReference;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.StateManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.ui.skynet.widgets.XTextDam;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class XStateAssigneesDam extends XTextDam {
-
- protected final String attributeTypeName;
- private WeakReference<StateMachineArtifact> smaRef;
-
- public XStateAssigneesDam(StateMachineArtifact sma, String attributeName) {
- super(attributeName);
- this.smaRef = new WeakReference<StateMachineArtifact>(sma);
- this.attributeTypeName = attributeName;
- }
-
- public StateMachineArtifact getSma() throws OseeStateException {
- if (smaRef.get() == null) {
- throw new OseeStateException("Artifact has been garbage collected");
- }
- return smaRef.get();
- }
-
- public SMAState getState(String stateName, boolean create) {
- try {
- for (String stateXml : getSma().getAttributesToStringList(attributeTypeName)) {
- if (stateXml.startsWith(stateName + ";")) {
- SMAState state = new SMAState();
- state.setFromXml(stateXml);
- return state;
- }
- }
- if (create) {
- return new SMAState(stateName);
- }
- } catch (Exception ex) {
- try {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, "Error parsing state data for " + getSma().getGuid(), ex);
- } catch (OseeStateException ex1) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
- }
- }
- return null;
- }
-
- public void updateMetrics(String stateName, double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException {
- SMAState currState = getState(stateName, false);
- currState.setHoursSpent(currState.getHoursSpent() + additionalHours);
- currState.setPercentComplete(percentComplete);
- setState(currState);
- if (logMetrics) {
- XCurrentStateDam.logMetrics(getSma(), getSma().getPercentCompleteSMATotal() + "",
- AtsUtil.doubleToI18nString(getSma().getHoursSpentSMATotal()), stateName, UserManager.getUser(),
- new Date());
- }
- }
-
- public void setMetrics(String stateName, double hours, int percentComplete, boolean logMetrics) throws OseeCoreException {
- SMAState currState = getState(stateName, false);
- currState.setHoursSpent(hours);
- currState.setPercentComplete(percentComplete);
- setState(currState);
- if (logMetrics) {
- XCurrentStateDam.logMetrics(getSma(), getSma().getPercentCompleteSMATotal() + "",
- AtsUtil.doubleToI18nString(getSma().getHoursSpentSMATotal()), stateName, UserManager.getUser(),
- new Date());
- }
- }
-
- public Set<SMAState> getStates() {
- Set<SMAState> states = new HashSet<SMAState>();
- try {
- for (String stateXml : getSma().getAttributesToStringList(attributeTypeName)) {
- SMAState state = new SMAState();
- state.setFromXml(stateXml);
- states.add(state);
- }
- } catch (Exception ex) {
- try {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, "Error parsing state data for " + getSma().getGuid(), ex);
- } catch (OseeStateException ex1) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
- }
- }
- return states;
- }
-
- public void setState(SMAState state) throws OseeCoreException {
- // Update attribute if it already exists
- try {
- Collection<Attribute<String>> attrs = getSma().getAttributes(attributeTypeName);
- for (Attribute<String> attr : attrs) {
- SMAState storedState = new SMAState();
- storedState.setFromXml(attr.getValue());
- if (state.getName().equals(storedState.getName())) {
- attr.setValue(state.toXml());
- return;
- }
- }
- // Else, doesn't exist yet, create
- getSma().addAttribute(attributeTypeName, state.toXml());
- StateManager.updateAssigneeRelations(getSma());
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, "Error setting state data for " + getSma().getGuid(), ex);
- }
- }
-}
+/*******************************************************************************
+ * 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.ats.util.widgets;
+
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.StateManager;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+import org.eclipse.osee.framework.ui.skynet.widgets.XTextDam;
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class XStateAssigneesDam extends XTextDam {
+
+ protected final String attributeTypeName;
+ private WeakReference<StateMachineArtifact> smaRef;
+
+ public XStateAssigneesDam(StateMachineArtifact sma, String attributeName) {
+ super(attributeName);
+ this.smaRef = new WeakReference<StateMachineArtifact>(sma);
+ this.attributeTypeName = attributeName;
+ }
+
+ public StateMachineArtifact getSma() throws OseeStateException {
+ if (smaRef.get() == null) {
+ throw new OseeStateException("Artifact has been garbage collected");
+ }
+ return smaRef.get();
+ }
+
+ public SMAState getState(String stateName, boolean create) {
+ try {
+ for (String stateXml : getSma().getAttributesToStringList(attributeTypeName)) {
+ if (stateXml.startsWith(stateName + ";")) {
+ SMAState state = new SMAState();
+ state.setFromXml(stateXml);
+ return state;
+ }
+ }
+ if (create) {
+ return new SMAState(stateName);
+ }
+ } catch (Exception ex) {
+ try {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, "Error parsing state data for " + getSma().getGuid(), ex);
+ } catch (OseeStateException ex1) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ public void updateMetrics(String stateName, double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException {
+ SMAState currState = getState(stateName, false);
+ currState.setHoursSpent(currState.getHoursSpent() + additionalHours);
+ currState.setPercentComplete(percentComplete);
+ setState(currState);
+ if (logMetrics) {
+ XCurrentStateDam.logMetrics(getSma(), getSma().getPercentCompleteSMATotal() + "",
+ AtsUtil.doubleToI18nString(getSma().getHoursSpentSMATotal()), stateName, UserManager.getUser(),
+ new Date());
+ }
+ }
+
+ public void setMetrics(String stateName, double hours, int percentComplete, boolean logMetrics) throws OseeCoreException {
+ SMAState currState = getState(stateName, false);
+ currState.setHoursSpent(hours);
+ currState.setPercentComplete(percentComplete);
+ setState(currState);
+ if (logMetrics) {
+ XCurrentStateDam.logMetrics(getSma(), getSma().getPercentCompleteSMATotal() + "",
+ AtsUtil.doubleToI18nString(getSma().getHoursSpentSMATotal()), stateName, UserManager.getUser(),
+ new Date());
+ }
+ }
+
+ public Set<SMAState> getStates() {
+ Set<SMAState> states = new HashSet<SMAState>();
+ try {
+ for (String stateXml : getSma().getAttributesToStringList(attributeTypeName)) {
+ SMAState state = new SMAState();
+ state.setFromXml(stateXml);
+ states.add(state);
+ }
+ } catch (Exception ex) {
+ try {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, "Error parsing state data for " + getSma().getGuid(), ex);
+ } catch (OseeStateException ex1) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ }
+ return states;
+ }
+
+ public void setState(SMAState state) throws OseeCoreException {
+ // Update attribute if it already exists
+ try {
+ Collection<Attribute<String>> attrs = getSma().getAttributes(attributeTypeName);
+ for (Attribute<String> attr : attrs) {
+ SMAState storedState = new SMAState();
+ storedState.setFromXml(attr.getValue());
+ if (state.getName().equals(storedState.getName())) {
+ attr.setValue(state.toXml());
+ return;
+ }
+ }
+ // Else, doesn't exist yet, create
+ getSma().addAttribute(attributeTypeName, state.toXml());
+ StateManager.updateAssigneeRelations(getSma());
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, "Error setting state data for " + getSma().getGuid(), ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
index 5f8ff265ed3..fb388cfdde0 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
@@ -1,321 +1,321 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.util.widgets;
-
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
-import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
-import org.eclipse.osee.framework.skynet.core.event.IBranchEventListener;
-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.BranchEvent;
-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.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-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.swt.SWT;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * <REM2>
- *
- * @author Megumi Telles
- * @author Donald G. Dunne
- */
-public class XWorkingBranch extends XWidget implements IArtifactWidget, IArtifactEventListener, IFrameworkTransactionEventListener, IBranchEventListener {
-
- private TeamWorkFlowArtifact teamArt;
- private Button createBranchButton;
- private Button showArtifactExplorer;
- private Button showChangeReport;
- private Button deleteBranchButton;
- private XWorkingBranchEnablement enablement;
-
- public static enum BranchStatus {
- Not_Started,
- Changes_InProgress,
- Changes_NotPermitted
- }
- public final static String WIDGET_ID = ATSAttributes.WORKING_BRANCH_WIDGET.getStoreName();
-
- public XWorkingBranch() {
- super("Working Branch", "");
- OseeEventManager.addListener(this);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- if (horizontalSpan < 2) {
- horizontalSpan = 2;
- }
- if (!getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- }
-
- Composite bComp = new Composite(parent, SWT.NONE);
- bComp.setLayout(new GridLayout(4, false));
- bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- if (toolkit != null) {
- toolkit.adapt(bComp);
- }
-
- createBranchButton = createNewButton(bComp);
- createBranchButton.setToolTipText("Create Working Branch");
- createBranchButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- teamArt.getBranchMgr().createWorkingBranch(null, true);
- }
- });
-
- showArtifactExplorer = createNewButton(bComp);
- showArtifactExplorer.setToolTipText("Show Artifact Explorer");
- showArtifactExplorer.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- try {
- ArtifactExplorer.exploreBranch(teamArt.getWorkingBranch());
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
-
- showChangeReport = createNewButton(bComp);
- showChangeReport.setToolTipText("Show Change Report");
- showChangeReport.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- teamArt.getBranchMgr().showChangeReport();
- }
- });
-
- deleteBranchButton = createNewButton(bComp);
- deleteBranchButton.setToolTipText("Delete Working Branch");
- deleteBranchButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- teamArt.getBranchMgr().deleteWorkingBranch(true);
- refresh();
- }
- });
-
- if (AtsPlugin.getInstance() != null) {
- createBranchButton.setImage(ImageManager.getImage(FrameworkImage.BRANCH));
- deleteBranchButton.setImage(ImageManager.getImage(FrameworkImage.TRASH));
- }
- if (SkynetGuiPlugin.getInstance() != null) {
- showArtifactExplorer.setImage(ImageManager.getImage(FrameworkImage.ARTIFACT_EXPLORER));
- showChangeReport.setImage(ImageManager.getImage(FrameworkImage.BRANCH_CHANGE));
- }
- refreshLabel();
- refreshEnablement();
- }
-
- public Button createNewButton(Composite comp) {
- if (toolkit != null) {
- return toolkit.createButton(comp, null, SWT.PUSH);
- }
- return new Button(comp, SWT.PUSH);
- }
-
- public void refreshLabel() {
- if (!getLabel().equals("")) {
- try {
- labelWidget.setText(getLabel() + ": " + (enablement.getWorkingBranch() != null ? enablement.getWorkingBranch().getShortName() : "") + " " + enablement.getStatus().name());
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
- }
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
- }
-
- public void refreshEnablement() {
- createBranchButton.setEnabled(enablement.isCreateBranchButtonEnabled());
- showArtifactExplorer.setEnabled(enablement.isShowArtifactExplorerButtonEnabled());
- showChangeReport.setEnabled(enablement.isShowChangeReportButtonEnabled());
- deleteBranchButton.setEnabled(enablement.isDeleteBranchButtonEnabled());
- }
-
- public static boolean isPurgeBranchButtonEnabled(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
- return teamArt.getBranchMgr().isWorkingBranchInWork();
- }
-
- @Override
- public void setFocus() {
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- }
-
- @Override
- public Control getControl() {
- return labelWidget;
- }
-
- @Override
- public Object getData() {
- return null;
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public IStatus isValid() {
- // Need this cause it removes all error items of this namespace
- return new Status(IStatus.OK, getClass().getSimpleName(), "");
- }
-
- @Override
- public void refresh() {
- // don't do anything here cause to expensive to check for branch conditions during every refresh
- }
-
- public void refreshOnBranchEvent() {
- if (teamArt == null || teamArt.getBranchMgr() == null || labelWidget == null || labelWidget.isDisposed()) {
- return;
- }
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- enablement.refresh();
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Widgets.isAccessible(createBranchButton)) {
- refreshLabel();
- refreshEnablement();
- }
- }
- });
- }
- };
- Thread thread = new Thread(runnable);
- thread.start();
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String toHTML(String labelFont) {
- return "";
- }
-
- @Override
- public Result isDirty() {
- return Result.FalseResult;
- }
-
- @Override
- public void revert() {
- }
-
- @Override
- public void saveToArtifact() {
- }
-
- @Override
- public void setArtifact(Artifact artifact) {
- this.teamArt = (TeamWorkFlowArtifact) artifact;
- enablement = new XWorkingBranchEnablement(teamArt);
- }
-
- @Override
- public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, int branchId) {
- refreshOnBranchEvent();
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) {
- refreshOnBranchEvent();
- }
-
- public Button getCreateBranchButton() {
- return createBranchButton;
- }
-
- public Button getShowArtifactExplorerButton() {
- return showArtifactExplorer;
- }
-
- public Button getShowChangeReportButton() {
- return showChangeReport;
- }
-
- public Button getDeleteBranchButton() {
- return deleteBranchButton;
- }
-
- @Override
- public String toString() {
- return String.format("%s", getLabel());
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return AtsUtil.getAtsObjectEventFilters();
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- refreshOnBranchEvent();
- }
-
- @Override
- public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
- refreshOnBranchEvent();
- }
-
- @Override
- public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets;
+
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
+import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
+import org.eclipse.osee.framework.skynet.core.event.IBranchEventListener;
+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.BranchEvent;
+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.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+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.swt.SWT;
+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.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * <REM2>
+ *
+ * @author Megumi Telles
+ * @author Donald G. Dunne
+ */
+public class XWorkingBranch extends XWidget implements IArtifactWidget, IArtifactEventListener, IFrameworkTransactionEventListener, IBranchEventListener {
+
+ private TeamWorkFlowArtifact teamArt;
+ private Button createBranchButton;
+ private Button showArtifactExplorer;
+ private Button showChangeReport;
+ private Button deleteBranchButton;
+ private XWorkingBranchEnablement enablement;
+
+ public static enum BranchStatus {
+ Not_Started,
+ Changes_InProgress,
+ Changes_NotPermitted
+ }
+ public final static String WIDGET_ID = ATSAttributes.WORKING_BRANCH_WIDGET.getStoreName();
+
+ public XWorkingBranch() {
+ super("Working Branch", "");
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ if (horizontalSpan < 2) {
+ horizontalSpan = 2;
+ }
+ if (!getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ }
+
+ Composite bComp = new Composite(parent, SWT.NONE);
+ bComp.setLayout(new GridLayout(4, false));
+ bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ if (toolkit != null) {
+ toolkit.adapt(bComp);
+ }
+
+ createBranchButton = createNewButton(bComp);
+ createBranchButton.setToolTipText("Create Working Branch");
+ createBranchButton.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ teamArt.getBranchMgr().createWorkingBranch(null, true);
+ }
+ });
+
+ showArtifactExplorer = createNewButton(bComp);
+ showArtifactExplorer.setToolTipText("Show Artifact Explorer");
+ showArtifactExplorer.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ try {
+ ArtifactExplorer.exploreBranch(teamArt.getWorkingBranch());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+
+ showChangeReport = createNewButton(bComp);
+ showChangeReport.setToolTipText("Show Change Report");
+ showChangeReport.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ teamArt.getBranchMgr().showChangeReport();
+ }
+ });
+
+ deleteBranchButton = createNewButton(bComp);
+ deleteBranchButton.setToolTipText("Delete Working Branch");
+ deleteBranchButton.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ teamArt.getBranchMgr().deleteWorkingBranch(true);
+ refresh();
+ }
+ });
+
+ if (AtsPlugin.getInstance() != null) {
+ createBranchButton.setImage(ImageManager.getImage(FrameworkImage.BRANCH));
+ deleteBranchButton.setImage(ImageManager.getImage(FrameworkImage.TRASH));
+ }
+ if (SkynetGuiPlugin.getInstance() != null) {
+ showArtifactExplorer.setImage(ImageManager.getImage(FrameworkImage.ARTIFACT_EXPLORER));
+ showChangeReport.setImage(ImageManager.getImage(FrameworkImage.BRANCH_CHANGE));
+ }
+ refreshLabel();
+ refreshEnablement();
+ }
+
+ public Button createNewButton(Composite comp) {
+ if (toolkit != null) {
+ return toolkit.createButton(comp, null, SWT.PUSH);
+ }
+ return new Button(comp, SWT.PUSH);
+ }
+
+ public void refreshLabel() {
+ if (!getLabel().equals("")) {
+ try {
+ labelWidget.setText(getLabel() + ": " + (enablement.getWorkingBranch() != null ? enablement.getWorkingBranch().getShortName() : "") + " " + enablement.getStatus().name());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+ }
+
+ public void refreshEnablement() {
+ createBranchButton.setEnabled(enablement.isCreateBranchButtonEnabled());
+ showArtifactExplorer.setEnabled(enablement.isShowArtifactExplorerButtonEnabled());
+ showChangeReport.setEnabled(enablement.isShowChangeReportButtonEnabled());
+ deleteBranchButton.setEnabled(enablement.isDeleteBranchButtonEnabled());
+ }
+
+ public static boolean isPurgeBranchButtonEnabled(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
+ return teamArt.getBranchMgr().isWorkingBranchInWork();
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ }
+
+ @Override
+ public Control getControl() {
+ return labelWidget;
+ }
+
+ @Override
+ public Object getData() {
+ return null;
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public IStatus isValid() {
+ // Need this cause it removes all error items of this namespace
+ return new Status(IStatus.OK, getClass().getSimpleName(), "");
+ }
+
+ @Override
+ public void refresh() {
+ // don't do anything here cause to expensive to check for branch conditions during every refresh
+ }
+
+ public void refreshOnBranchEvent() {
+ if (teamArt == null || teamArt.getBranchMgr() == null || labelWidget == null || labelWidget.isDisposed()) {
+ return;
+ }
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ enablement.refresh();
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(createBranchButton)) {
+ refreshLabel();
+ refreshEnablement();
+ }
+ }
+ });
+ }
+ };
+ Thread thread = new Thread(runnable);
+ thread.start();
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return "";
+ }
+
+ @Override
+ public Result isDirty() {
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ }
+
+ @Override
+ public void saveToArtifact() {
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) {
+ this.teamArt = (TeamWorkFlowArtifact) artifact;
+ enablement = new XWorkingBranchEnablement(teamArt);
+ }
+
+ @Override
+ public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, int branchId) {
+ refreshOnBranchEvent();
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) {
+ refreshOnBranchEvent();
+ }
+
+ public Button getCreateBranchButton() {
+ return createBranchButton;
+ }
+
+ public Button getShowArtifactExplorerButton() {
+ return showArtifactExplorer;
+ }
+
+ public Button getShowChangeReportButton() {
+ return showChangeReport;
+ }
+
+ public Button getDeleteBranchButton() {
+ return deleteBranchButton;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s", getLabel());
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return AtsUtil.getAtsObjectEventFilters();
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ refreshOnBranchEvent();
+ }
+
+ @Override
+ public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
+ refreshOnBranchEvent();
+ }
+
+ @Override
+ public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java
index ea268760b03..88972864543 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.util.widgets;
-
+package org.eclipse.osee.ats.util.widgets;
+
import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.internal.AtsPlugin;
import org.eclipse.osee.ats.util.widgets.XWorkingBranch.BranchStatus;
@@ -17,86 +17,86 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
-
-public class XWorkingBranchEnablement {
- boolean populated = false;
- boolean workingBranchInWork = false;
- boolean committedBranchExists = false;
- Branch workingBranch = null;
- private final TeamWorkFlowArtifact teamArt;
-
- public XWorkingBranchEnablement(TeamWorkFlowArtifact teamArt) {
- this.teamArt = teamArt;
- }
-
- public boolean isCreateBranchButtonEnabled() {
- try {
- ensurePopulated();
- return !workingBranchInWork && !committedBranchExists;
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
-
- }
-
- public boolean isShowArtifactExplorerButtonEnabled() {
- try {
- ensurePopulated();
- return workingBranch != null && !getStatus().equals(BranchStatus.Changes_NotPermitted);
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public boolean isShowChangeReportButtonEnabled() {
- try {
- ensurePopulated();
- return workingBranchInWork || committedBranchExists;
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public boolean isDeleteBranchButtonEnabled() {
- try {
- ensurePopulated();
- return workingBranchInWork && !committedBranchExists;
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public void refresh() {
- populated = false;
- }
-
- public BranchStatus getStatus() throws OseeCoreException {
- ensurePopulated();
- if (teamArt != null && committedBranchExists) {
- return BranchStatus.Changes_NotPermitted;
- } else if (teamArt != null && workingBranchInWork) {
- return BranchStatus.Changes_InProgress;
- } else {
- return BranchStatus.Not_Started;
- }
- }
-
- private synchronized void ensurePopulated() throws OseeCoreException {
- if (populated) {
- return;
- }
- workingBranchInWork = teamArt.getBranchMgr().isWorkingBranchInWork();
- committedBranchExists = teamArt.getBranchMgr().isCommittedBranchExists();
- workingBranch = teamArt.getWorkingBranch();
- populated = true;
- }
-
- public Branch getWorkingBranch() {
- return workingBranch;
- }
-
-}
+
+public class XWorkingBranchEnablement {
+ boolean populated = false;
+ boolean workingBranchInWork = false;
+ boolean committedBranchExists = false;
+ Branch workingBranch = null;
+ private final TeamWorkFlowArtifact teamArt;
+
+ public XWorkingBranchEnablement(TeamWorkFlowArtifact teamArt) {
+ this.teamArt = teamArt;
+ }
+
+ public boolean isCreateBranchButtonEnabled() {
+ try {
+ ensurePopulated();
+ return !workingBranchInWork && !committedBranchExists;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+
+ }
+
+ public boolean isShowArtifactExplorerButtonEnabled() {
+ try {
+ ensurePopulated();
+ return workingBranch != null && !getStatus().equals(BranchStatus.Changes_NotPermitted);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public boolean isShowChangeReportButtonEnabled() {
+ try {
+ ensurePopulated();
+ return workingBranchInWork || committedBranchExists;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public boolean isDeleteBranchButtonEnabled() {
+ try {
+ ensurePopulated();
+ return workingBranchInWork && !committedBranchExists;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public void refresh() {
+ populated = false;
+ }
+
+ public BranchStatus getStatus() throws OseeCoreException {
+ ensurePopulated();
+ if (teamArt != null && committedBranchExists) {
+ return BranchStatus.Changes_NotPermitted;
+ } else if (teamArt != null && workingBranchInWork) {
+ return BranchStatus.Changes_InProgress;
+ } else {
+ return BranchStatus.Not_Started;
+ }
+ }
+
+ private synchronized void ensurePopulated() throws OseeCoreException {
+ if (populated) {
+ return;
+ }
+ workingBranchInWork = teamArt.getBranchMgr().isWorkingBranchInWork();
+ committedBranchExists = teamArt.getBranchMgr().isCommittedBranchExists();
+ workingBranch = teamArt.getWorkingBranch();
+ populated = true;
+ }
+
+ public Branch getWorkingBranch() {
+ return workingBranch;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitStatus.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitStatus.java
index 2b1a53f9fac..5ea9dcb446c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitStatus.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitStatus.java
@@ -8,30 +8,30 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.util.widgets.commit;
-
-/**
- * @author Donald G. Dunne
- */
-public enum CommitStatus {
- Working_Branch_Not_Created("Working Branch Not Created"),
- Branch_Not_Configured("Branch Not Configured"),
- Branch_Commit_Disabled("Branch Commit Disabled"),
- Commit_Needed("Start Commit"),
- Merge_In_Progress("Merge in Progress"),
- Committed("Committed"),
- Committed_With_Merge("Committed With Merge");
-
- private final String displayName;
-
- private CommitStatus(String displayName) {
- this.displayName = displayName;
- }
-
- /**
- * @return the displayName
- */
- public String getDisplayName() {
- return displayName;
- }
-};
+package org.eclipse.osee.ats.util.widgets.commit;
+
+/**
+ * @author Donald G. Dunne
+ */
+public enum CommitStatus {
+ Working_Branch_Not_Created("Working Branch Not Created"),
+ Branch_Not_Configured("Branch Not Configured"),
+ Branch_Commit_Disabled("Branch Commit Disabled"),
+ Commit_Needed("Start Commit"),
+ Merge_In_Progress("Merge in Progress"),
+ Committed("Committed"),
+ Committed_With_Merge("Committed With Merge");
+
+ private final String displayName;
+
+ private CommitStatus(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * @return the displayName
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+};
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManager.java
index a3daf9f1e1a..fea2c41e84e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManager.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * 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.ats.util.widgets.commit;
-
-import java.util.ArrayList;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsBranchManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class CommitXManager extends XViewer {
-
- private final XCommitManager xCommitManager;
-
- public CommitXManager(Composite parent, int style, XCommitManager xRoleViewer) {
- super(parent, style, new CommitXManagerFactory());
- this.xCommitManager = xRoleViewer;
- }
-
- @Override
- protected void createSupportWidgets(Composite parent) {
- super.createSupportWidgets(parent);
- }
-
- @Override
- public void updateMenuActionsForTable() {
- MenuManager mm = getMenuManager();
-
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
- }
-
- /**
- * Release resources
- */
- @Override
- public void dispose() {
- getLabelProvider().dispose();
- }
-
- public ArrayList<ICommitConfigArtifact> getSelectedConfigArtifacts() {
- ArrayList<ICommitConfigArtifact> arts = new ArrayList<ICommitConfigArtifact>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) {
- for (TreeItem item : items) {
- arts.add((ICommitConfigArtifact) item.getData());
- }
- }
- return arts;
- }
-
- /**
- * @return the xUserRoleViewer
- */
- public XCommitManager getXCommitViewer() {
- return xCommitManager;
- }
-
- @Override
- public void handleDoubleClick() {
- try {
- ICommitConfigArtifact configArt = getSelectedConfigArtifacts().iterator().next();
- Branch destBranch = configArt.getParentBranch();
- AtsBranchManager manager = xCommitManager.getTeamArt().getBranchMgr();
- CommitStatus commitStatus = manager.getCommitStatus(configArt);
- if (commitStatus == CommitStatus.Working_Branch_Not_Created) {
- AWorkbench.popup(commitStatus.getDisplayName(), "Need to create a working branch");
- } else if (commitStatus == CommitStatus.Branch_Not_Configured) {
- AWorkbench.popup(commitStatus.getDisplayName(),
- "Talk to project lead to configure branch for version [" + configArt + "]");
- } else if (commitStatus == CommitStatus.Branch_Commit_Disabled) {
- AWorkbench.popup(commitStatus.getDisplayName(),
- "Talk to project lead as to why commit disabled for version [" + configArt + "]");
- } else if (commitStatus == CommitStatus.Commit_Needed) {
- destBranch = configArt.getParentBranch();
- xCommitManager.getTeamArt().getBranchMgr().commitWorkingBranch(true, false, destBranch,
- manager.isBranchesAllCommittedExcept(destBranch));
- } else if (commitStatus == CommitStatus.Merge_In_Progress) {
- destBranch = configArt.getParentBranch();
- xCommitManager.getTeamArt().getBranchMgr().commitWorkingBranch(true, false, destBranch,
- manager.isBranchesAllCommittedExcept(destBranch));
- } else if (commitStatus == CommitStatus.Committed) {
- xCommitManager.getTeamArt().getBranchMgr().showChangeReportForBranch(destBranch);
- } else if (commitStatus == CommitStatus.Committed_With_Merge) {
- destBranch = configArt.getParentBranch();
- MessageDialog dialog =
- new MessageDialog(Displays.getActiveShell(), "Select Report", null,
- "Both Change Report and Merge Manager exist.\n\nSelect to open.", MessageDialog.QUESTION,
- new String[] {"Show Change Report", "Show Merge Manager", "Cancel"}, 0);
- int result = dialog.open();
- if (result == 2) {
- return;
- }
- // change report
- if (result == 0) {
- xCommitManager.getTeamArt().getBranchMgr().showChangeReportForBranch(destBranch);
- }
- // merge manager
- else {
- xCommitManager.getTeamArt().getBranchMgr().showMergeManager(destBranch);
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.commit;
+
+import java.util.ArrayList;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsBranchManager;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CommitXManager extends XViewer {
+
+ private final XCommitManager xCommitManager;
+
+ public CommitXManager(Composite parent, int style, XCommitManager xRoleViewer) {
+ super(parent, style, new CommitXManagerFactory());
+ this.xCommitManager = xRoleViewer;
+ }
+
+ @Override
+ protected void createSupportWidgets(Composite parent) {
+ super.createSupportWidgets(parent);
+ }
+
+ @Override
+ public void updateMenuActionsForTable() {
+ MenuManager mm = getMenuManager();
+
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+ }
+
+ /**
+ * Release resources
+ */
+ @Override
+ public void dispose() {
+ getLabelProvider().dispose();
+ }
+
+ public ArrayList<ICommitConfigArtifact> getSelectedConfigArtifacts() {
+ ArrayList<ICommitConfigArtifact> arts = new ArrayList<ICommitConfigArtifact>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ arts.add((ICommitConfigArtifact) item.getData());
+ }
+ }
+ return arts;
+ }
+
+ /**
+ * @return the xUserRoleViewer
+ */
+ public XCommitManager getXCommitViewer() {
+ return xCommitManager;
+ }
+
+ @Override
+ public void handleDoubleClick() {
+ try {
+ ICommitConfigArtifact configArt = getSelectedConfigArtifacts().iterator().next();
+ Branch destBranch = configArt.getParentBranch();
+ AtsBranchManager manager = xCommitManager.getTeamArt().getBranchMgr();
+ CommitStatus commitStatus = manager.getCommitStatus(configArt);
+ if (commitStatus == CommitStatus.Working_Branch_Not_Created) {
+ AWorkbench.popup(commitStatus.getDisplayName(), "Need to create a working branch");
+ } else if (commitStatus == CommitStatus.Branch_Not_Configured) {
+ AWorkbench.popup(commitStatus.getDisplayName(),
+ "Talk to project lead to configure branch for version [" + configArt + "]");
+ } else if (commitStatus == CommitStatus.Branch_Commit_Disabled) {
+ AWorkbench.popup(commitStatus.getDisplayName(),
+ "Talk to project lead as to why commit disabled for version [" + configArt + "]");
+ } else if (commitStatus == CommitStatus.Commit_Needed) {
+ destBranch = configArt.getParentBranch();
+ xCommitManager.getTeamArt().getBranchMgr().commitWorkingBranch(true, false, destBranch,
+ manager.isBranchesAllCommittedExcept(destBranch));
+ } else if (commitStatus == CommitStatus.Merge_In_Progress) {
+ destBranch = configArt.getParentBranch();
+ xCommitManager.getTeamArt().getBranchMgr().commitWorkingBranch(true, false, destBranch,
+ manager.isBranchesAllCommittedExcept(destBranch));
+ } else if (commitStatus == CommitStatus.Committed) {
+ xCommitManager.getTeamArt().getBranchMgr().showChangeReportForBranch(destBranch);
+ } else if (commitStatus == CommitStatus.Committed_With_Merge) {
+ destBranch = configArt.getParentBranch();
+ MessageDialog dialog =
+ new MessageDialog(Displays.getActiveShell(), "Select Report", null,
+ "Both Change Report and Merge Manager exist.\n\nSelect to open.", MessageDialog.QUESTION,
+ new String[] {"Show Change Report", "Show Merge Manager", "Cancel"}, 0);
+ int result = dialog.open();
+ if (result == 2) {
+ return;
+ }
+ // change report
+ if (result == 0) {
+ xCommitManager.getTeamArt().getBranchMgr().showChangeReportForBranch(destBranch);
+ }
+ // merge manager
+ else {
+ xCommitManager.getTeamArt().getBranchMgr().showMergeManager(destBranch);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManagerFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManagerFactory.java
index 54f7d65e761..b7ecb1483d5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManagerFactory.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/CommitXManagerFactory.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * 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.ats.util.widgets.commit;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class CommitXManagerFactory extends SkynetXViewerFactory {
-
- public static XViewerColumn Empty_Col = new XViewerColumn("osee.commit.empty", "Empty", 0, SWT.LEFT, true,
- SortDataType.String, false, null);
- public static XViewerColumn Action_Col = new XViewerColumn("osee.commit.action", "Action", 180, SWT.LEFT, true,
- SortDataType.String, false, "Provides the action(s) available. Double click row to perform action.");
- public static XViewerColumn Status_Col = new XViewerColumn("osee.commit.status", "Status", 180, SWT.LEFT, true,
- SortDataType.String, false, null);
- public static XViewerColumn Merge_Col = new XViewerColumn("osee.commit.merge", "Merge Branch Exists", 30, SWT.LEFT,
- true, SortDataType.String, false, "Will show merge icon if merge branch exists");
- public static XViewerColumn Dest_Branch_Col = new XViewerColumn("osee.commit.name", "Destination Branch", 450,
- SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Version_Col = new XViewerColumn("osee.commit.shortName", "Destination Version", 200,
- SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Configuring_Object_Col = new XViewerColumn("osee.commit.configObj",
- "Configuring Object", 100, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Commit_Date = new XViewerColumn("osee.commit.commitDate", "Commit Date", 200, SWT.LEFT,
- true, SortDataType.Date, false, null);
- public static XViewerColumn Commit_Comment = new XViewerColumn("osee.commit.commitComment", "Commit Comment", 200,
- SWT.LEFT, true, SortDataType.String, false, null);
-
- public CommitXManagerFactory() {
- super("osee.skynet.gui.CommitXViewer");
- registerColumns(Empty_Col, Action_Col, Status_Col, Merge_Col, Dest_Branch_Col, Version_Col,
- Configuring_Object_Col, Commit_Date, Commit_Comment);
- }
-
- @Override
- public boolean isFilterUiAvailable() {
- return false;
- }
-
- @Override
- public boolean isHeaderBarAvailable() {
- return false;
- }
-
- @Override
- public boolean isLoadedStatusLabelAvailable() {
- return false;
- }
-
- @Override
- public boolean isSearchUiAvailable() {
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.util.widgets.commit;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CommitXManagerFactory extends SkynetXViewerFactory {
+
+ public static XViewerColumn Empty_Col = new XViewerColumn("osee.commit.empty", "Empty", 0, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn Action_Col = new XViewerColumn("osee.commit.action", "Action", 180, SWT.LEFT, true,
+ SortDataType.String, false, "Provides the action(s) available. Double click row to perform action.");
+ public static XViewerColumn Status_Col = new XViewerColumn("osee.commit.status", "Status", 180, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn Merge_Col = new XViewerColumn("osee.commit.merge", "Merge Branch Exists", 30, SWT.LEFT,
+ true, SortDataType.String, false, "Will show merge icon if merge branch exists");
+ public static XViewerColumn Dest_Branch_Col = new XViewerColumn("osee.commit.name", "Destination Branch", 450,
+ SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Version_Col = new XViewerColumn("osee.commit.shortName", "Destination Version", 200,
+ SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Configuring_Object_Col = new XViewerColumn("osee.commit.configObj",
+ "Configuring Object", 100, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Commit_Date = new XViewerColumn("osee.commit.commitDate", "Commit Date", 200, SWT.LEFT,
+ true, SortDataType.Date, false, null);
+ public static XViewerColumn Commit_Comment = new XViewerColumn("osee.commit.commitComment", "Commit Comment", 200,
+ SWT.LEFT, true, SortDataType.String, false, null);
+
+ public CommitXManagerFactory() {
+ super("osee.skynet.gui.CommitXViewer");
+ registerColumns(Empty_Col, Action_Col, Status_Col, Merge_Col, Dest_Branch_Col, Version_Col,
+ Configuring_Object_Col, Commit_Date, Commit_Comment);
+ }
+
+ @Override
+ public boolean isFilterUiAvailable() {
+ return false;
+ }
+
+ @Override
+ public boolean isHeaderBarAvailable() {
+ return false;
+ }
+
+ @Override
+ public boolean isLoadedStatusLabelAvailable() {
+ return false;
+ }
+
+ @Override
+ public boolean isSearchUiAvailable() {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/ICommitConfigArtifact.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/ICommitConfigArtifact.java
index 11f452f1332..3303e81383f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/ICommitConfigArtifact.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/ICommitConfigArtifact.java
@@ -8,23 +8,23 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.util.widgets.commit;
-
+package org.eclipse.osee.ats.util.widgets.commit;
+
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.ui.plugin.util.Result;
-
-/**
- * @author Donald G. Dunne
- */
-public interface ICommitConfigArtifact {
-
- public Branch getParentBranch() throws OseeCoreException;
-
- public Result isCommitBranchAllowed() throws OseeCoreException;
-
- public Result isCreateBranchAllowed() throws OseeCoreException;
-
- public String getFullDisplayName() throws OseeCoreException;
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ICommitConfigArtifact {
+
+ public Branch getParentBranch() throws OseeCoreException;
+
+ public Result isCommitBranchAllowed() throws OseeCoreException;
+
+ public Result isCreateBranchAllowed() throws OseeCoreException;
+
+ public String getFullDisplayName() throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitLabelProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitLabelProvider.java
index a15899ddf2c..cb727a0d43a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitLabelProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitLabelProvider.java
@@ -1,164 +1,164 @@
-/*******************************************************************************
- * 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.ats.util.widgets.commit;
-
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.graphics.Image;
-
-public class XCommitLabelProvider extends XViewerLabelProvider {
-
- private final CommitXManager commitXManager;
-
- public XCommitLabelProvider(CommitXManager commitXManager) {
- super(commitXManager);
- this.commitXManager = commitXManager;
- }
-
- @Override
- public Image getColumnImage(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException {
- ICommitConfigArtifact configArt = (ICommitConfigArtifact) element;
- Branch branch = configArt.getParentBranch();
- if (xCol.equals(CommitXManagerFactory.Action_Col)) {
- return ImageManager.getImage(FrameworkImage.ARROW_RIGHT_YELLOW);
- }
- if (branch == null) {
- return null;
- }
- if (xCol.equals(CommitXManagerFactory.Status_Col)) {
- try {
- CommitStatus commitStatus =
- commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitStatus(configArt);
- if (commitStatus == CommitStatus.Branch_Not_Configured ||
- //
- commitStatus == CommitStatus.Branch_Commit_Disabled ||
- //
- commitStatus == CommitStatus.Commit_Needed ||
- //
- commitStatus == CommitStatus.Working_Branch_Not_Created) {
- return ImageManager.getImage(FrameworkImage.DOT_RED);
- }
-
- if (commitStatus == CommitStatus.Merge_In_Progress) {
- return ImageManager.getImage(FrameworkImage.DOT_YELLOW);
- }
-
- if (commitStatus == CommitStatus.Committed ||
- //
- commitStatus == CommitStatus.Committed_With_Merge) {
- return ImageManager.getImage(FrameworkImage.DOT_GREEN);
- }
- return null;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- } else if (xCol.equals(CommitXManagerFactory.Merge_Col)) {
- try {
- CommitStatus commitStatus =
- commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitStatus(configArt);
- if (commitStatus == CommitStatus.Merge_In_Progress || commitStatus == CommitStatus.Committed_With_Merge) {
- return ImageManager.getImage(FrameworkImage.OUTGOING_MERGED);
- }
- return null;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException {
- ICommitConfigArtifact configArt = (ICommitConfigArtifact) element;
- Branch branch = configArt.getParentBranch();
-
- if (xCol.equals(CommitXManagerFactory.Status_Col)) {
- return commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitStatus(configArt).getDisplayName();
- } else if (xCol.equals(CommitXManagerFactory.Merge_Col)) {
- return "";
- } else if (xCol.equals(CommitXManagerFactory.Version_Col)) {
- return ((Artifact) element).getName();
- } else if (xCol.equals(CommitXManagerFactory.Configuring_Object_Col)) {
- return ((Artifact) element).getArtifactTypeName();
- } else if (xCol.equals(CommitXManagerFactory.Commit_Date)) {
- TransactionRecord transactionRecord =
- commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitTransactionRecord(configArt);
- if (transactionRecord != null) {
- return new XDate(transactionRecord.getTimeStamp()).getMMDDYYHHMM();
- }
- return "Not Committed";
- } else if (xCol.equals(CommitXManagerFactory.Commit_Comment)) {
- TransactionRecord transactionRecord =
- commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitTransactionRecord(configArt);
- if (transactionRecord != null) {
- return transactionRecord.getComment();
- }
- return "Not Committed";
- } else if (xCol.equals(CommitXManagerFactory.Dest_Branch_Col)) {
- if (element instanceof VersionArtifact) {
- return branch == null ? "Parent Branch Not Configured for Version [" + element + "]" : branch.getShortName();
- } else if (element instanceof TeamDefinitionArtifact) {
- return branch == null ? "Parent Branch Not Configured for Team Definition [" + element + "]" : branch.getShortName();
- }
- } else if (xCol.equals(CommitXManagerFactory.Action_Col)) {
- CommitStatus commitStatus =
- commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitStatus(configArt);
- if (commitStatus == CommitStatus.Branch_Not_Configured) {
- return "Configure Branch";
- } else if (commitStatus == CommitStatus.Branch_Commit_Disabled) {
- return "Enable Branch Commit";
- } else if (commitStatus == CommitStatus.Commit_Needed) {
- return "Start Commit";
- } else if (commitStatus == CommitStatus.Merge_In_Progress) {
- return "Merge Conflicts and Commit";
- } else if (commitStatus == CommitStatus.Committed) {
- return "Show Change Report";
- } else if (commitStatus == CommitStatus.Committed_With_Merge) {
- return "Show Change/Merge Report";
- } else if (commitStatus == CommitStatus.Working_Branch_Not_Created) {
- return "Working Branch Not Created";
- }
- return "Error: Need to handle this";
- }
- return "unhandled column";
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public CommitXManager getTreeViewer() {
- return commitXManager;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.commit;
+
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.graphics.Image;
+
+public class XCommitLabelProvider extends XViewerLabelProvider {
+
+ private final CommitXManager commitXManager;
+
+ public XCommitLabelProvider(CommitXManager commitXManager) {
+ super(commitXManager);
+ this.commitXManager = commitXManager;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException {
+ ICommitConfigArtifact configArt = (ICommitConfigArtifact) element;
+ Branch branch = configArt.getParentBranch();
+ if (xCol.equals(CommitXManagerFactory.Action_Col)) {
+ return ImageManager.getImage(FrameworkImage.ARROW_RIGHT_YELLOW);
+ }
+ if (branch == null) {
+ return null;
+ }
+ if (xCol.equals(CommitXManagerFactory.Status_Col)) {
+ try {
+ CommitStatus commitStatus =
+ commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitStatus(configArt);
+ if (commitStatus == CommitStatus.Branch_Not_Configured ||
+ //
+ commitStatus == CommitStatus.Branch_Commit_Disabled ||
+ //
+ commitStatus == CommitStatus.Commit_Needed ||
+ //
+ commitStatus == CommitStatus.Working_Branch_Not_Created) {
+ return ImageManager.getImage(FrameworkImage.DOT_RED);
+ }
+
+ if (commitStatus == CommitStatus.Merge_In_Progress) {
+ return ImageManager.getImage(FrameworkImage.DOT_YELLOW);
+ }
+
+ if (commitStatus == CommitStatus.Committed ||
+ //
+ commitStatus == CommitStatus.Committed_With_Merge) {
+ return ImageManager.getImage(FrameworkImage.DOT_GREEN);
+ }
+ return null;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ } else if (xCol.equals(CommitXManagerFactory.Merge_Col)) {
+ try {
+ CommitStatus commitStatus =
+ commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitStatus(configArt);
+ if (commitStatus == CommitStatus.Merge_In_Progress || commitStatus == CommitStatus.Committed_With_Merge) {
+ return ImageManager.getImage(FrameworkImage.OUTGOING_MERGED);
+ }
+ return null;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException {
+ ICommitConfigArtifact configArt = (ICommitConfigArtifact) element;
+ Branch branch = configArt.getParentBranch();
+
+ if (xCol.equals(CommitXManagerFactory.Status_Col)) {
+ return commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitStatus(configArt).getDisplayName();
+ } else if (xCol.equals(CommitXManagerFactory.Merge_Col)) {
+ return "";
+ } else if (xCol.equals(CommitXManagerFactory.Version_Col)) {
+ return ((Artifact) element).getName();
+ } else if (xCol.equals(CommitXManagerFactory.Configuring_Object_Col)) {
+ return ((Artifact) element).getArtifactTypeName();
+ } else if (xCol.equals(CommitXManagerFactory.Commit_Date)) {
+ TransactionRecord transactionRecord =
+ commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitTransactionRecord(configArt);
+ if (transactionRecord != null) {
+ return new XDate(transactionRecord.getTimeStamp()).getMMDDYYHHMM();
+ }
+ return "Not Committed";
+ } else if (xCol.equals(CommitXManagerFactory.Commit_Comment)) {
+ TransactionRecord transactionRecord =
+ commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitTransactionRecord(configArt);
+ if (transactionRecord != null) {
+ return transactionRecord.getComment();
+ }
+ return "Not Committed";
+ } else if (xCol.equals(CommitXManagerFactory.Dest_Branch_Col)) {
+ if (element instanceof VersionArtifact) {
+ return branch == null ? "Parent Branch Not Configured for Version [" + element + "]" : branch.getShortName();
+ } else if (element instanceof TeamDefinitionArtifact) {
+ return branch == null ? "Parent Branch Not Configured for Team Definition [" + element + "]" : branch.getShortName();
+ }
+ } else if (xCol.equals(CommitXManagerFactory.Action_Col)) {
+ CommitStatus commitStatus =
+ commitXManager.getXCommitViewer().getTeamArt().getBranchMgr().getCommitStatus(configArt);
+ if (commitStatus == CommitStatus.Branch_Not_Configured) {
+ return "Configure Branch";
+ } else if (commitStatus == CommitStatus.Branch_Commit_Disabled) {
+ return "Enable Branch Commit";
+ } else if (commitStatus == CommitStatus.Commit_Needed) {
+ return "Start Commit";
+ } else if (commitStatus == CommitStatus.Merge_In_Progress) {
+ return "Merge Conflicts and Commit";
+ } else if (commitStatus == CommitStatus.Committed) {
+ return "Show Change Report";
+ } else if (commitStatus == CommitStatus.Committed_With_Merge) {
+ return "Show Change/Merge Report";
+ } else if (commitStatus == CommitStatus.Working_Branch_Not_Created) {
+ return "Working Branch Not Created";
+ }
+ return "Error: Need to handle this";
+ }
+ return "unhandled column";
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public CommitXManager getTreeViewer() {
+ return commitXManager;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java
index feb9c8b2c57..8223a43725f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/commit/XCommitManager.java
@@ -1,442 +1,442 @@
-/*******************************************************************************
- * 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.ats.util.widgets.commit;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-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.event.BranchEventType;
-import org.eclipse.osee.framework.skynet.core.event.IBranchEventListener;
-import org.eclipse.osee.framework.skynet.core.event.IMergeBranchEventListener;
-import org.eclipse.osee.framework.skynet.core.event.MergeBranchEventType;
-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.BranchEvent;
-import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-
-/**
- * @author Donald G. Dunne
- */
-public class XCommitManager extends XWidget implements IArtifactWidget, IMergeBranchEventListener, IBranchEventListener {
-
- private CommitXManager xCommitManager;
- private IDirtiableEditor editor;
- public final static String normalColor = "#EEEEEE";
- private TeamWorkFlowArtifact teamArt;
- private static final int paddedTableHeightHint = 2;
- private Label extraInfoLabel;
- public final static String WIDGET_ID = ATSAttributes.COMMIT_MANAGER_WIDGET.getStoreName();
- private ToolBar toolBar;
-
- public XCommitManager() {
- super("Commit Manager");
- OseeEventManager.addListener(this);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
-
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- try {
- if (!teamArt.getBranchMgr().isWorkingBranchInWork() && !teamArt.getBranchMgr().isCommittedBranchExists()) {
- labelWidget.setText(getLabel() + ": No working or committed branches available.");
- } else {
-
- Composite mainComp = new Composite(parent, SWT.BORDER);
- mainComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- if (toolkit != null) {
- toolkit.paintBordersFor(mainComp);
- }
-
- createTaskActionBar(mainComp);
-
- labelWidget.setText(getLabel() + ": ");// If ATS Admin, allow right-click to auto-complete reviews
- if (AtsUtil.isAtsAdmin() && !AtsUtil.isProductionDb()) {
- labelWidget.addListener(SWT.MouseUp, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (event.button == 3) {
- if (!MessageDialog.openConfirm(Displays.getActiveShell(), "Auto Commit Branches",
- "ATS Admin\n\nAuto Commit Branches?")) {
- return;
- }
- try {
- for (Branch destinationBranch : teamArt.getBranchMgr().getBranchesLeftToCommit()) {
- teamArt.getBranchMgr().commitWorkingBranch(false, true, destinationBranch, true);
- Thread.sleep(1000);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- });
- }
-
- xCommitManager = new CommitXManager(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
- xCommitManager.getTree().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- xCommitManager.setContentProvider(new XCommitContentProvider(xCommitManager));
- xCommitManager.setLabelProvider(new XCommitLabelProvider(xCommitManager));
-
- if (toolkit != null && xCommitManager.getStatusLabel() != null) {
- toolkit.adapt(xCommitManager.getStatusLabel(), false, false);
- }
-
- setXviewerTree();
- loadTable();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- int lastDefectListSize = 0;
-
- public void setXviewerTree() {
- Tree tree = xCommitManager.getTree();
- int defectListSize = xCommitManager.getTree().getItemCount();
- if (defectListSize == lastDefectListSize) {
- return;
- }
- lastDefectListSize = defectListSize;
- int treeItemHeight = xCommitManager.getTree().getItemHeight();
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = treeItemHeight * (paddedTableHeightHint + defectListSize);
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- }
-
- public void createTaskActionBar(Composite parent) {
-
- // Button composite for state transitions, etc
- Composite bComp = new Composite(parent, SWT.NONE);
- // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
- bComp.setLayout(new GridLayout(2, false));
- bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite leftComp = new Composite(bComp, SWT.NONE);
- leftComp.setLayout(new GridLayout());
- leftComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
-
- extraInfoLabel = new Label(leftComp, SWT.NONE);
- extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- extraInfoLabel.setText("");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
-
- Composite rightComp = new Composite(bComp, SWT.NONE);
- rightComp.setLayout(new GridLayout());
- rightComp.setLayoutData(new GridData(GridData.END));
-
- toolBar = new ToolBar(rightComp, SWT.FLAT | SWT.RIGHT);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- toolBar.setLayoutData(gd);
- ToolItem item = null;
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
- item.setToolTipText("Refresh");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- loadTable();
- }
- });
-
- }
-
- public void loadTable() {
- try {
- if (xCommitManager != null && teamArt != null && xCommitManager.getContentProvider() != null) {
- Collection<ICommitConfigArtifact> configArtSet =
- teamArt.getBranchMgr().getConfigArtifactsConfiguredToCommitTo();
- xCommitManager.setInput(configArtSet);
- xCommitManager.refresh();
- refresh();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @SuppressWarnings("rawtypes")
- public ArrayList<Branch> getSelectedBranches() {
- ArrayList<Branch> items = new ArrayList<Branch>();
- if (xCommitManager == null) {
- return items;
- }
- if (xCommitManager.getSelection().isEmpty()) {
- return items;
- }
- Iterator i = ((IStructuredSelection) xCommitManager.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- items.add((Branch) obj);
- }
- return items;
- }
-
- @Override
- public Control getControl() {
- if (xCommitManager == null) {
- return null;
- }
- return xCommitManager.getTree();
- }
-
- @Override
- public void dispose() {
- if (xCommitManager != null) {
- xCommitManager.dispose();
- }
- OseeEventManager.removeListener(this);
- }
-
- @Override
- public void setFocus() {
- if (xCommitManager != null) {
- xCommitManager.getTree().setFocus();
- }
- }
-
- @Override
- public void refresh() {
- if (xCommitManager == null || xCommitManager.getTree() == null || xCommitManager.getTree().isDisposed()) {
- return;
- }
- validate();
- setXviewerTree();
- }
-
- private void updateExtraInfoLabel(final int color, final String infoStr) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Widgets.isAccessible(extraInfoLabel)) {
- String currentString = extraInfoLabel.getText();
- if (infoStr == null && currentString != null || infoStr != null && currentString == null || !infoStr.equals(currentString)) {
- extraInfoLabel.setText("Double-click item to perform Action");
- }
- extraInfoLabel.setForeground(Displays.getSystemColor(color));
- }
- }
- });
- }
-
- @Override
- public IStatus isValid() {
- Status returnStatus = new Status(IStatus.OK, getClass().getSimpleName(), "");
- try {
- int backgroundColor = SWT.COLOR_BLACK;
- String infoStr = "Double-click item to perform Action";
- if (xCommitManager != null && xCommitManager.getXCommitViewer() != null && xCommitManager.getXCommitViewer().getTeamArt() != null && xCommitManager.getXCommitViewer().getTeamArt() != null && xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr() != null) {
- if (!xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr().isAllObjectsToCommitToConfigured()) {
- infoStr = "All branches must be configured and committed - Double-click item to perform Action";
- backgroundColor = SWT.COLOR_RED;
- returnStatus =
- new Status(IStatus.ERROR, getClass().getSimpleName(),
- "All branches must be configured and committed.");
- } else if (!xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr().isBranchesAllCommitted()) {
- infoStr = "All branches must be committed - Double-click item to perform Action";
- backgroundColor = SWT.COLOR_RED;
- returnStatus = new Status(IStatus.ERROR, getClass().getSimpleName(), "All branches must be committed.");
- }
- }
- updateExtraInfoLabel(backgroundColor, infoStr);
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return new Status(IStatus.ERROR, getClass().getSimpleName(), ex.getLocalizedMessage());
- }
- return returnStatus;
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public String toHTML(String labelFont) {
- return AHTML.simplePage("Unhandled");
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- /**
- * @return Returns the xViewer.
- */
- public CommitXManager getXViewer() {
- return xCommitManager;
- }
-
- @Override
- public Object getData() {
- return xCommitManager.getInput();
- }
-
- public IDirtiableEditor getEditor() {
- return editor;
- }
-
- public void setEditor(IDirtiableEditor editor) {
- this.editor = editor;
- }
-
- @Override
- public void setArtifact(Artifact artifact) throws OseeCoreException {
- if (!(artifact instanceof TeamWorkFlowArtifact)) {
- throw new OseeStateException("Must be TeamWorkflowArtifact, set was a " + artifact.getArtifactTypeName());
- }
- this.teamArt = (TeamWorkFlowArtifact) artifact;
- loadTable();
- }
-
- @Override
- public Result isDirty() {
- return Result.FalseResult;
- }
-
- @Override
- public void revert() {
- }
-
- @Override
- public void saveToArtifact() {
- }
-
- /**
- * @return the artifact
- */
- public TeamWorkFlowArtifact getTeamArt() {
- return teamArt;
- }
-
- @Override
- public void handleBranchEventREM1(Sender sender, final BranchEventType branchModType, int branchId) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (branchModType == BranchEventType.MergeConflictResolved) {
- xCommitManager.refresh();
- refresh();
- } else {
- loadTable();
- }
- }
- });
- }
-
- @Override
- public void handleMergeBranchEvent(Sender sender, MergeBranchEventType branchModType, int branchId) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- xCommitManager.refresh();
- refresh();
- }
- });
- }
-
- @Override
- public Control getErrorMessageControl() {
- return labelWidget;
- }
-
- @Override
- public String toString() {
- return String.format("%s", getLabel());
- }
-
- @Override
- public void handleBranchEvent(Sender sender, final BranchEvent branchEvent) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (branchEvent.getEventType() == BranchEventType.MergeConflictResolved) {
- xCommitManager.refresh();
- refresh();
- } else {
- loadTable();
- }
- }
- });
-
- }
-
- @Override
- public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return 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.ats.util.widgets.commit;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+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.event.BranchEventType;
+import org.eclipse.osee.framework.skynet.core.event.IBranchEventListener;
+import org.eclipse.osee.framework.skynet.core.event.IMergeBranchEventListener;
+import org.eclipse.osee.framework.skynet.core.event.MergeBranchEventType;
+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.BranchEvent;
+import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XCommitManager extends XWidget implements IArtifactWidget, IMergeBranchEventListener, IBranchEventListener {
+
+ private CommitXManager xCommitManager;
+ private IDirtiableEditor editor;
+ public final static String normalColor = "#EEEEEE";
+ private TeamWorkFlowArtifact teamArt;
+ private static final int paddedTableHeightHint = 2;
+ private Label extraInfoLabel;
+ public final static String WIDGET_ID = ATSAttributes.COMMIT_MANAGER_WIDGET.getStoreName();
+ private ToolBar toolBar;
+
+ public XCommitManager() {
+ super("Commit Manager");
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ try {
+ if (!teamArt.getBranchMgr().isWorkingBranchInWork() && !teamArt.getBranchMgr().isCommittedBranchExists()) {
+ labelWidget.setText(getLabel() + ": No working or committed branches available.");
+ } else {
+
+ Composite mainComp = new Composite(parent, SWT.BORDER);
+ mainComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ if (toolkit != null) {
+ toolkit.paintBordersFor(mainComp);
+ }
+
+ createTaskActionBar(mainComp);
+
+ labelWidget.setText(getLabel() + ": ");// If ATS Admin, allow right-click to auto-complete reviews
+ if (AtsUtil.isAtsAdmin() && !AtsUtil.isProductionDb()) {
+ labelWidget.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if (event.button == 3) {
+ if (!MessageDialog.openConfirm(Displays.getActiveShell(), "Auto Commit Branches",
+ "ATS Admin\n\nAuto Commit Branches?")) {
+ return;
+ }
+ try {
+ for (Branch destinationBranch : teamArt.getBranchMgr().getBranchesLeftToCommit()) {
+ teamArt.getBranchMgr().commitWorkingBranch(false, true, destinationBranch, true);
+ Thread.sleep(1000);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ });
+ }
+
+ xCommitManager = new CommitXManager(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
+ xCommitManager.getTree().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ xCommitManager.setContentProvider(new XCommitContentProvider(xCommitManager));
+ xCommitManager.setLabelProvider(new XCommitLabelProvider(xCommitManager));
+
+ if (toolkit != null && xCommitManager.getStatusLabel() != null) {
+ toolkit.adapt(xCommitManager.getStatusLabel(), false, false);
+ }
+
+ setXviewerTree();
+ loadTable();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ int lastDefectListSize = 0;
+
+ public void setXviewerTree() {
+ Tree tree = xCommitManager.getTree();
+ int defectListSize = xCommitManager.getTree().getItemCount();
+ if (defectListSize == lastDefectListSize) {
+ return;
+ }
+ lastDefectListSize = defectListSize;
+ int treeItemHeight = xCommitManager.getTree().getItemHeight();
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.heightHint = treeItemHeight * (paddedTableHeightHint + defectListSize);
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ }
+
+ public void createTaskActionBar(Composite parent) {
+
+ // Button composite for state transitions, etc
+ Composite bComp = new Composite(parent, SWT.NONE);
+ // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
+ bComp.setLayout(new GridLayout(2, false));
+ bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite leftComp = new Composite(bComp, SWT.NONE);
+ leftComp.setLayout(new GridLayout());
+ leftComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
+
+ extraInfoLabel = new Label(leftComp, SWT.NONE);
+ extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ extraInfoLabel.setText("");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+
+ Composite rightComp = new Composite(bComp, SWT.NONE);
+ rightComp.setLayout(new GridLayout());
+ rightComp.setLayoutData(new GridData(GridData.END));
+
+ toolBar = new ToolBar(rightComp, SWT.FLAT | SWT.RIGHT);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ toolBar.setLayoutData(gd);
+ ToolItem item = null;
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
+ item.setToolTipText("Refresh");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ loadTable();
+ }
+ });
+
+ }
+
+ public void loadTable() {
+ try {
+ if (xCommitManager != null && teamArt != null && xCommitManager.getContentProvider() != null) {
+ Collection<ICommitConfigArtifact> configArtSet =
+ teamArt.getBranchMgr().getConfigArtifactsConfiguredToCommitTo();
+ xCommitManager.setInput(configArtSet);
+ xCommitManager.refresh();
+ refresh();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public ArrayList<Branch> getSelectedBranches() {
+ ArrayList<Branch> items = new ArrayList<Branch>();
+ if (xCommitManager == null) {
+ return items;
+ }
+ if (xCommitManager.getSelection().isEmpty()) {
+ return items;
+ }
+ Iterator i = ((IStructuredSelection) xCommitManager.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ items.add((Branch) obj);
+ }
+ return items;
+ }
+
+ @Override
+ public Control getControl() {
+ if (xCommitManager == null) {
+ return null;
+ }
+ return xCommitManager.getTree();
+ }
+
+ @Override
+ public void dispose() {
+ if (xCommitManager != null) {
+ xCommitManager.dispose();
+ }
+ OseeEventManager.removeListener(this);
+ }
+
+ @Override
+ public void setFocus() {
+ if (xCommitManager != null) {
+ xCommitManager.getTree().setFocus();
+ }
+ }
+
+ @Override
+ public void refresh() {
+ if (xCommitManager == null || xCommitManager.getTree() == null || xCommitManager.getTree().isDisposed()) {
+ return;
+ }
+ validate();
+ setXviewerTree();
+ }
+
+ private void updateExtraInfoLabel(final int color, final String infoStr) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(extraInfoLabel)) {
+ String currentString = extraInfoLabel.getText();
+ if (infoStr == null && currentString != null || infoStr != null && currentString == null || !infoStr.equals(currentString)) {
+ extraInfoLabel.setText("Double-click item to perform Action");
+ }
+ extraInfoLabel.setForeground(Displays.getSystemColor(color));
+ }
+ }
+ });
+ }
+
+ @Override
+ public IStatus isValid() {
+ Status returnStatus = new Status(IStatus.OK, getClass().getSimpleName(), "");
+ try {
+ int backgroundColor = SWT.COLOR_BLACK;
+ String infoStr = "Double-click item to perform Action";
+ if (xCommitManager != null && xCommitManager.getXCommitViewer() != null && xCommitManager.getXCommitViewer().getTeamArt() != null && xCommitManager.getXCommitViewer().getTeamArt() != null && xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr() != null) {
+ if (!xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr().isAllObjectsToCommitToConfigured()) {
+ infoStr = "All branches must be configured and committed - Double-click item to perform Action";
+ backgroundColor = SWT.COLOR_RED;
+ returnStatus =
+ new Status(IStatus.ERROR, getClass().getSimpleName(),
+ "All branches must be configured and committed.");
+ } else if (!xCommitManager.getXCommitViewer().getTeamArt().getBranchMgr().isBranchesAllCommitted()) {
+ infoStr = "All branches must be committed - Double-click item to perform Action";
+ backgroundColor = SWT.COLOR_RED;
+ returnStatus = new Status(IStatus.ERROR, getClass().getSimpleName(), "All branches must be committed.");
+ }
+ }
+ updateExtraInfoLabel(backgroundColor, infoStr);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Status(IStatus.ERROR, getClass().getSimpleName(), ex.getLocalizedMessage());
+ }
+ return returnStatus;
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return AHTML.simplePage("Unhandled");
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ /**
+ * @return Returns the xViewer.
+ */
+ public CommitXManager getXViewer() {
+ return xCommitManager;
+ }
+
+ @Override
+ public Object getData() {
+ return xCommitManager.getInput();
+ }
+
+ public IDirtiableEditor getEditor() {
+ return editor;
+ }
+
+ public void setEditor(IDirtiableEditor editor) {
+ this.editor = editor;
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) throws OseeCoreException {
+ if (!(artifact instanceof TeamWorkFlowArtifact)) {
+ throw new OseeStateException("Must be TeamWorkflowArtifact, set was a " + artifact.getArtifactTypeName());
+ }
+ this.teamArt = (TeamWorkFlowArtifact) artifact;
+ loadTable();
+ }
+
+ @Override
+ public Result isDirty() {
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ }
+
+ @Override
+ public void saveToArtifact() {
+ }
+
+ /**
+ * @return the artifact
+ */
+ public TeamWorkFlowArtifact getTeamArt() {
+ return teamArt;
+ }
+
+ @Override
+ public void handleBranchEventREM1(Sender sender, final BranchEventType branchModType, int branchId) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (branchModType == BranchEventType.MergeConflictResolved) {
+ xCommitManager.refresh();
+ refresh();
+ } else {
+ loadTable();
+ }
+ }
+ });
+ }
+
+ @Override
+ public void handleMergeBranchEvent(Sender sender, MergeBranchEventType branchModType, int branchId) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ xCommitManager.refresh();
+ refresh();
+ }
+ });
+ }
+
+ @Override
+ public Control getErrorMessageControl() {
+ return labelWidget;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s", getLabel());
+ }
+
+ @Override
+ public void handleBranchEvent(Sender sender, final BranchEvent branchEvent) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (branchEvent.getEventType() == BranchEventType.MergeConflictResolved) {
+ xCommitManager.refresh();
+ refresh();
+ } else {
+ loadTable();
+ }
+ }
+ });
+
+ }
+
+ @Override
+ public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectContentProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectContentProvider.java
index 8d9503fb84e..20a4ea11fea 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectContentProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectContentProvider.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * 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.ats.util.widgets.defect;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-public class DefectContentProvider implements ITreeContentProvider {
-
- protected Collection<DefectItem> rootSet = new HashSet<DefectItem>();
- private final DefectXViewer xViewer;
- private static Object[] EMPTY_ARRAY = new Object[0];
-
- public DefectContentProvider(DefectXViewer WorldXViewer) {
- super();
- this.xViewer = WorldXViewer;
- }
-
- public void add(final DefectItem item) {
- add(Arrays.asList(item));
- }
-
- public void add(final Collection<? extends DefectItem> items) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (xViewer.getInput() == null) xViewer.setInput(rootSet);
- rootSet.addAll(items);
- xViewer.refresh();
- };
- });
- }
-
- public void set(final Collection<? extends DefectItem> arts) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (xViewer.getInput() == null) xViewer.setInput(rootSet);
- clear();
- add(arts);
- };
- });
- }
-
- public void clear() {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (xViewer.getInput() == null) xViewer.setInput(rootSet);
- rootSet.clear();
- xViewer.refresh();
- };
- });
- }
-
- @SuppressWarnings("rawtypes")
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Object[]) {
- return (Object[]) parentElement;
- }
- if (parentElement instanceof Collection) {
- return ((Collection) parentElement).toArray();
- }
- return EMPTY_ARRAY;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof String) return new Object[] {inputElement};
- return getChildren(inputElement);
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- /**
- * @return the rootSet
- */
- public Collection<DefectItem> getRootSet() {
- return rootSet;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.defect;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+public class DefectContentProvider implements ITreeContentProvider {
+
+ protected Collection<DefectItem> rootSet = new HashSet<DefectItem>();
+ private final DefectXViewer xViewer;
+ private static Object[] EMPTY_ARRAY = new Object[0];
+
+ public DefectContentProvider(DefectXViewer WorldXViewer) {
+ super();
+ this.xViewer = WorldXViewer;
+ }
+
+ public void add(final DefectItem item) {
+ add(Arrays.asList(item));
+ }
+
+ public void add(final Collection<? extends DefectItem> items) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ if (xViewer.getInput() == null) xViewer.setInput(rootSet);
+ rootSet.addAll(items);
+ xViewer.refresh();
+ };
+ });
+ }
+
+ public void set(final Collection<? extends DefectItem> arts) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ if (xViewer.getInput() == null) xViewer.setInput(rootSet);
+ clear();
+ add(arts);
+ };
+ });
+ }
+
+ public void clear() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ if (xViewer.getInput() == null) xViewer.setInput(rootSet);
+ rootSet.clear();
+ xViewer.refresh();
+ };
+ });
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof Object[]) {
+ return (Object[]) parentElement;
+ }
+ if (parentElement instanceof Collection) {
+ return ((Collection) parentElement).toArray();
+ }
+ return EMPTY_ARRAY;
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof String) return new Object[] {inputElement};
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /**
+ * @return the rootSet
+ */
+ public Collection<DefectItem> getRootSet() {
+ return rootSet;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectLabelProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectLabelProvider.java
index bf36c26e88e..1183286e7b6 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectLabelProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectLabelProvider.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * 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.ats.util.widgets.defect;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Disposition;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.InjectionActivity;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.graphics.Image;
-
-public class DefectLabelProvider extends XViewerLabelProvider {
- private final DefectXViewer xViewer;
-
- public DefectLabelProvider(DefectXViewer xViewer) {
- super(xViewer);
- this.xViewer = xViewer;
- }
-
- @Override
- public Image getColumnImage(Object element, XViewerColumn dCol, int columnIndex) throws OseeCoreException {
- DefectItem defectItem = (DefectItem) element;
- if (dCol.equals(DefectXViewerFactory.Severity_Col)) {
- return Severity.getImage(defectItem.getSeverity());
- } else if (dCol.equals(DefectXViewerFactory.Injection_Activity_Col)) {
- return ImageManager.getImage(FrameworkImage.INFO_SM);
- } else if (dCol.equals(DefectXViewerFactory.Disposition_Col)) {
- return Disposition.getImage(defectItem.getDisposition());
- } else if (dCol.equals(DefectXViewerFactory.Closed_Col)) {
- return ImageManager.getImage(defectItem.isClosed() ? PluginUiImage.CHECKBOX_ENABLED : PluginUiImage.CHECKBOX_DISABLED);
- } else if (dCol.equals(DefectXViewerFactory.User_Col)) {
- return ArtifactImageManager.getImage(defectItem.getUser());
- }
- return null;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn aCol, int columnIndex) throws OseeCoreException {
- DefectItem defectItem = (DefectItem) element;
- if (aCol.equals(DefectXViewerFactory.User_Col)) {
- return defectItem.getUser().getName();
- } else if (aCol.equals(DefectXViewerFactory.Closed_Col)) {
- return String.valueOf(defectItem.isClosed());
- } else if (aCol.equals(DefectXViewerFactory.Created_Date_Col)) {
- return defectItem.getCreatedDate(XDate.MMDDYYHHMM);
- } else if (aCol.equals(DefectXViewerFactory.Description_Col)) {
- return defectItem.getDescription();
- } else if (aCol.equals(DefectXViewerFactory.Resolution_Col)) {
- return defectItem.getResolution();
- } else if (aCol.equals(DefectXViewerFactory.Location_Col)) {
- return defectItem.getLocation();
- } else if (aCol.equals(DefectXViewerFactory.Severity_Col)) {
- return defectItem.getSeverity().equals(Severity.None) ? "" : defectItem.getSeverity().name();
- } else if (aCol.equals(DefectXViewerFactory.Disposition_Col)) {
- return defectItem.getDisposition().equals(Disposition.None) ? "" : defectItem.getDisposition().name();
- } else if (aCol.equals(DefectXViewerFactory.Injection_Activity_Col)) {
- return defectItem.getInjectionActivity() == InjectionActivity.None ? "" : defectItem.getInjectionActivity().name();
- }
-
- return "Unhandled Column";
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public DefectXViewer getTreeViewer() {
- return xViewer;
- }
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.defect;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Disposition;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.InjectionActivity;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.graphics.Image;
+
+public class DefectLabelProvider extends XViewerLabelProvider {
+ private final DefectXViewer xViewer;
+
+ public DefectLabelProvider(DefectXViewer xViewer) {
+ super(xViewer);
+ this.xViewer = xViewer;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, XViewerColumn dCol, int columnIndex) throws OseeCoreException {
+ DefectItem defectItem = (DefectItem) element;
+ if (dCol.equals(DefectXViewerFactory.Severity_Col)) {
+ return Severity.getImage(defectItem.getSeverity());
+ } else if (dCol.equals(DefectXViewerFactory.Injection_Activity_Col)) {
+ return ImageManager.getImage(FrameworkImage.INFO_SM);
+ } else if (dCol.equals(DefectXViewerFactory.Disposition_Col)) {
+ return Disposition.getImage(defectItem.getDisposition());
+ } else if (dCol.equals(DefectXViewerFactory.Closed_Col)) {
+ return ImageManager.getImage(defectItem.isClosed() ? PluginUiImage.CHECKBOX_ENABLED : PluginUiImage.CHECKBOX_DISABLED);
+ } else if (dCol.equals(DefectXViewerFactory.User_Col)) {
+ return ArtifactImageManager.getImage(defectItem.getUser());
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn aCol, int columnIndex) throws OseeCoreException {
+ DefectItem defectItem = (DefectItem) element;
+ if (aCol.equals(DefectXViewerFactory.User_Col)) {
+ return defectItem.getUser().getName();
+ } else if (aCol.equals(DefectXViewerFactory.Closed_Col)) {
+ return String.valueOf(defectItem.isClosed());
+ } else if (aCol.equals(DefectXViewerFactory.Created_Date_Col)) {
+ return defectItem.getCreatedDate(XDate.MMDDYYHHMM);
+ } else if (aCol.equals(DefectXViewerFactory.Description_Col)) {
+ return defectItem.getDescription();
+ } else if (aCol.equals(DefectXViewerFactory.Resolution_Col)) {
+ return defectItem.getResolution();
+ } else if (aCol.equals(DefectXViewerFactory.Location_Col)) {
+ return defectItem.getLocation();
+ } else if (aCol.equals(DefectXViewerFactory.Severity_Col)) {
+ return defectItem.getSeverity().equals(Severity.None) ? "" : defectItem.getSeverity().name();
+ } else if (aCol.equals(DefectXViewerFactory.Disposition_Col)) {
+ return defectItem.getDisposition().equals(Disposition.None) ? "" : defectItem.getDisposition().name();
+ } else if (aCol.equals(DefectXViewerFactory.Injection_Activity_Col)) {
+ return defectItem.getInjectionActivity() == InjectionActivity.None ? "" : defectItem.getInjectionActivity().name();
+ }
+
+ return "Unhandled Column";
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public DefectXViewer getTreeViewer() {
+ return xViewer;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectManager.java
index 44010fb0a7b..eeab276ff42 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectManager.java
@@ -1,207 +1,207 @@
-/*******************************************************************************
- * 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.ats.util.widgets.defect;
-
-import java.lang.ref.WeakReference;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.AXml;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-
-/**
- * @author Donald G. Dunne
- */
-public class DefectManager {
-
- private WeakReference<Artifact> artifactRef;
- private boolean enabled = true;
- private static String DEFECT_ITEM_TAG = "Item";
- private static String REVIEW_DEFECT_ATTRIBUTE_NAME = "ats.Review Defect";
- private final Matcher defectMatcher =
- java.util.regex.Pattern.compile("<" + DEFECT_ITEM_TAG + ">(.*?)</" + DEFECT_ITEM_TAG + ">",
- Pattern.DOTALL | Pattern.MULTILINE).matcher("");
-
- public DefectManager(Artifact artifact) {
- this.artifactRef = new WeakReference<Artifact>(artifact);
- }
-
- public Artifact getArtifact() throws OseeStateException {
- if (artifactRef.get() == null) {
- throw new OseeStateException("Artifact has been garbage collected");
- }
- return artifactRef.get();
- }
-
- public String getHtml() throws OseeCoreException {
- if (getDefectItems().isEmpty()) {
- return "";
- }
- StringBuffer sb = new StringBuffer();
- sb.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Defects"));
- sb.append(getTable());
- return sb.toString();
- }
-
- public Set<DefectItem> getDefectItems() throws OseeCoreException {
- Set<DefectItem> defectItems = new HashSet<DefectItem>();
- for (String xml : getArtifact().getAttributesToStringList(REVIEW_DEFECT_ATTRIBUTE_NAME)) {
- defectMatcher.reset(xml);
- while (defectMatcher.find()) {
- DefectItem item = new DefectItem(defectMatcher.group());
- defectItems.add(item);
- }
- }
- return defectItems;
- }
-
- public int getNumMajor() throws OseeCoreException {
- int x = 0;
- for (DefectItem dItem : getDefectItems()) {
- if (dItem.getSeverity() == Severity.Major) {
- x++;
- }
- }
- return x;
- }
-
- public int getNumMinor() throws OseeCoreException {
- int x = 0;
- for (DefectItem dItem : getDefectItems()) {
- if (dItem.getSeverity() == Severity.Minor) {
- x++;
- }
- }
- return x;
- }
-
- public int getNumIssues() throws OseeCoreException {
- int x = 0;
- for (DefectItem dItem : getDefectItems()) {
- if (dItem.getSeverity() == Severity.Issue) {
- x++;
- }
- }
- return x;
- }
-
- private void saveDefectItems(Set<DefectItem> defectItems, boolean persist, SkynetTransaction transaction) {
- try {
- // Change existing ones
- for (Attribute<?> attr : getArtifact().getAttributes(REVIEW_DEFECT_ATTRIBUTE_NAME)) {
- DefectItem dbPromoteItem = new DefectItem((String) attr.getValue());
- for (DefectItem pItem : defectItems) {
- if (pItem.equals(dbPromoteItem)) {
- attr.setFromString(AXml.addTagData(DEFECT_ITEM_TAG, pItem.toXml()));
- }
- }
- }
- Set<DefectItem> dbPromoteItems = getDefectItems();
- // Remove deleted ones; items in dbPromoteItems that are not in promoteItems
- for (DefectItem delPromoteItem : org.eclipse.osee.framework.jdk.core.util.Collections.setComplement(
- dbPromoteItems, defectItems)) {
- for (Attribute<?> attr : getArtifact().getAttributes(REVIEW_DEFECT_ATTRIBUTE_NAME)) {
- DefectItem dbPromoteItem = new DefectItem((String) attr.getValue());
- if (dbPromoteItem.equals(delPromoteItem)) {
- attr.delete();
- }
- }
- }
- // Add new ones: items in promoteItems that are not in dbPromoteItems
- for (DefectItem newPromoteItem : org.eclipse.osee.framework.jdk.core.util.Collections.setComplement(
- defectItems, dbPromoteItems)) {
- getArtifact().addAttributeFromString(REVIEW_DEFECT_ATTRIBUTE_NAME,
- AXml.addTagData(DEFECT_ITEM_TAG, newPromoteItem.toXml()));
- }
- if (persist) {
- getArtifact().persist(transaction);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't create ats review defect document", ex);
- }
- }
-
- public void addOrUpdateDefectItem(DefectItem defectItem, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
- Set<DefectItem> defectItems = getDefectItems();
- boolean found = false;
- for (DefectItem dItem : defectItems) {
- if (defectItem.equals(dItem)) {
- dItem.update(defectItem);
- found = true;
- }
- }
- if (!found) {
- defectItems.add(defectItem);
- }
- saveDefectItems(defectItems, persist, transaction);
- }
-
- public void removeDefectItem(DefectItem defectItem, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
- Set<DefectItem> defectItems = getDefectItems();
- defectItems.remove(defectItem);
- saveDefectItems(defectItems, persist, transaction);
- }
-
- public void addDefectItem(String description, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
- DefectItem item = new DefectItem();
- item.setDescription(description);
- addOrUpdateDefectItem(item, persist, transaction);
- }
-
- public String getTable() throws OseeCoreException {
- StringBuilder builder = new StringBuilder();
- builder.append("<TABLE BORDER=\"1\" cellspacing=\"1\" cellpadding=\"3%\" width=\"100%\"><THEAD><TR><TH>Severity</TH>" + "<TH>Disposition</TH><TH>Injection</TH><TH>User</TH><TH>Date</TH><TH>Description</TH><TH>Location</TH>" + "<TH>Resolution</TH><TH>Guid</TH><TH>Completed</TH></THEAD></TR>");
- for (DefectItem item : getDefectItems()) {
- User user = item.getUser();
- builder.append("<TR>");
- builder.append("<TD>" + item.getSeverity() + "</TD>");
- builder.append("<TD>" + item.getDisposition() + "</TD>");
- builder.append("<TD>" + item.getInjectionActivity() + "</TD>");
- if (user != null && user.equals(UserManager.getUser())) {
- builder.append("<TD bgcolor=\"#CCCCCC\">" + user.getName() + "</TD>");
- } else {
- builder.append("<TD>NONE</TD>");
- }
- builder.append("<TD>" + item.getCreatedDate(XDate.MMDDYYHHMM) + "</TD>");
- builder.append("<TD>" + item.getDescription() + "</TD>");
- builder.append("<TD>" + item.getLocation() + "</TD>");
- builder.append("<TD>" + item.getResolution() + "</TD>");
- builder.append("<TD>" + item.getGuid() + "</TD>");
- builder.append("<TD>" + item.isClosed() + "</TD>");
- builder.append("</TR>");
-
- }
- builder.append("</TABLE>");
- return builder.toString();
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
+/*******************************************************************************
+ * 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.ats.util.widgets.defect;
+
+import java.lang.ref.WeakReference;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.AXml;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DefectManager {
+
+ private WeakReference<Artifact> artifactRef;
+ private boolean enabled = true;
+ private static String DEFECT_ITEM_TAG = "Item";
+ private static String REVIEW_DEFECT_ATTRIBUTE_NAME = "ats.Review Defect";
+ private final Matcher defectMatcher =
+ java.util.regex.Pattern.compile("<" + DEFECT_ITEM_TAG + ">(.*?)</" + DEFECT_ITEM_TAG + ">",
+ Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+
+ public DefectManager(Artifact artifact) {
+ this.artifactRef = new WeakReference<Artifact>(artifact);
+ }
+
+ public Artifact getArtifact() throws OseeStateException {
+ if (artifactRef.get() == null) {
+ throw new OseeStateException("Artifact has been garbage collected");
+ }
+ return artifactRef.get();
+ }
+
+ public String getHtml() throws OseeCoreException {
+ if (getDefectItems().isEmpty()) {
+ return "";
+ }
+ StringBuffer sb = new StringBuffer();
+ sb.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Defects"));
+ sb.append(getTable());
+ return sb.toString();
+ }
+
+ public Set<DefectItem> getDefectItems() throws OseeCoreException {
+ Set<DefectItem> defectItems = new HashSet<DefectItem>();
+ for (String xml : getArtifact().getAttributesToStringList(REVIEW_DEFECT_ATTRIBUTE_NAME)) {
+ defectMatcher.reset(xml);
+ while (defectMatcher.find()) {
+ DefectItem item = new DefectItem(defectMatcher.group());
+ defectItems.add(item);
+ }
+ }
+ return defectItems;
+ }
+
+ public int getNumMajor() throws OseeCoreException {
+ int x = 0;
+ for (DefectItem dItem : getDefectItems()) {
+ if (dItem.getSeverity() == Severity.Major) {
+ x++;
+ }
+ }
+ return x;
+ }
+
+ public int getNumMinor() throws OseeCoreException {
+ int x = 0;
+ for (DefectItem dItem : getDefectItems()) {
+ if (dItem.getSeverity() == Severity.Minor) {
+ x++;
+ }
+ }
+ return x;
+ }
+
+ public int getNumIssues() throws OseeCoreException {
+ int x = 0;
+ for (DefectItem dItem : getDefectItems()) {
+ if (dItem.getSeverity() == Severity.Issue) {
+ x++;
+ }
+ }
+ return x;
+ }
+
+ private void saveDefectItems(Set<DefectItem> defectItems, boolean persist, SkynetTransaction transaction) {
+ try {
+ // Change existing ones
+ for (Attribute<?> attr : getArtifact().getAttributes(REVIEW_DEFECT_ATTRIBUTE_NAME)) {
+ DefectItem dbPromoteItem = new DefectItem((String) attr.getValue());
+ for (DefectItem pItem : defectItems) {
+ if (pItem.equals(dbPromoteItem)) {
+ attr.setFromString(AXml.addTagData(DEFECT_ITEM_TAG, pItem.toXml()));
+ }
+ }
+ }
+ Set<DefectItem> dbPromoteItems = getDefectItems();
+ // Remove deleted ones; items in dbPromoteItems that are not in promoteItems
+ for (DefectItem delPromoteItem : org.eclipse.osee.framework.jdk.core.util.Collections.setComplement(
+ dbPromoteItems, defectItems)) {
+ for (Attribute<?> attr : getArtifact().getAttributes(REVIEW_DEFECT_ATTRIBUTE_NAME)) {
+ DefectItem dbPromoteItem = new DefectItem((String) attr.getValue());
+ if (dbPromoteItem.equals(delPromoteItem)) {
+ attr.delete();
+ }
+ }
+ }
+ // Add new ones: items in promoteItems that are not in dbPromoteItems
+ for (DefectItem newPromoteItem : org.eclipse.osee.framework.jdk.core.util.Collections.setComplement(
+ defectItems, dbPromoteItems)) {
+ getArtifact().addAttributeFromString(REVIEW_DEFECT_ATTRIBUTE_NAME,
+ AXml.addTagData(DEFECT_ITEM_TAG, newPromoteItem.toXml()));
+ }
+ if (persist) {
+ getArtifact().persist(transaction);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't create ats review defect document", ex);
+ }
+ }
+
+ public void addOrUpdateDefectItem(DefectItem defectItem, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
+ Set<DefectItem> defectItems = getDefectItems();
+ boolean found = false;
+ for (DefectItem dItem : defectItems) {
+ if (defectItem.equals(dItem)) {
+ dItem.update(defectItem);
+ found = true;
+ }
+ }
+ if (!found) {
+ defectItems.add(defectItem);
+ }
+ saveDefectItems(defectItems, persist, transaction);
+ }
+
+ public void removeDefectItem(DefectItem defectItem, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
+ Set<DefectItem> defectItems = getDefectItems();
+ defectItems.remove(defectItem);
+ saveDefectItems(defectItems, persist, transaction);
+ }
+
+ public void addDefectItem(String description, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
+ DefectItem item = new DefectItem();
+ item.setDescription(description);
+ addOrUpdateDefectItem(item, persist, transaction);
+ }
+
+ public String getTable() throws OseeCoreException {
+ StringBuilder builder = new StringBuilder();
+ builder.append("<TABLE BORDER=\"1\" cellspacing=\"1\" cellpadding=\"3%\" width=\"100%\"><THEAD><TR><TH>Severity</TH>" + "<TH>Disposition</TH><TH>Injection</TH><TH>User</TH><TH>Date</TH><TH>Description</TH><TH>Location</TH>" + "<TH>Resolution</TH><TH>Guid</TH><TH>Completed</TH></THEAD></TR>");
+ for (DefectItem item : getDefectItems()) {
+ User user = item.getUser();
+ builder.append("<TR>");
+ builder.append("<TD>" + item.getSeverity() + "</TD>");
+ builder.append("<TD>" + item.getDisposition() + "</TD>");
+ builder.append("<TD>" + item.getInjectionActivity() + "</TD>");
+ if (user != null && user.equals(UserManager.getUser())) {
+ builder.append("<TD bgcolor=\"#CCCCCC\">" + user.getName() + "</TD>");
+ } else {
+ builder.append("<TD>NONE</TD>");
+ }
+ builder.append("<TD>" + item.getCreatedDate(XDate.MMDDYYHHMM) + "</TD>");
+ builder.append("<TD>" + item.getDescription() + "</TD>");
+ builder.append("<TD>" + item.getLocation() + "</TD>");
+ builder.append("<TD>" + item.getResolution() + "</TD>");
+ builder.append("<TD>" + item.getGuid() + "</TD>");
+ builder.append("<TD>" + item.isClosed() + "</TD>");
+ builder.append("</TR>");
+
+ }
+ builder.append("</TABLE>");
+ return builder.toString();
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewer.java
index 3ed9c333c7e..69abac7ca8c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewer.java
@@ -1,500 +1,500 @@
-/*******************************************************************************
- * 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.ats.util.widgets.defect;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
-import org.eclipse.nebula.widgets.xviewer.XPromptChange;
-import org.eclipse.nebula.widgets.xviewer.XPromptChange.Option;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.util.EnumStringSingleSelectionDialog;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Disposition;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.InjectionActivity;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserListDialog;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class DefectXViewer extends XViewer {
-
- private final XDefectViewer xDefectViewer;
- private Action editSeverityAction;
- private Action editDispositionAction;
- private Action editClosedAction;
- private Action editUserAction;
- private Action editCreatedDateAction;
- private Action editInjectionAction;
- private Action editDescriptionAction;
- private Action editLocationAction;
- private Action editResolutionAction;
-
- /**
- * @param parent
- * @param style
- */
- DefectXViewer(Composite parent, int style, XDefectViewer xDefectViewer) {
- this(parent, style, new DefectXViewerFactory(), xDefectViewer);
- }
-
- public DefectXViewer(Composite parent, int style, IXViewerFactory xViewerFactory, XDefectViewer xDefectViewer) {
- super(parent, style, xViewerFactory);
- this.xDefectViewer = xDefectViewer;
- }
-
- @Override
- protected void createSupportWidgets(Composite parent) {
- super.createSupportWidgets(parent);
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- ((DefectContentProvider) getContentProvider()).clear();
- }
- });
- createMenuActions();
- }
-
- public void createMenuActions() {
- setColumnMultiEditEnabled(true);
- MenuManager mm = getMenuManager();
- mm.createContextMenu(getControl());
-
- editSeverityAction = new Action("Edit Severity", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.Severity_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
-
- editClosedAction = new Action("Edit Closed ", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.Closed_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
-
- editCreatedDateAction = new Action("Edit Created Date ", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.Created_Date_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
-
- editDescriptionAction = new Action("Edit Description ", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.Description_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
-
- editDispositionAction = new Action("Edit Disposition ", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.Disposition_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
-
- editInjectionAction = new Action("Edit Injection ", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.Injection_Activity_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
-
- editLocationAction = new Action("Edit Location ", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.Location_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
-
- editResolutionAction = new Action("Edit Resolution ", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.Resolution_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
-
- editUserAction = new Action("Edit User ", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- boolean columnMultiEdit = false;
- // grab the data, prompt change
- try {
- promptChangeData(DefectXViewerFactory.User_Col, getSelectedDefectItems(), columnMultiEdit);
- } catch (OseeCoreException ex) {
- OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
- }
- }
- };
- }
-
- public void updateEditMenuActions() {
- MenuManager mm = getMenuManager();
- // EDIT MENU BLOCK
- mm.insertBefore(MENU_GROUP_PRE, editSeverityAction);
- editSeverityAction.setEnabled(true);
- mm.insertBefore(MENU_GROUP_PRE, editClosedAction);
- editClosedAction.setEnabled(true);
- mm.insertBefore(MENU_GROUP_PRE, editCreatedDateAction);
- editCreatedDateAction.setEnabled(true);
- mm.insertBefore(MENU_GROUP_PRE, editDescriptionAction);
- editDescriptionAction.setEnabled(true);
- mm.insertBefore(MENU_GROUP_PRE, editDispositionAction);
- editDispositionAction.setEnabled(true);
- mm.insertBefore(MENU_GROUP_PRE, editInjectionAction);
- editInjectionAction.setEnabled(true);
- mm.insertBefore(MENU_GROUP_PRE, editLocationAction);
- editLocationAction.setEnabled(true);
- mm.insertBefore(MENU_GROUP_PRE, editResolutionAction);
- editResolutionAction.setEnabled(true);
- mm.insertBefore(MENU_GROUP_PRE, editUserAction);
- editUserAction.setEnabled(true);
-
- }
-
- @Override
- public void updateMenuActionsForTable() {
- MenuManager mm = getMenuManager();
- updateEditMenuActions();
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
- }
-
- public Collection<DefectItem> getLoadedDefectItems() {
- return ((DefectContentProvider) getContentProvider()).getRootSet();
- }
-
- public void add(Collection<DefectItem> defectItems) {
- if (((DefectContentProvider) getContentProvider()) != null) ((DefectContentProvider) getContentProvider()).add(defectItems);
- }
-
- public void set(Collection<? extends DefectItem> defectItems) {
- if (((DefectContentProvider) getContentProvider()) != null) ((DefectContentProvider) getContentProvider()).set(defectItems);
- }
-
- public void clear() {
- if (((DefectContentProvider) getContentProvider()) != null) ((DefectContentProvider) getContentProvider()).clear();
- }
-
- /**
- * Release resources
- */
- @Override
- public void dispose() {
- // Dispose of the table objects is done through separate dispose listener off tree
- // Tell the label provider to release its resources
- getLabelProvider().dispose();
- }
-
- public ArrayList<DefectItem> getSelectedDefectItems() {
- ArrayList<DefectItem> arts = new ArrayList<DefectItem>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) for (TreeItem item : items)
- arts.add((DefectItem) item.getData());
- return arts;
- }
-
- @Override
- public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
- if (!xDefectViewer.isEditable()) {
- return;
- }
- ArrayList<DefectItem> defectItems = new ArrayList<DefectItem>();
- for (TreeItem item : treeItems) {
- defectItems.add((DefectItem) item.getData());
- }
- try {
- promptChangeData((XViewerColumn) treeColumn.getData(), defectItems, isColumnMultiEditEnabled());
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
- XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
- if (xCol.equals(DefectXViewerFactory.User_Col) || xCol.equals(DefectXViewerFactory.Injection_Activity_Col) || xCol.equals(DefectXViewerFactory.Closed_Col) || xCol.equals(DefectXViewerFactory.Severity_Col)) {
- return handleAltLeftClick(treeColumn, treeItem);
- }
- return false;
- }
-
- @Override
- public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
- if (!xDefectViewer.isEditable()) {
- return false;
- }
- try {
- XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
- DefectItem defectItem = (DefectItem) treeItem.getData();
- List<DefectItem> defectItems = new ArrayList<DefectItem>();
- defectItems.add(defectItem);
- if (xCol.equals(DefectXViewerFactory.Severity_Col) || xCol.equals(DefectXViewerFactory.Disposition_Col) || xCol.equals(DefectXViewerFactory.Created_Date_Col) || xCol.equals(DefectXViewerFactory.Closed_Col) || xCol.equals(DefectXViewerFactory.Description_Col) || xCol.equals(DefectXViewerFactory.Resolution_Col) || xCol.equals(DefectXViewerFactory.Location_Col) || xCol.equals(DefectXViewerFactory.User_Col) || xCol.equals(DefectXViewerFactory.Injection_Activity_Col)) {
- return promptChangeData(xCol, defectItems, false);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- private boolean setInjectionActivity(Collection<DefectItem> defectItems, InjectionActivity newInjectionActivity) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- if (!defectItem.getInjectionActivity().equals(newInjectionActivity)) {
- defectItem.setInjectionActivity(newInjectionActivity);
- // at least one in the list has been changed.
- if (!modified) modified = true;
- }
- }
- return modified;
- }
-
- private boolean setUser(Collection<DefectItem> defectItems, User user) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- if (!defectItem.getUser().equals(user)) {
- defectItem.setUser(user);
- // at least one in the list has been changed.
- if (!modified) modified = true;
- }
- }
- return modified;
- }
-
- private boolean setLocation(Collection<DefectItem> defectItems, String loc) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- if (!defectItem.getLocation().equals(loc)) {
- defectItem.setLocation(loc);
- if (!modified) modified = true;
- }
- }
- return modified;
- }
-
- private boolean setDescription(Collection<DefectItem> defectItems, String desc) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- if (!defectItem.toString().equals(desc)) {
- defectItem.setDescription(desc);
- if (!modified) modified = true;
- }
-
- }
- return modified;
- }
-
- private boolean setClosed(Collection<DefectItem> defectItems, boolean closed) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- if (defectItem.isClosed() != closed) {
- defectItem.setClosed(closed);
- if (!modified) modified = true;
- }
- }
- return modified;
- }
-
- private boolean setSeverity(Collection<DefectItem> defectItems, Severity severity) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- if (!defectItem.getSeverity().equals(severity)) {
- defectItem.setSeverity(severity);
- if (!modified) modified = true;
- }
- }
- return modified;
- }
-
- private boolean setDisposition(Collection<DefectItem> defectItems, Disposition disposition) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- if (!defectItem.getDisposition().equals(disposition)) {
- defectItem.setDisposition(disposition);
- if (!modified) modified = true;
- }
- }
- return modified;
- }
-
- private boolean setDate(Collection<DefectItem> defectItems, Date date) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- if (!defectItem.getDate().equals(date)) {
- defectItem.setDate(date);
- if (!modified) modified = true;
- }
- }
- return modified;
- }
-
- private boolean setResolution(Collection<DefectItem> defectItems, String resolution) {
- boolean modified = false;
- for (DefectItem defectItem : defectItems) {
- defectItem.setResolution(resolution);
- if (!modified) modified = true;
- }
- return modified;
- }
-
- public boolean promptChangeData(XViewerColumn xCol, Collection<DefectItem> defectItems, boolean columnMultiEdit) throws OseeCoreException {
- boolean modified = false;
- if (defectItems != null && !defectItems.isEmpty()) {
- DefectItem defectItem = (DefectItem) defectItems.toArray()[0];
- if (xCol.equals(DefectXViewerFactory.Severity_Col)) {
- EnumStringSingleSelectionDialog enumDialog =
- XPromptChange.promptChangeSingleSelectEnumeration(xCol.getName(), Severity.strValues(),
- ((columnMultiEdit) ? null : defectItem.getSeverity().name()));
- if (enumDialog != null && enumDialog.getResult() != null) {
- modified = setSeverity(defectItems, Severity.valueOf((String) enumDialog.getResult()[0]));
- }
- } else if (xCol.equals(DefectXViewerFactory.Disposition_Col)) {
- EnumStringSingleSelectionDialog enumDialog =
- XPromptChange.promptChangeSingleSelectEnumeration(xCol.getName(), Disposition.strValues(),
- ((columnMultiEdit) ? null : defectItem.getDisposition().name()));
- if (enumDialog != null && enumDialog.getResult() != null) {
- modified = setDisposition(defectItems, Disposition.valueOf((String) enumDialog.getResult()[0]));
- }
- } else if (xCol.equals(DefectXViewerFactory.Created_Date_Col)) {
- Date selDate =
- XPromptChange.promptChangeDate(xCol.getName(), ((columnMultiEdit) ? defectItem.getDate() : null));
- if (selDate != null) {
- modified = setDate(defectItems, selDate);
- }
- } else if (xCol.equals(DefectXViewerFactory.Closed_Col)) {
- Boolean closed =
- XPromptChange.promptChangeBoolean(xCol.getName(), xCol.getName(),
- ((columnMultiEdit) ? false : defectItem.isClosed()));
- if (closed != null) {
- modified = setClosed(defectItems, closed);
- }
- } else if (xCol.equals(DefectXViewerFactory.Description_Col)) {
- String desc =
- XPromptChange.promptChangeString(xCol.getName(),
- ((columnMultiEdit) ? null : defectItem.getDescription()), null, Option.MULTI_LINE);
- if (desc != null) {
- modified = setDescription(defectItems, desc);
- }
- } else if (xCol.equals(DefectXViewerFactory.Resolution_Col)) {
- String resolution =
- XPromptChange.promptChangeString(xCol.getName(),
- (columnMultiEdit ? null : defectItem.getResolution()), null, Option.MULTI_LINE);
- if (resolution != null) {
- modified = setResolution(defectItems, resolution);
- }
- } else if (xCol.equals(DefectXViewerFactory.Location_Col)) {
- String loc =
- XPromptChange.promptChangeString(xCol.getName(),
- ((columnMultiEdit) ? null : defectItem.getLocation()), null, Option.MULTI_LINE);
- if (loc != null) {
- modified = setLocation(defectItems, loc);
- }
- } else if (xCol.equals(DefectXViewerFactory.User_Col)) {
- UserListDialog ld = new UserListDialog(Displays.getActiveShell(), "Select New User");
- int result = ld.open();
- if (result == 0) {
- modified = setUser(defectItems, ld.getSelection());
- }
- } else if (xCol.equals(DefectXViewerFactory.Injection_Activity_Col)) {
- EnumStringSingleSelectionDialog enumDialog =
- XPromptChange.promptChangeSingleSelectEnumeration(xCol.getName(), InjectionActivity.strValues(),
- ((columnMultiEdit) ? null : defectItem.getInjectionActivity().name()));
- if (enumDialog != null && enumDialog.getResult() != null) {
- modified =
- setInjectionActivity(defectItems, InjectionActivity.valueOf((String) enumDialog.getResult()[0]));
- }
- }
- if (modified) {
- return executeTransaction(defectItems);
- }
- }
- return false;
- }
-
- public boolean executeTransaction(Collection<DefectItem> defectItems) throws OseeCoreException {
- SkynetTransaction transaction =
- new SkynetTransaction(xDefectViewer.getReviewArt().getArtifact().getBranch(), "Modify Review Defects");
- for (DefectItem defectItem : defectItems) {
- xDefectViewer.getReviewArt().getDefectManager().addOrUpdateDefectItem(defectItem, false, transaction);
- update(defectItem, null);
- }
- transaction.execute();
- xDefectViewer.notifyXModifiedListeners();
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.util.widgets.defect;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
+import org.eclipse.nebula.widgets.xviewer.XPromptChange;
+import org.eclipse.nebula.widgets.xviewer.XPromptChange.Option;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.util.EnumStringSingleSelectionDialog;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Disposition;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.InjectionActivity;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserListDialog;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DefectXViewer extends XViewer {
+
+ private final XDefectViewer xDefectViewer;
+ private Action editSeverityAction;
+ private Action editDispositionAction;
+ private Action editClosedAction;
+ private Action editUserAction;
+ private Action editCreatedDateAction;
+ private Action editInjectionAction;
+ private Action editDescriptionAction;
+ private Action editLocationAction;
+ private Action editResolutionAction;
+
+ /**
+ * @param parent
+ * @param style
+ */
+ DefectXViewer(Composite parent, int style, XDefectViewer xDefectViewer) {
+ this(parent, style, new DefectXViewerFactory(), xDefectViewer);
+ }
+
+ public DefectXViewer(Composite parent, int style, IXViewerFactory xViewerFactory, XDefectViewer xDefectViewer) {
+ super(parent, style, xViewerFactory);
+ this.xDefectViewer = xDefectViewer;
+ }
+
+ @Override
+ protected void createSupportWidgets(Composite parent) {
+ super.createSupportWidgets(parent);
+ parent.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ ((DefectContentProvider) getContentProvider()).clear();
+ }
+ });
+ createMenuActions();
+ }
+
+ public void createMenuActions() {
+ setColumnMultiEditEnabled(true);
+ MenuManager mm = getMenuManager();
+ mm.createContextMenu(getControl());
+
+ editSeverityAction = new Action("Edit Severity", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.Severity_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+
+ editClosedAction = new Action("Edit Closed ", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.Closed_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+
+ editCreatedDateAction = new Action("Edit Created Date ", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.Created_Date_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+
+ editDescriptionAction = new Action("Edit Description ", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.Description_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+
+ editDispositionAction = new Action("Edit Disposition ", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.Disposition_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+
+ editInjectionAction = new Action("Edit Injection ", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.Injection_Activity_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+
+ editLocationAction = new Action("Edit Location ", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.Location_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+
+ editResolutionAction = new Action("Edit Resolution ", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.Resolution_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+
+ editUserAction = new Action("Edit User ", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ boolean columnMultiEdit = false;
+ // grab the data, prompt change
+ try {
+ promptChangeData(DefectXViewerFactory.User_Col, getSelectedDefectItems(), columnMultiEdit);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(DefectXViewer.class, OseeLevel.SEVERE_POPUP, ex.toString());
+ }
+ }
+ };
+ }
+
+ public void updateEditMenuActions() {
+ MenuManager mm = getMenuManager();
+ // EDIT MENU BLOCK
+ mm.insertBefore(MENU_GROUP_PRE, editSeverityAction);
+ editSeverityAction.setEnabled(true);
+ mm.insertBefore(MENU_GROUP_PRE, editClosedAction);
+ editClosedAction.setEnabled(true);
+ mm.insertBefore(MENU_GROUP_PRE, editCreatedDateAction);
+ editCreatedDateAction.setEnabled(true);
+ mm.insertBefore(MENU_GROUP_PRE, editDescriptionAction);
+ editDescriptionAction.setEnabled(true);
+ mm.insertBefore(MENU_GROUP_PRE, editDispositionAction);
+ editDispositionAction.setEnabled(true);
+ mm.insertBefore(MENU_GROUP_PRE, editInjectionAction);
+ editInjectionAction.setEnabled(true);
+ mm.insertBefore(MENU_GROUP_PRE, editLocationAction);
+ editLocationAction.setEnabled(true);
+ mm.insertBefore(MENU_GROUP_PRE, editResolutionAction);
+ editResolutionAction.setEnabled(true);
+ mm.insertBefore(MENU_GROUP_PRE, editUserAction);
+ editUserAction.setEnabled(true);
+
+ }
+
+ @Override
+ public void updateMenuActionsForTable() {
+ MenuManager mm = getMenuManager();
+ updateEditMenuActions();
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+ }
+
+ public Collection<DefectItem> getLoadedDefectItems() {
+ return ((DefectContentProvider) getContentProvider()).getRootSet();
+ }
+
+ public void add(Collection<DefectItem> defectItems) {
+ if (((DefectContentProvider) getContentProvider()) != null) ((DefectContentProvider) getContentProvider()).add(defectItems);
+ }
+
+ public void set(Collection<? extends DefectItem> defectItems) {
+ if (((DefectContentProvider) getContentProvider()) != null) ((DefectContentProvider) getContentProvider()).set(defectItems);
+ }
+
+ public void clear() {
+ if (((DefectContentProvider) getContentProvider()) != null) ((DefectContentProvider) getContentProvider()).clear();
+ }
+
+ /**
+ * Release resources
+ */
+ @Override
+ public void dispose() {
+ // Dispose of the table objects is done through separate dispose listener off tree
+ // Tell the label provider to release its resources
+ getLabelProvider().dispose();
+ }
+
+ public ArrayList<DefectItem> getSelectedDefectItems() {
+ ArrayList<DefectItem> arts = new ArrayList<DefectItem>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) for (TreeItem item : items)
+ arts.add((DefectItem) item.getData());
+ return arts;
+ }
+
+ @Override
+ public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
+ if (!xDefectViewer.isEditable()) {
+ return;
+ }
+ ArrayList<DefectItem> defectItems = new ArrayList<DefectItem>();
+ for (TreeItem item : treeItems) {
+ defectItems.add((DefectItem) item.getData());
+ }
+ try {
+ promptChangeData((XViewerColumn) treeColumn.getData(), defectItems, isColumnMultiEditEnabled());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
+ XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
+ if (xCol.equals(DefectXViewerFactory.User_Col) || xCol.equals(DefectXViewerFactory.Injection_Activity_Col) || xCol.equals(DefectXViewerFactory.Closed_Col) || xCol.equals(DefectXViewerFactory.Severity_Col)) {
+ return handleAltLeftClick(treeColumn, treeItem);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
+ if (!xDefectViewer.isEditable()) {
+ return false;
+ }
+ try {
+ XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
+ DefectItem defectItem = (DefectItem) treeItem.getData();
+ List<DefectItem> defectItems = new ArrayList<DefectItem>();
+ defectItems.add(defectItem);
+ if (xCol.equals(DefectXViewerFactory.Severity_Col) || xCol.equals(DefectXViewerFactory.Disposition_Col) || xCol.equals(DefectXViewerFactory.Created_Date_Col) || xCol.equals(DefectXViewerFactory.Closed_Col) || xCol.equals(DefectXViewerFactory.Description_Col) || xCol.equals(DefectXViewerFactory.Resolution_Col) || xCol.equals(DefectXViewerFactory.Location_Col) || xCol.equals(DefectXViewerFactory.User_Col) || xCol.equals(DefectXViewerFactory.Injection_Activity_Col)) {
+ return promptChangeData(xCol, defectItems, false);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ private boolean setInjectionActivity(Collection<DefectItem> defectItems, InjectionActivity newInjectionActivity) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ if (!defectItem.getInjectionActivity().equals(newInjectionActivity)) {
+ defectItem.setInjectionActivity(newInjectionActivity);
+ // at least one in the list has been changed.
+ if (!modified) modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private boolean setUser(Collection<DefectItem> defectItems, User user) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ if (!defectItem.getUser().equals(user)) {
+ defectItem.setUser(user);
+ // at least one in the list has been changed.
+ if (!modified) modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private boolean setLocation(Collection<DefectItem> defectItems, String loc) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ if (!defectItem.getLocation().equals(loc)) {
+ defectItem.setLocation(loc);
+ if (!modified) modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private boolean setDescription(Collection<DefectItem> defectItems, String desc) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ if (!defectItem.toString().equals(desc)) {
+ defectItem.setDescription(desc);
+ if (!modified) modified = true;
+ }
+
+ }
+ return modified;
+ }
+
+ private boolean setClosed(Collection<DefectItem> defectItems, boolean closed) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ if (defectItem.isClosed() != closed) {
+ defectItem.setClosed(closed);
+ if (!modified) modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private boolean setSeverity(Collection<DefectItem> defectItems, Severity severity) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ if (!defectItem.getSeverity().equals(severity)) {
+ defectItem.setSeverity(severity);
+ if (!modified) modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private boolean setDisposition(Collection<DefectItem> defectItems, Disposition disposition) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ if (!defectItem.getDisposition().equals(disposition)) {
+ defectItem.setDisposition(disposition);
+ if (!modified) modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private boolean setDate(Collection<DefectItem> defectItems, Date date) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ if (!defectItem.getDate().equals(date)) {
+ defectItem.setDate(date);
+ if (!modified) modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private boolean setResolution(Collection<DefectItem> defectItems, String resolution) {
+ boolean modified = false;
+ for (DefectItem defectItem : defectItems) {
+ defectItem.setResolution(resolution);
+ if (!modified) modified = true;
+ }
+ return modified;
+ }
+
+ public boolean promptChangeData(XViewerColumn xCol, Collection<DefectItem> defectItems, boolean columnMultiEdit) throws OseeCoreException {
+ boolean modified = false;
+ if (defectItems != null && !defectItems.isEmpty()) {
+ DefectItem defectItem = (DefectItem) defectItems.toArray()[0];
+ if (xCol.equals(DefectXViewerFactory.Severity_Col)) {
+ EnumStringSingleSelectionDialog enumDialog =
+ XPromptChange.promptChangeSingleSelectEnumeration(xCol.getName(), Severity.strValues(),
+ ((columnMultiEdit) ? null : defectItem.getSeverity().name()));
+ if (enumDialog != null && enumDialog.getResult() != null) {
+ modified = setSeverity(defectItems, Severity.valueOf((String) enumDialog.getResult()[0]));
+ }
+ } else if (xCol.equals(DefectXViewerFactory.Disposition_Col)) {
+ EnumStringSingleSelectionDialog enumDialog =
+ XPromptChange.promptChangeSingleSelectEnumeration(xCol.getName(), Disposition.strValues(),
+ ((columnMultiEdit) ? null : defectItem.getDisposition().name()));
+ if (enumDialog != null && enumDialog.getResult() != null) {
+ modified = setDisposition(defectItems, Disposition.valueOf((String) enumDialog.getResult()[0]));
+ }
+ } else if (xCol.equals(DefectXViewerFactory.Created_Date_Col)) {
+ Date selDate =
+ XPromptChange.promptChangeDate(xCol.getName(), ((columnMultiEdit) ? defectItem.getDate() : null));
+ if (selDate != null) {
+ modified = setDate(defectItems, selDate);
+ }
+ } else if (xCol.equals(DefectXViewerFactory.Closed_Col)) {
+ Boolean closed =
+ XPromptChange.promptChangeBoolean(xCol.getName(), xCol.getName(),
+ ((columnMultiEdit) ? false : defectItem.isClosed()));
+ if (closed != null) {
+ modified = setClosed(defectItems, closed);
+ }
+ } else if (xCol.equals(DefectXViewerFactory.Description_Col)) {
+ String desc =
+ XPromptChange.promptChangeString(xCol.getName(),
+ ((columnMultiEdit) ? null : defectItem.getDescription()), null, Option.MULTI_LINE);
+ if (desc != null) {
+ modified = setDescription(defectItems, desc);
+ }
+ } else if (xCol.equals(DefectXViewerFactory.Resolution_Col)) {
+ String resolution =
+ XPromptChange.promptChangeString(xCol.getName(),
+ (columnMultiEdit ? null : defectItem.getResolution()), null, Option.MULTI_LINE);
+ if (resolution != null) {
+ modified = setResolution(defectItems, resolution);
+ }
+ } else if (xCol.equals(DefectXViewerFactory.Location_Col)) {
+ String loc =
+ XPromptChange.promptChangeString(xCol.getName(),
+ ((columnMultiEdit) ? null : defectItem.getLocation()), null, Option.MULTI_LINE);
+ if (loc != null) {
+ modified = setLocation(defectItems, loc);
+ }
+ } else if (xCol.equals(DefectXViewerFactory.User_Col)) {
+ UserListDialog ld = new UserListDialog(Displays.getActiveShell(), "Select New User");
+ int result = ld.open();
+ if (result == 0) {
+ modified = setUser(defectItems, ld.getSelection());
+ }
+ } else if (xCol.equals(DefectXViewerFactory.Injection_Activity_Col)) {
+ EnumStringSingleSelectionDialog enumDialog =
+ XPromptChange.promptChangeSingleSelectEnumeration(xCol.getName(), InjectionActivity.strValues(),
+ ((columnMultiEdit) ? null : defectItem.getInjectionActivity().name()));
+ if (enumDialog != null && enumDialog.getResult() != null) {
+ modified =
+ setInjectionActivity(defectItems, InjectionActivity.valueOf((String) enumDialog.getResult()[0]));
+ }
+ }
+ if (modified) {
+ return executeTransaction(defectItems);
+ }
+ }
+ return false;
+ }
+
+ public boolean executeTransaction(Collection<DefectItem> defectItems) throws OseeCoreException {
+ SkynetTransaction transaction =
+ new SkynetTransaction(xDefectViewer.getReviewArt().getArtifact().getBranch(), "Modify Review Defects");
+ for (DefectItem defectItem : defectItems) {
+ xDefectViewer.getReviewArt().getDefectManager().addOrUpdateDefectItem(defectItem, false, transaction);
+ update(defectItem, null);
+ }
+ transaction.execute();
+ xDefectViewer.notifyXModifiedListeners();
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewerFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewerFactory.java
index 23c95441afc..7c08378f318 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewerFactory.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/DefectXViewerFactory.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * 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.ats.util.widgets.defect;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class DefectXViewerFactory extends SkynetXViewerFactory {
-
- public static XViewerColumn Severity_Col =
- new XViewerColumn("osee.defect.severity", "Severity", 70, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Disposition_Col =
- new XViewerColumn("osee.defect.disposition", "Disposition", 70, SWT.CENTER, true, SortDataType.String, false,
- null);
- public static XViewerColumn Closed_Col =
- new XViewerColumn("osee.defect.closed", "Closed", 70, SWT.LEFT, true, SortDataType.Boolean, false, null);
- public static XViewerColumn User_Col =
- new XViewerColumn("osee.defect.user", "User", 100, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Created_Date_Col =
- new XViewerColumn("osee.defect.createdDate", "Created Date", 80, SWT.LEFT, true, SortDataType.Date, false,
- null);
- public static XViewerColumn Injection_Activity_Col =
- new XViewerColumn("osee.defect.injectionActivity", "Injection Activity", 35, SWT.LEFT, true,
- SortDataType.String, false, null);
- public static XViewerColumn Description_Col =
- new XViewerColumn("osee.defect.description", "Description", 200, SWT.LEFT, true,
- SortDataType.String_MultiLine, false, null);
- public static XViewerColumn Location_Col =
- new XViewerColumn("osee.defect.location", "Location", 200, SWT.LEFT, true, SortDataType.String_MultiLine,
- false, null);
- public static XViewerColumn Resolution_Col =
- new XViewerColumn("osee.defect.resolution", "Resolution", 200, SWT.LEFT, true, SortDataType.String_MultiLine,
- false, null);
-
- private static String NAMESPACE = "osee.ats.DefectXViewer";
-
- public DefectXViewerFactory() {
- super(NAMESPACE);
- registerColumns(Severity_Col, Disposition_Col, Closed_Col, User_Col, Created_Date_Col, Injection_Activity_Col,
- Description_Col, Location_Col, Resolution_Col);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.defect;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DefectXViewerFactory extends SkynetXViewerFactory {
+
+ public static XViewerColumn Severity_Col =
+ new XViewerColumn("osee.defect.severity", "Severity", 70, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Disposition_Col =
+ new XViewerColumn("osee.defect.disposition", "Disposition", 70, SWT.CENTER, true, SortDataType.String, false,
+ null);
+ public static XViewerColumn Closed_Col =
+ new XViewerColumn("osee.defect.closed", "Closed", 70, SWT.LEFT, true, SortDataType.Boolean, false, null);
+ public static XViewerColumn User_Col =
+ new XViewerColumn("osee.defect.user", "User", 100, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Created_Date_Col =
+ new XViewerColumn("osee.defect.createdDate", "Created Date", 80, SWT.LEFT, true, SortDataType.Date, false,
+ null);
+ public static XViewerColumn Injection_Activity_Col =
+ new XViewerColumn("osee.defect.injectionActivity", "Injection Activity", 35, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn Description_Col =
+ new XViewerColumn("osee.defect.description", "Description", 200, SWT.LEFT, true,
+ SortDataType.String_MultiLine, false, null);
+ public static XViewerColumn Location_Col =
+ new XViewerColumn("osee.defect.location", "Location", 200, SWT.LEFT, true, SortDataType.String_MultiLine,
+ false, null);
+ public static XViewerColumn Resolution_Col =
+ new XViewerColumn("osee.defect.resolution", "Resolution", 200, SWT.LEFT, true, SortDataType.String_MultiLine,
+ false, null);
+
+ private static String NAMESPACE = "osee.ats.DefectXViewer";
+
+ public DefectXViewerFactory() {
+ super(NAMESPACE);
+ registerColumns(Severity_Col, Disposition_Col, Closed_Col, User_Col, Created_Date_Col, Injection_Activity_Col,
+ Description_Col, Location_Col, Resolution_Col);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java
index 8a1efba1fb0..aa41a7381be 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/defect/XDefectViewer.java
@@ -1,639 +1,639 @@
-/*******************************************************************************
- * 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.ats.util.widgets.defect;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.osee.ats.artifact.IReviewArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Disposition;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-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.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.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Sash;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-/**
- * <REM2>
- *
- * @author Donald G. Dunne
- */
-public class XDefectViewer extends XWidget implements IArtifactWidget, IArtifactEventListener, IFrameworkTransactionEventListener {
-
- private DefectXViewer xViewer;
- private IDirtiableEditor editor;
- private IReviewArtifact reviewArt;
- public final static String normalColor = "#EEEEEE";
- private static ToolItem newDefectItem, deleteDefectItem;
- private Label extraInfoLabel;
- private Composite parentComposite;
- private static ToolItem expandDefectItem, collapseDefectItem;
- private static Map<IReviewArtifact, Boolean> mapOfReviewArtifacts = new LinkedHashMap<IReviewArtifact, Boolean>();
- private ToolBar toolBar;
- private static Map<IReviewArtifact, Integer> tableHeight = new HashMap<IReviewArtifact, Integer>();
-
- public XDefectViewer() {
- super("Defects");
- OseeEventManager.addListener(this);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
-
- parentComposite = parent;
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- final Composite mainComp = new Composite(parent, SWT.BORDER);
- mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- if (toolkit != null) {
- toolkit.paintBordersFor(mainComp);
- }
-
- createTaskActionBar(mainComp);
-
- xViewer = new DefectXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
- xViewer.setContentProvider(new DefectContentProvider(xViewer));
- xViewer.setLabelProvider(new DefectLabelProvider(xViewer));
- xViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- refreshActionEnablement();
- }
- });
- new ActionContributionItem(xViewer.getCustomizeAction()).fill(toolBar, -1);
- if (toolkit != null) {
- toolkit.adapt(xViewer.getStatusLabel(), false, false);
- }
-
- refreshTableSize();
- // NOTE: Don't adapt the tree using xToolkit cause will loose xViewer's context menu
-
- final Sash sash = new Sash(parent, SWT.HORIZONTAL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 3;
- sash.setLayoutData(gd);
- sash.setBackground(Displays.getSystemColor(SWT.COLOR_GRAY));
- sash.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event e) {
- Rectangle treeRect = xViewer.getTree().getClientArea();
- int newHeight = treeRect.height + e.y;
- setTableHeight(newHeight);
- refreshTableSize();
- mainComp.layout();
- xViewer.refresh();
- if (getForm(mainComp) != null) {
- getForm(mainComp).reflow(true);
- }
- }
- });
-
- loadTable();
- }
-
- private void refreshTableSize() {
- Tree tree = xViewer.getTree();
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = getTableHeight();
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- }
-
- public void setXviewerTree(boolean expand) {
- }
-
- private int getTableHeight() {
- if (reviewArt != null && tableHeight.containsKey(reviewArt)) {
- return tableHeight.get(reviewArt);
- }
- return 100;
- }
-
- private void setTableHeight(int newHeight) {
- if (reviewArt != null) {
- if (newHeight < 100) {
- newHeight = 100;
- }
- tableHeight.put(reviewArt, newHeight);
- }
- }
-
- public void createTaskActionBar(Composite parent) {
-
- // Button composite for state transitions, etc
- Composite bComp = new Composite(parent, SWT.NONE);
- // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
- bComp.setLayout(new GridLayout(2, false));
- bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite actionComp = new Composite(bComp, SWT.NONE);
- actionComp.setLayout(new GridLayout());
- actionComp.setLayoutData(new GridData(GridData.END));
-
- toolBar = new ToolBar(actionComp, SWT.FLAT | SWT.RIGHT);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- toolBar.setLayoutData(gd);
- ToolItem item = null;
-
- expandDefectItem = new ToolItem(toolBar, SWT.PUSH);
- expandDefectItem.setImage(ImageManager.getImage(FrameworkImage.EXPAND_ALL));
- expandDefectItem.setToolTipText("Expand Defect List");
- expandDefectItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- mapOfReviewArtifacts.put(reviewArt, true);
- handleExpandCollapseDefectTableList();
- }
- });
-
- collapseDefectItem = new ToolItem(toolBar, SWT.PUSH);
- collapseDefectItem.setImage(ImageManager.getImage(FrameworkImage.COLLAPSE_ALL));
- collapseDefectItem.setToolTipText("Collapse Defect List");
- collapseDefectItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- mapOfReviewArtifacts.put(reviewArt, false);
- handleExpandCollapseDefectTableList();
- }
- });
-
- newDefectItem = new ToolItem(toolBar, SWT.PUSH);
- newDefectItem.setImage(ImageManager.getImage(FrameworkImage.GREEN_PLUS));
- newDefectItem.setToolTipText("New Defect");
- newDefectItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleNewDefect();
- }
- });
-
- deleteDefectItem = new ToolItem(toolBar, SWT.PUSH);
- deleteDefectItem.setImage(ImageManager.getImage(FrameworkImage.X_RED));
- deleteDefectItem.setToolTipText("Delete Defect");
- deleteDefectItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleDeleteDefect(false);
- }
- });
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
- item.setToolTipText("Refresh Defects");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- loadTable();
- }
- });
-
- createTaskActionBarPulldown(toolBar, actionComp);
-
- Composite labelComp = new Composite(bComp, SWT.NONE);
- labelComp.setLayout(new GridLayout());
- labelComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
-
- extraInfoLabel = new Label(labelComp, SWT.NONE);
- extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- extraInfoLabel.setText("");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
-
- refreshActionEnablement();
- }
-
- public void refreshActionEnablement() {
- deleteDefectItem.setEnabled(isEditable() && getSelectedDefectItems().size() > 0);
- newDefectItem.setEnabled(isEditable());
- }
-
- public void createTaskActionBarPulldown(final ToolBar toolBar, Composite composite) {
- final ToolItem dropDown = new ToolItem(toolBar, SWT.DROP_DOWN);
- dropDown.setImage(ImageManager.getImage(FrameworkImage.GEAR));
- final Menu menu = new Menu(composite);
-
- dropDown.addListener(SWT.Selection, new Listener() {
- public void handleEvent(org.eclipse.swt.widgets.Event event) {
- if (event.detail == SWT.ARROW) {
- Rectangle rect = dropDown.getBounds();
- Point pt = new Point(rect.x, rect.y + rect.height);
- pt = toolBar.toDisplay(pt);
- menu.setLocation(pt.x, pt.y);
- menu.setVisible(true);
- }
- }
- });
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText("Create Defects via simple list");
- item.setEnabled(isEditable());
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleImportDefectsViaList();
- }
- });
-
- }
-
- private void handleExpandCollapseDefectTableList() {
- if (mapOfReviewArtifacts != null && mapOfReviewArtifacts.containsKey(reviewArt) && mapOfReviewArtifacts.get(reviewArt)) {
- setXviewerTree(true);
- } else {
- setXviewerTree(false);
- }
- xViewer.refresh();
- if (getForm(parentComposite) != null) {
- getForm(parentComposite).reflow(true);
- }
- }
-
- public ScrolledForm getForm(Composite composite) {
- ScrolledForm form = null;
- if (composite == null) {
- return null;
- }
- if (composite instanceof ScrolledForm) {
- return (ScrolledForm) composite;
- }
- if (!(composite instanceof ScrolledForm)) {
- form = getForm(composite.getParent());
- }
- return form;
- }
-
- public void loadTable() {
- try {
- if (reviewArt != null && xViewer != null) {
- xViewer.set(reviewArt.getDefectManager().getDefectItems());
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- handleExpandCollapseDefectTableList();
- refresh();
- }
-
- public void handleImportDefectsViaList() {
- try {
- EntryDialog ed =
- new EntryDialog(Displays.getActiveShell(), "Create Defects", null,
- "Enter task titles, one per line.", MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
- ed.setFillVertically(true);
- if (ed.open() == 0) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Import Review Defects");
- for (String str : ed.getEntry().split("\n")) {
- str = str.replaceAll("\r", "");
- if (!str.equals("")) {
- reviewArt.getDefectManager().addDefectItem(str, false, transaction);
- }
- }
- transaction.execute();
- loadTable();
- notifyXModifiedListeners();
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void handleDeleteDefect(boolean persist) {
- final List<DefectItem> items = getSelectedDefectItems();
- if (items.isEmpty()) {
- AWorkbench.popup("ERROR", "No Defects Selected");
- return;
- }
- StringBuilder builder = new StringBuilder();
- for (DefectItem defectItem : items) {
- builder.append("\"" + defectItem.getDescription() + "\"\n");
- }
-
- boolean delete =
- MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Delete Defects", "Are You Sure You Wish to Delete the Defects(s):\n\n" + builder.toString());
- if (delete) {
- try {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Delete Review Defects");
- deleteDefectHelper(items, persist, transaction);
- transaction.execute();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- private void deleteDefectHelper(List<DefectItem> items, boolean persist, SkynetTransaction transaction) {
- try {
- for (DefectItem defectItem : items) {
- reviewArt.getDefectManager().removeDefectItem(defectItem, persist, transaction);
- xViewer.remove(defectItem);
- }
- loadTable();
- notifyXModifiedListeners();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void handleNewDefect() {
- EntryDialog ed =
- new EntryDialog(Displays.getActiveShell(), "Create New Defect", null, "Enter Defect Description",
- MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
- if (ed.open() == 0) {
- try {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Add Review Defect");
- reviewArt.getDefectManager().addDefectItem(ed.getEntry(), false, transaction);
- transaction.execute();
- notifyXModifiedListeners();
- loadTable();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- @SuppressWarnings("rawtypes")
- public ArrayList<DefectItem> getSelectedDefectItems() {
- ArrayList<DefectItem> items = new ArrayList<DefectItem>();
- if (xViewer == null) {
- return items;
- }
- if (xViewer.getSelection().isEmpty()) {
- return items;
- }
- Iterator i = ((IStructuredSelection) xViewer.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- items.add((DefectItem) obj);
- }
- return items;
- }
-
- @Override
- public Control getControl() {
- return xViewer.getTree();
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- xViewer.dispose();
- }
-
- @Override
- public void setFocus() {
- xViewer.getTree().setFocus();
- }
-
- @Override
- public void refresh() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- xViewer.refresh();
- validate();
- refreshActionEnablement();
- }
-
- @Override
- public IStatus isValid() {
- try {
- if (isRequiredEntry() && xViewer.getTree().getItemCount() == 0) {
- extraInfoLabel.setText("At least one defect entry is required. Select \"New Defect\" to add.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
- return new Status(IStatus.ERROR, getClass().getSimpleName(), "At least one defect entry is required");
- }
- if (reviewArt != null) {
- for (DefectItem item : reviewArt.getDefectManager().getDefectItems()) {
- if (item.isClosed() == false || item.getDisposition() == Disposition.None || item.getSeverity() == Severity.None && item.getDisposition() != Disposition.Duplicate && item.getDisposition() != Disposition.Reject) {
- extraInfoLabel.setText("All items must be marked for severity, disposition and closed. Select icon in cell or right-click to update field.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
- return new Status(IStatus.ERROR, getClass().getSimpleName(),
- "Review not complete until all items are marked for severity, disposition and closed");
- }
- }
- }
- extraInfoLabel.setText("Select \"New Defect\" to add. Select icon in cell or right-click to update field.");
- extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLACK));
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return new Status(IStatus.ERROR, getClass().getSimpleName(),
- "Exception validating defects. See log for details. " + ex);
- }
- // Need this cause it removes all error items of this namespace
- return new Status(IStatus.OK, getClass().getSimpleName(), "");
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public String toHTML(String labelFont) {
- if (getXViewer().getTree().getItemCount() == 0) {
- return "";
- }
- StringBuffer html = new StringBuffer();
- try {
- html.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Tasks"));
- html.append(AHTML.startBorderTable(100, normalColor, ""));
- html.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Date", "User", "Location", "Description",
- "Severity", "Disposition", "Injection Activity", "Resolution", "Location", "Closted"}));
- for (DefectItem item : reviewArt.getDefectManager().getDefectItems()) {
- html.append(AHTML.addRowMultiColumnTable(new String[] {item.getCreatedDate(XDate.MMDDYY),
- item.getUser().getName(), item.getLocation(), item.getDescription(), item.getSeverity().name(),
- item.getDisposition().name(), item.getInjectionActivity().name(), item.getResolution(),
- item.isClosed() + ""}));
- }
- html.append(AHTML.endBorderTable());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- return "Defect Item Exception - " + ex.getLocalizedMessage();
- }
- return html.toString();
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- /**
- * @return Returns the xViewer.
- */
- public DefectXViewer getXViewer() {
- return xViewer;
- }
-
- @Override
- public Object getData() {
- return xViewer.getInput();
- }
-
- public IDirtiableEditor getEditor() {
- return editor;
- }
-
- public void setEditor(IDirtiableEditor editor) {
- this.editor = editor;
- }
-
- public IReviewArtifact getReviewArt() {
- return reviewArt;
- }
-
- public void setReviewArt(IReviewArtifact reviewArt) {
- this.reviewArt = reviewArt;
- if (xViewer != null) {
- loadTable();
- }
- }
-
- @Override
- public void setArtifact(Artifact artifact) {
- setReviewArt((IReviewArtifact) artifact);
- }
-
- @Override
- public void saveToArtifact() {
- // DefectViewer uses artifact as storage mechanism; nothing to do here
- }
-
- @Override
- public Result isDirty() {
- // DefectViewer uses artifact as storage mechanism which already determines dirty
- return Result.FalseResult;
- }
-
- @Override
- public void revert() {
- // Nothing to revert cause artifact will be reverted
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
- if (transData.getBranchId() != AtsUtil.getAtsBranch().getId()) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- if (transData.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
- loadTable();
- } else {
- refresh();
- }
- }
- });
- }
-
- @Override
- public Control getErrorMessageControl() {
- return labelWidget;
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getReviewArtifactTypeEventFilter());
- }
-
- @Override
- public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
- if (!artifactEvent.isHasEvent(reviewArt.getArtifact())) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
- return;
- }
- if (artifactEvent.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
- loadTable();
- } else {
- 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.ats.util.widgets.defect;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.osee.ats.artifact.IReviewArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Disposition;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+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.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.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+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.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Sash;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+/**
+ * <REM2>
+ *
+ * @author Donald G. Dunne
+ */
+public class XDefectViewer extends XWidget implements IArtifactWidget, IArtifactEventListener, IFrameworkTransactionEventListener {
+
+ private DefectXViewer xViewer;
+ private IDirtiableEditor editor;
+ private IReviewArtifact reviewArt;
+ public final static String normalColor = "#EEEEEE";
+ private static ToolItem newDefectItem, deleteDefectItem;
+ private Label extraInfoLabel;
+ private Composite parentComposite;
+ private static ToolItem expandDefectItem, collapseDefectItem;
+ private static Map<IReviewArtifact, Boolean> mapOfReviewArtifacts = new LinkedHashMap<IReviewArtifact, Boolean>();
+ private ToolBar toolBar;
+ private static Map<IReviewArtifact, Integer> tableHeight = new HashMap<IReviewArtifact, Integer>();
+
+ public XDefectViewer() {
+ super("Defects");
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+
+ parentComposite = parent;
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ final Composite mainComp = new Composite(parent, SWT.BORDER);
+ mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ if (toolkit != null) {
+ toolkit.paintBordersFor(mainComp);
+ }
+
+ createTaskActionBar(mainComp);
+
+ xViewer = new DefectXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
+ xViewer.setContentProvider(new DefectContentProvider(xViewer));
+ xViewer.setLabelProvider(new DefectLabelProvider(xViewer));
+ xViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ refreshActionEnablement();
+ }
+ });
+ new ActionContributionItem(xViewer.getCustomizeAction()).fill(toolBar, -1);
+ if (toolkit != null) {
+ toolkit.adapt(xViewer.getStatusLabel(), false, false);
+ }
+
+ refreshTableSize();
+ // NOTE: Don't adapt the tree using xToolkit cause will loose xViewer's context menu
+
+ final Sash sash = new Sash(parent, SWT.HORIZONTAL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = 3;
+ sash.setLayoutData(gd);
+ sash.setBackground(Displays.getSystemColor(SWT.COLOR_GRAY));
+ sash.addListener(SWT.MouseUp, new Listener() {
+ public void handleEvent(Event e) {
+ Rectangle treeRect = xViewer.getTree().getClientArea();
+ int newHeight = treeRect.height + e.y;
+ setTableHeight(newHeight);
+ refreshTableSize();
+ mainComp.layout();
+ xViewer.refresh();
+ if (getForm(mainComp) != null) {
+ getForm(mainComp).reflow(true);
+ }
+ }
+ });
+
+ loadTable();
+ }
+
+ private void refreshTableSize() {
+ Tree tree = xViewer.getTree();
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = getTableHeight();
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ }
+
+ public void setXviewerTree(boolean expand) {
+ }
+
+ private int getTableHeight() {
+ if (reviewArt != null && tableHeight.containsKey(reviewArt)) {
+ return tableHeight.get(reviewArt);
+ }
+ return 100;
+ }
+
+ private void setTableHeight(int newHeight) {
+ if (reviewArt != null) {
+ if (newHeight < 100) {
+ newHeight = 100;
+ }
+ tableHeight.put(reviewArt, newHeight);
+ }
+ }
+
+ public void createTaskActionBar(Composite parent) {
+
+ // Button composite for state transitions, etc
+ Composite bComp = new Composite(parent, SWT.NONE);
+ // bComp.setBackground(mainSComp.getDisplay().getSystemColor(SWT.COLOR_CYAN));
+ bComp.setLayout(new GridLayout(2, false));
+ bComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite actionComp = new Composite(bComp, SWT.NONE);
+ actionComp.setLayout(new GridLayout());
+ actionComp.setLayoutData(new GridData(GridData.END));
+
+ toolBar = new ToolBar(actionComp, SWT.FLAT | SWT.RIGHT);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ toolBar.setLayoutData(gd);
+ ToolItem item = null;
+
+ expandDefectItem = new ToolItem(toolBar, SWT.PUSH);
+ expandDefectItem.setImage(ImageManager.getImage(FrameworkImage.EXPAND_ALL));
+ expandDefectItem.setToolTipText("Expand Defect List");
+ expandDefectItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ mapOfReviewArtifacts.put(reviewArt, true);
+ handleExpandCollapseDefectTableList();
+ }
+ });
+
+ collapseDefectItem = new ToolItem(toolBar, SWT.PUSH);
+ collapseDefectItem.setImage(ImageManager.getImage(FrameworkImage.COLLAPSE_ALL));
+ collapseDefectItem.setToolTipText("Collapse Defect List");
+ collapseDefectItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ mapOfReviewArtifacts.put(reviewArt, false);
+ handleExpandCollapseDefectTableList();
+ }
+ });
+
+ newDefectItem = new ToolItem(toolBar, SWT.PUSH);
+ newDefectItem.setImage(ImageManager.getImage(FrameworkImage.GREEN_PLUS));
+ newDefectItem.setToolTipText("New Defect");
+ newDefectItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleNewDefect();
+ }
+ });
+
+ deleteDefectItem = new ToolItem(toolBar, SWT.PUSH);
+ deleteDefectItem.setImage(ImageManager.getImage(FrameworkImage.X_RED));
+ deleteDefectItem.setToolTipText("Delete Defect");
+ deleteDefectItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleDeleteDefect(false);
+ }
+ });
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(PluginUiImage.REFRESH));
+ item.setToolTipText("Refresh Defects");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ loadTable();
+ }
+ });
+
+ createTaskActionBarPulldown(toolBar, actionComp);
+
+ Composite labelComp = new Composite(bComp, SWT.NONE);
+ labelComp.setLayout(new GridLayout());
+ labelComp.setLayoutData(new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL));
+
+ extraInfoLabel = new Label(labelComp, SWT.NONE);
+ extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ extraInfoLabel.setText("");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+
+ refreshActionEnablement();
+ }
+
+ public void refreshActionEnablement() {
+ deleteDefectItem.setEnabled(isEditable() && getSelectedDefectItems().size() > 0);
+ newDefectItem.setEnabled(isEditable());
+ }
+
+ public void createTaskActionBarPulldown(final ToolBar toolBar, Composite composite) {
+ final ToolItem dropDown = new ToolItem(toolBar, SWT.DROP_DOWN);
+ dropDown.setImage(ImageManager.getImage(FrameworkImage.GEAR));
+ final Menu menu = new Menu(composite);
+
+ dropDown.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(org.eclipse.swt.widgets.Event event) {
+ if (event.detail == SWT.ARROW) {
+ Rectangle rect = dropDown.getBounds();
+ Point pt = new Point(rect.x, rect.y + rect.height);
+ pt = toolBar.toDisplay(pt);
+ menu.setLocation(pt.x, pt.y);
+ menu.setVisible(true);
+ }
+ }
+ });
+
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Create Defects via simple list");
+ item.setEnabled(isEditable());
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleImportDefectsViaList();
+ }
+ });
+
+ }
+
+ private void handleExpandCollapseDefectTableList() {
+ if (mapOfReviewArtifacts != null && mapOfReviewArtifacts.containsKey(reviewArt) && mapOfReviewArtifacts.get(reviewArt)) {
+ setXviewerTree(true);
+ } else {
+ setXviewerTree(false);
+ }
+ xViewer.refresh();
+ if (getForm(parentComposite) != null) {
+ getForm(parentComposite).reflow(true);
+ }
+ }
+
+ public ScrolledForm getForm(Composite composite) {
+ ScrolledForm form = null;
+ if (composite == null) {
+ return null;
+ }
+ if (composite instanceof ScrolledForm) {
+ return (ScrolledForm) composite;
+ }
+ if (!(composite instanceof ScrolledForm)) {
+ form = getForm(composite.getParent());
+ }
+ return form;
+ }
+
+ public void loadTable() {
+ try {
+ if (reviewArt != null && xViewer != null) {
+ xViewer.set(reviewArt.getDefectManager().getDefectItems());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ handleExpandCollapseDefectTableList();
+ refresh();
+ }
+
+ public void handleImportDefectsViaList() {
+ try {
+ EntryDialog ed =
+ new EntryDialog(Displays.getActiveShell(), "Create Defects", null,
+ "Enter task titles, one per line.", MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
+ ed.setFillVertically(true);
+ if (ed.open() == 0) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Import Review Defects");
+ for (String str : ed.getEntry().split("\n")) {
+ str = str.replaceAll("\r", "");
+ if (!str.equals("")) {
+ reviewArt.getDefectManager().addDefectItem(str, false, transaction);
+ }
+ }
+ transaction.execute();
+ loadTable();
+ notifyXModifiedListeners();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void handleDeleteDefect(boolean persist) {
+ final List<DefectItem> items = getSelectedDefectItems();
+ if (items.isEmpty()) {
+ AWorkbench.popup("ERROR", "No Defects Selected");
+ return;
+ }
+ StringBuilder builder = new StringBuilder();
+ for (DefectItem defectItem : items) {
+ builder.append("\"" + defectItem.getDescription() + "\"\n");
+ }
+
+ boolean delete =
+ MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Delete Defects", "Are You Sure You Wish to Delete the Defects(s):\n\n" + builder.toString());
+ if (delete) {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Delete Review Defects");
+ deleteDefectHelper(items, persist, transaction);
+ transaction.execute();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ private void deleteDefectHelper(List<DefectItem> items, boolean persist, SkynetTransaction transaction) {
+ try {
+ for (DefectItem defectItem : items) {
+ reviewArt.getDefectManager().removeDefectItem(defectItem, persist, transaction);
+ xViewer.remove(defectItem);
+ }
+ loadTable();
+ notifyXModifiedListeners();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void handleNewDefect() {
+ EntryDialog ed =
+ new EntryDialog(Displays.getActiveShell(), "Create New Defect", null, "Enter Defect Description",
+ MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
+ if (ed.open() == 0) {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Add Review Defect");
+ reviewArt.getDefectManager().addDefectItem(ed.getEntry(), false, transaction);
+ transaction.execute();
+ notifyXModifiedListeners();
+ loadTable();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public ArrayList<DefectItem> getSelectedDefectItems() {
+ ArrayList<DefectItem> items = new ArrayList<DefectItem>();
+ if (xViewer == null) {
+ return items;
+ }
+ if (xViewer.getSelection().isEmpty()) {
+ return items;
+ }
+ Iterator i = ((IStructuredSelection) xViewer.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ items.add((DefectItem) obj);
+ }
+ return items;
+ }
+
+ @Override
+ public Control getControl() {
+ return xViewer.getTree();
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ xViewer.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ xViewer.getTree().setFocus();
+ }
+
+ @Override
+ public void refresh() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ xViewer.refresh();
+ validate();
+ refreshActionEnablement();
+ }
+
+ @Override
+ public IStatus isValid() {
+ try {
+ if (isRequiredEntry() && xViewer.getTree().getItemCount() == 0) {
+ extraInfoLabel.setText("At least one defect entry is required. Select \"New Defect\" to add.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+ return new Status(IStatus.ERROR, getClass().getSimpleName(), "At least one defect entry is required");
+ }
+ if (reviewArt != null) {
+ for (DefectItem item : reviewArt.getDefectManager().getDefectItems()) {
+ if (item.isClosed() == false || item.getDisposition() == Disposition.None || item.getSeverity() == Severity.None && item.getDisposition() != Disposition.Duplicate && item.getDisposition() != Disposition.Reject) {
+ extraInfoLabel.setText("All items must be marked for severity, disposition and closed. Select icon in cell or right-click to update field.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+ return new Status(IStatus.ERROR, getClass().getSimpleName(),
+ "Review not complete until all items are marked for severity, disposition and closed");
+ }
+ }
+ }
+ extraInfoLabel.setText("Select \"New Defect\" to add. Select icon in cell or right-click to update field.");
+ extraInfoLabel.setForeground(Displays.getSystemColor(SWT.COLOR_BLACK));
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Status(IStatus.ERROR, getClass().getSimpleName(),
+ "Exception validating defects. See log for details. " + ex);
+ }
+ // Need this cause it removes all error items of this namespace
+ return new Status(IStatus.OK, getClass().getSimpleName(), "");
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ if (getXViewer().getTree().getItemCount() == 0) {
+ return "";
+ }
+ StringBuffer html = new StringBuffer();
+ try {
+ html.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Tasks"));
+ html.append(AHTML.startBorderTable(100, normalColor, ""));
+ html.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Date", "User", "Location", "Description",
+ "Severity", "Disposition", "Injection Activity", "Resolution", "Location", "Closted"}));
+ for (DefectItem item : reviewArt.getDefectManager().getDefectItems()) {
+ html.append(AHTML.addRowMultiColumnTable(new String[] {item.getCreatedDate(XDate.MMDDYY),
+ item.getUser().getName(), item.getLocation(), item.getDescription(), item.getSeverity().name(),
+ item.getDisposition().name(), item.getInjectionActivity().name(), item.getResolution(),
+ item.isClosed() + ""}));
+ }
+ html.append(AHTML.endBorderTable());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ return "Defect Item Exception - " + ex.getLocalizedMessage();
+ }
+ return html.toString();
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ /**
+ * @return Returns the xViewer.
+ */
+ public DefectXViewer getXViewer() {
+ return xViewer;
+ }
+
+ @Override
+ public Object getData() {
+ return xViewer.getInput();
+ }
+
+ public IDirtiableEditor getEditor() {
+ return editor;
+ }
+
+ public void setEditor(IDirtiableEditor editor) {
+ this.editor = editor;
+ }
+
+ public IReviewArtifact getReviewArt() {
+ return reviewArt;
+ }
+
+ public void setReviewArt(IReviewArtifact reviewArt) {
+ this.reviewArt = reviewArt;
+ if (xViewer != null) {
+ loadTable();
+ }
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) {
+ setReviewArt((IReviewArtifact) artifact);
+ }
+
+ @Override
+ public void saveToArtifact() {
+ // DefectViewer uses artifact as storage mechanism; nothing to do here
+ }
+
+ @Override
+ public Result isDirty() {
+ // DefectViewer uses artifact as storage mechanism which already determines dirty
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ // Nothing to revert cause artifact will be reverted
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
+ if (transData.getBranchId() != AtsUtil.getAtsBranch().getId()) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ if (transData.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
+ loadTable();
+ } else {
+ refresh();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Control getErrorMessageControl() {
+ return labelWidget;
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getReviewArtifactTypeEventFilter());
+ }
+
+ @Override
+ public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
+ if (!artifactEvent.isHasEvent(reviewArt.getArtifact())) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (xViewer == null || xViewer.getTree() == null || xViewer.getTree().isDisposed()) {
+ return;
+ }
+ if (artifactEvent.isRelAddedChangedDeleted(reviewArt.getArtifact())) {
+ loadTable();
+ } else {
+ refresh();
+ }
+ }
+ });
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/AtsPriorityDialog.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/AtsPriorityDialog.java
index 833e4f0c0be..d1951a26fa5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/AtsPriorityDialog.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/AtsPriorityDialog.java
@@ -1,122 +1,122 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.util.widgets.dialog;
-
-import java.util.ArrayList;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsPriority;
-import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.swt.HyperLinkLabel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ListDialog;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsPriorityDialog extends ListDialog {
-
- PriorityType selected = null;
-
- public AtsPriorityDialog(Shell parent) {
- super(parent);
- setContentProvider(new ArrayContentProvider());
- setLabelProvider(new PriorityLabelProvider());
- setInput(AtsPriority.PriorityType.values());
- setShellStyle(getShellStyle() | SWT.RESIZE);
- setTitle("Select Priority");
- setMessage("Select Priority - Click for Help");
- }
-
- public AtsPriority.PriorityType getSelection() {
- return (AtsPriority.PriorityType) getResult()[0];
- }
-
- @Override
- protected Label createMessageArea(Composite composite) {
- Label label = super.createMessageArea(composite);
- label.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event event) {
- AtsPriority.openHelp();
- }
- });
- HyperLinkLabel.adapt(label);
- return label;
- }
-
- @Override
- protected Control createDialogArea(Composite container) {
-
- Control c = super.createDialogArea(container);
- if (selected != null) {
- ArrayList<Object> sel = new ArrayList<Object>();
- sel.add(selected);
- getTableViewer().setSelection(new StructuredSelection(sel.toArray(new Object[sel.size()])));
- getTableViewer().getTable().setFocus();
- }
- AtsPlugin.getInstance().setHelp(getTableViewer().getControl(), AtsPriority.PRIORITY_HELP_CONTEXT_ID,
- "org.eclipse.osee.ats.help.ui");
- return c;
- }
-
- @Override
- protected void okPressed() {
- if (getTableViewer().getSelection().isEmpty()) {
- AWorkbench.popup("ERROR", "Must make selection.");
- return;
- }
- super.okPressed();
- }
-
- public static class PriorityLabelProvider implements ILabelProvider {
-
- public Image getImage(Object arg0) {
- return null;
- }
-
- public String getText(Object arg0) {
- PriorityType type = (PriorityType) arg0;
- if (type == PriorityType.None)
- return type.name();
- return type.getShortName();
- }
-
- public void addListener(ILabelProviderListener arg0) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object arg0, String arg1) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener arg0) {
- }
-
- }
-
- public void setSelected(PriorityType selected) {
- this.selected = selected;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.dialog;
+
+import java.util.ArrayList;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsPriority;
+import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.swt.HyperLinkLabel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ListDialog;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsPriorityDialog extends ListDialog {
+
+ PriorityType selected = null;
+
+ public AtsPriorityDialog(Shell parent) {
+ super(parent);
+ setContentProvider(new ArrayContentProvider());
+ setLabelProvider(new PriorityLabelProvider());
+ setInput(AtsPriority.PriorityType.values());
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ setTitle("Select Priority");
+ setMessage("Select Priority - Click for Help");
+ }
+
+ public AtsPriority.PriorityType getSelection() {
+ return (AtsPriority.PriorityType) getResult()[0];
+ }
+
+ @Override
+ protected Label createMessageArea(Composite composite) {
+ Label label = super.createMessageArea(composite);
+ label.addListener(SWT.MouseUp, new Listener() {
+ public void handleEvent(Event event) {
+ AtsPriority.openHelp();
+ }
+ });
+ HyperLinkLabel.adapt(label);
+ return label;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+
+ Control c = super.createDialogArea(container);
+ if (selected != null) {
+ ArrayList<Object> sel = new ArrayList<Object>();
+ sel.add(selected);
+ getTableViewer().setSelection(new StructuredSelection(sel.toArray(new Object[sel.size()])));
+ getTableViewer().getTable().setFocus();
+ }
+ AtsPlugin.getInstance().setHelp(getTableViewer().getControl(), AtsPriority.PRIORITY_HELP_CONTEXT_ID,
+ "org.eclipse.osee.ats.help.ui");
+ return c;
+ }
+
+ @Override
+ protected void okPressed() {
+ if (getTableViewer().getSelection().isEmpty()) {
+ AWorkbench.popup("ERROR", "Must make selection.");
+ return;
+ }
+ super.okPressed();
+ }
+
+ public static class PriorityLabelProvider implements ILabelProvider {
+
+ public Image getImage(Object arg0) {
+ return null;
+ }
+
+ public String getText(Object arg0) {
+ PriorityType type = (PriorityType) arg0;
+ if (type == PriorityType.None)
+ return type.name();
+ return type.getShortName();
+ }
+
+ public void addListener(ILabelProviderListener arg0) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object arg0, String arg1) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener arg0) {
+ }
+
+ }
+
+ public void setSelected(PriorityType selected) {
+ this.selected = selected;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SimpleTaskResolutionOptionsRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SimpleTaskResolutionOptionsRule.java
index 8a2df8a091f..b08e596b1cf 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SimpleTaskResolutionOptionsRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SimpleTaskResolutionOptionsRule.java
@@ -8,55 +8,55 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.util.widgets.dialog;
-
+package org.eclipse.osee.ats.util.widgets.dialog;
+
import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.ui.skynet.results.XResultData;
import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
-
-/**
- * @author Donald G. Dunne
- */
-public class SimpleTaskResolutionOptionsRule extends TaskResolutionOptionRule {
-
- public static String ID = "ats.simpleTaskResolutionOptions";
- public static enum States {
- None, In_Work, Waiting, Coded, Awaiting_Review, No_Change, Complete
- };
- public static String resolutionOptionsXml =
- "<AtsTaskOptions> " +
- //
- "<AtsTaskOption name=\"" + States.None.name() + "\" desc=\"Nothing has been done.\" complete=\"false\" percent=\"0\"/> " +
- //
- "<AtsTaskOption name=\"In_Work\" desc=\"Working on task.\" complete=\"false\" percent=\"15\"/> " +
- //
- "<AtsTaskOption name=\"Waiting\" desc=\"Waiting on some other dependency.\" complete=\"false\" percent=\"15\" color=\"DARK_RED\"/> " +
- //
- "<AtsTaskOption name=\"Coded\" desc=\"Code is completed but not tested.\" complete=\"false\" percent=\"75\"/> " +
- //
- "<AtsTaskOption name=\"Awaiting_Review\" desc=\"Awaiting a review on changes made.\" complete=\"false\" percent=\"95\" color=\"DARK_RED\"/> " +
- //
- "<AtsTaskOption name=\"No_Change\" desc=\"No change to code is necessary.\" complete=\"true\" percent=\"100\" color=\"DARK_GREEN\"/> " +
- //
- "<AtsTaskOption name=\"Complete\" desc=\"Code finished.\" complete=\"true\" percent=\"100\" color=\"DARK_GREEN\"/> " +
- //
- "</AtsTaskOptions>";
-
- /**
- * @param name
- * @param id
- * @param value
- */
- public SimpleTaskResolutionOptionsRule() {
- super(ID, ID, resolutionOptionsXml);
- }
-
- public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
- AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, this);
- }
-
- public static void relatePageToRules(String pageId) throws OseeCoreException {
- WorkItemDefinitionFactory.relateWorkItemDefinitions(pageId, ID);
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SimpleTaskResolutionOptionsRule extends TaskResolutionOptionRule {
+
+ public static String ID = "ats.simpleTaskResolutionOptions";
+ public static enum States {
+ None, In_Work, Waiting, Coded, Awaiting_Review, No_Change, Complete
+ };
+ public static String resolutionOptionsXml =
+ "<AtsTaskOptions> " +
+ //
+ "<AtsTaskOption name=\"" + States.None.name() + "\" desc=\"Nothing has been done.\" complete=\"false\" percent=\"0\"/> " +
+ //
+ "<AtsTaskOption name=\"In_Work\" desc=\"Working on task.\" complete=\"false\" percent=\"15\"/> " +
+ //
+ "<AtsTaskOption name=\"Waiting\" desc=\"Waiting on some other dependency.\" complete=\"false\" percent=\"15\" color=\"DARK_RED\"/> " +
+ //
+ "<AtsTaskOption name=\"Coded\" desc=\"Code is completed but not tested.\" complete=\"false\" percent=\"75\"/> " +
+ //
+ "<AtsTaskOption name=\"Awaiting_Review\" desc=\"Awaiting a review on changes made.\" complete=\"false\" percent=\"95\" color=\"DARK_RED\"/> " +
+ //
+ "<AtsTaskOption name=\"No_Change\" desc=\"No change to code is necessary.\" complete=\"true\" percent=\"100\" color=\"DARK_GREEN\"/> " +
+ //
+ "<AtsTaskOption name=\"Complete\" desc=\"Code finished.\" complete=\"true\" percent=\"100\" color=\"DARK_GREEN\"/> " +
+ //
+ "</AtsTaskOptions>";
+
+ /**
+ * @param name
+ * @param id
+ * @param value
+ */
+ public SimpleTaskResolutionOptionsRule() {
+ super(ID, ID, resolutionOptionsXml);
+ }
+
+ public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
+ AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, this);
+ }
+
+ public static void relatePageToRules(String pageId) throws OseeCoreException {
+ WorkItemDefinitionFactory.relateWorkItemDefinitions(pageId, ID);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/StateListAndTitleDialog.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/StateListAndTitleDialog.java
index 91bfc0e6c90..e89f2b594e9 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/StateListAndTitleDialog.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/StateListAndTitleDialog.java
@@ -1,84 +1,84 @@
-/*******************************************************************************
- * 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.ats.util.widgets.dialog;
-
-import java.util.Collection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
-import org.eclipse.osee.framework.ui.skynet.widgets.XText;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Donald G. Dunne
- */
-public class StateListAndTitleDialog extends StateListDialog {
-
- String reviewTitle;
- XText titleText;
-
- /**
- * @param title
- * @param message
- * @param values
- */
- public StateListAndTitleDialog(String title, String message, Collection<String> values) {
- super(title, message, values);
- }
-
- @Override
- protected Control createDialogArea(Composite container) {
- Composite comp = new Composite(container, SWT.NONE);
- comp.setLayout(new GridLayout());
- comp.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
- titleText = new XText("Review Title");
- titleText.createWidgets(comp, 1);
- if (reviewTitle != null) titleText.set(reviewTitle);
- titleText.getStyledText().setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
- titleText.addXModifiedListener(new XModifiedListener() {
- @Override
- public void widgetModified(XWidget widget) {
- reviewTitle = titleText.get();
- }
- });
-
- Control control = super.createDialogArea(container);
- getTableViewer().setSorter(new ViewerSorter() {
- @SuppressWarnings("unchecked")
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- return getComparator().compare((String) e1, (String) e2);
- }
- });
-
- return control;
- }
-
- /**
- * @return the reviewTitle
- */
- public String getReviewTitle() {
- return reviewTitle;
- }
-
- /**
- * @param reviewTitle the reviewTitle to set
- */
- public void setReviewTitle(String reviewTitle) {
- this.reviewTitle = reviewTitle;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.dialog;
+
+import java.util.Collection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.XText;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class StateListAndTitleDialog extends StateListDialog {
+
+ String reviewTitle;
+ XText titleText;
+
+ /**
+ * @param title
+ * @param message
+ * @param values
+ */
+ public StateListAndTitleDialog(String title, String message, Collection<String> values) {
+ super(title, message, values);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+ Composite comp = new Composite(container, SWT.NONE);
+ comp.setLayout(new GridLayout());
+ comp.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
+ titleText = new XText("Review Title");
+ titleText.createWidgets(comp, 1);
+ if (reviewTitle != null) titleText.set(reviewTitle);
+ titleText.getStyledText().setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
+ titleText.addXModifiedListener(new XModifiedListener() {
+ @Override
+ public void widgetModified(XWidget widget) {
+ reviewTitle = titleText.get();
+ }
+ });
+
+ Control control = super.createDialogArea(container);
+ getTableViewer().setSorter(new ViewerSorter() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return getComparator().compare((String) e1, (String) e2);
+ }
+ });
+
+ return control;
+ }
+
+ /**
+ * @return the reviewTitle
+ */
+ public String getReviewTitle() {
+ return reviewTitle;
+ }
+
+ /**
+ * @param reviewTitle the reviewTitle to set
+ */
+ public void setReviewTitle(String reviewTitle) {
+ this.reviewTitle = reviewTitle;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java
index 9239ea81e17..004ae7507b5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java
@@ -1,151 +1,151 @@
-/*******************************************************************************
- * 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.ats.util.widgets.dialog;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.widgets.XComboViewer;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskOptionStatusDialog extends SMAStatusDialog {
-
- XComboViewer resolutionCombo = new XComboViewer("Resolution");
- private final List<TaskResOptionDefinition> options;
- private final Map<String, TaskResOptionDefinition> nameToResDef = new HashMap<String, TaskResOptionDefinition>();
- private TaskResOptionDefinition selectedOption;
- private static String MESSAGE = "Enter percent complete and number of hours you spent since last status.";
- private static String OPTION_MESSAGE =
- "Select resolution, enter percent complete and number of hours you spent since last status.";
-
- /**
- * @param parentShell
- * @param dialogTitle
- * @param dialogMessage
- * @param showPercent
- * @param options
- */
- public TaskOptionStatusDialog(Shell parentShell, String dialogTitle, String dialogMessage, boolean showPercent, List<TaskResOptionDefinition> options, Collection<? extends StateMachineArtifact> tasks) {
- super(parentShell, dialogTitle, (options == null ? MESSAGE : OPTION_MESSAGE), showPercent, tasks);
- this.options = options;
- if (options != null) {
- for (TaskResOptionDefinition trd : options)
- nameToResDef.put(trd.getName(), trd);
- }
- }
-
- @Override
- protected IStatus isComplete() {
- TaskResOptionDefinition trd = getSelectedOptionDef();
- if (trd == null)
- return Status.OK_STATUS;
- int percentComp = percent.getInt();
- if (trd.isCompleteable() && (percentComp != 100)) {
- return new Status(IStatus.ERROR, AtsPlugin.PLUGIN_ID, "Completed resolution must have %Complete == 100");
- }
- if (percentComp == 100 && !trd.isCompleteable()) {
- return new Status(IStatus.ERROR, AtsPlugin.PLUGIN_ID,
- "Can't have 100% complete with a non-Completed resolution");
- }
- return super.isComplete();
- }
-
- public TaskResOptionDefinition getSelectedOptionDef() {
- return selectedOption;
- }
-
- @Override
- protected void createPreCustomArea(Composite parent) {
- super.createPreCustomArea(parent);
- if (options != null) {
- resolutionCombo.setLabelProvider(new ResolutionLabelProvider());
- resolutionCombo.setContentProvider(new ArrayContentProvider());
- resolutionCombo.setRequiredEntry(true);
- ArrayList<Object> objs = new ArrayList<Object>();
- for (Object obj : options)
- objs.add(obj);
- resolutionCombo.setInput(objs);
- resolutionCombo.createWidgets(parent, 2);
- try {
- if (smas.size() == 1) {
- String selOption = smas.iterator().next().getWorldViewResolution();
- if (selOption != null && !selOption.equals("")) {
- selectedOption = nameToResDef.get(selOption);
- if (selectedOption != null) {
- ArrayList<Object> sel = new ArrayList<Object>();
- sel.add(selectedOption);
- resolutionCombo.setSelected(sel);
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- resolutionCombo.getCombo().setVisibleItemCount(20);
- resolutionCombo.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- selectedOption = (TaskResOptionDefinition) resolutionCombo.getSelected();
- if (selectedOption != null && !selectedOption.getPercent().equals("")) {
- int newPercent = (new Integer(selectedOption.getPercent())).intValue();
- percent.set(newPercent + "");
- updateStatusLabel();
- }
- };
- });
- }
- }
- public static class ResolutionLabelProvider implements ILabelProvider {
-
- public Image getImage(Object arg0) {
- return null;
- }
-
- public String getText(Object arg0) {
- TaskResOptionDefinition trd = ((TaskResOptionDefinition) arg0);
- return trd.getName() + " - " + trd.getDesc() + (trd.isCompleteable() ? " (Completed)" : "");
- }
-
- public void addListener(ILabelProviderListener arg0) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object arg0, String arg1) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener arg0) {
- }
-
- }
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.dialog;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.widgets.XComboViewer;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskOptionStatusDialog extends SMAStatusDialog {
+
+ XComboViewer resolutionCombo = new XComboViewer("Resolution");
+ private final List<TaskResOptionDefinition> options;
+ private final Map<String, TaskResOptionDefinition> nameToResDef = new HashMap<String, TaskResOptionDefinition>();
+ private TaskResOptionDefinition selectedOption;
+ private static String MESSAGE = "Enter percent complete and number of hours you spent since last status.";
+ private static String OPTION_MESSAGE =
+ "Select resolution, enter percent complete and number of hours you spent since last status.";
+
+ /**
+ * @param parentShell
+ * @param dialogTitle
+ * @param dialogMessage
+ * @param showPercent
+ * @param options
+ */
+ public TaskOptionStatusDialog(Shell parentShell, String dialogTitle, String dialogMessage, boolean showPercent, List<TaskResOptionDefinition> options, Collection<? extends StateMachineArtifact> tasks) {
+ super(parentShell, dialogTitle, (options == null ? MESSAGE : OPTION_MESSAGE), showPercent, tasks);
+ this.options = options;
+ if (options != null) {
+ for (TaskResOptionDefinition trd : options)
+ nameToResDef.put(trd.getName(), trd);
+ }
+ }
+
+ @Override
+ protected IStatus isComplete() {
+ TaskResOptionDefinition trd = getSelectedOptionDef();
+ if (trd == null)
+ return Status.OK_STATUS;
+ int percentComp = percent.getInt();
+ if (trd.isCompleteable() && (percentComp != 100)) {
+ return new Status(IStatus.ERROR, AtsPlugin.PLUGIN_ID, "Completed resolution must have %Complete == 100");
+ }
+ if (percentComp == 100 && !trd.isCompleteable()) {
+ return new Status(IStatus.ERROR, AtsPlugin.PLUGIN_ID,
+ "Can't have 100% complete with a non-Completed resolution");
+ }
+ return super.isComplete();
+ }
+
+ public TaskResOptionDefinition getSelectedOptionDef() {
+ return selectedOption;
+ }
+
+ @Override
+ protected void createPreCustomArea(Composite parent) {
+ super.createPreCustomArea(parent);
+ if (options != null) {
+ resolutionCombo.setLabelProvider(new ResolutionLabelProvider());
+ resolutionCombo.setContentProvider(new ArrayContentProvider());
+ resolutionCombo.setRequiredEntry(true);
+ ArrayList<Object> objs = new ArrayList<Object>();
+ for (Object obj : options)
+ objs.add(obj);
+ resolutionCombo.setInput(objs);
+ resolutionCombo.createWidgets(parent, 2);
+ try {
+ if (smas.size() == 1) {
+ String selOption = smas.iterator().next().getWorldViewResolution();
+ if (selOption != null && !selOption.equals("")) {
+ selectedOption = nameToResDef.get(selOption);
+ if (selectedOption != null) {
+ ArrayList<Object> sel = new ArrayList<Object>();
+ sel.add(selectedOption);
+ resolutionCombo.setSelected(sel);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ resolutionCombo.getCombo().setVisibleItemCount(20);
+ resolutionCombo.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ selectedOption = (TaskResOptionDefinition) resolutionCombo.getSelected();
+ if (selectedOption != null && !selectedOption.getPercent().equals("")) {
+ int newPercent = (new Integer(selectedOption.getPercent())).intValue();
+ percent.set(newPercent + "");
+ updateStatusLabel();
+ }
+ };
+ });
+ }
+ }
+ public static class ResolutionLabelProvider implements ILabelProvider {
+
+ public Image getImage(Object arg0) {
+ return null;
+ }
+
+ public String getText(Object arg0) {
+ TaskResOptionDefinition trd = ((TaskResOptionDefinition) arg0);
+ return trd.getName() + " - " + trd.getDesc() + (trd.isCompleteable() ? " (Completed)" : "");
+ }
+
+ public void addListener(ILabelProviderListener arg0) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object arg0, String arg1) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener arg0) {
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRole.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRole.java
index 395a3cde37d..b3d9b2da8b3 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRole.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRole.java
@@ -1,198 +1,198 @@
-/*******************************************************************************
- * 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.ats.util.widgets.role;
-
-import java.text.NumberFormat;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AXml;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class UserRole {
-
- private Role role = Role.Reviewer;
- private User user;
- private Double hoursSpent = null;
- private String guid = GUID.create();
- private Boolean completed = false;
-
- public static enum Role {
- Moderator, Reviewer, Author;
- public static Collection<String> strValues() {
- Set<String> values = new HashSet<String>();
- for (Enum<Role> e : values()) {
- values.add(e.name());
- }
- return values;
- }
- };
-
- public UserRole() throws OseeCoreException {
- this(Role.Reviewer, UserManager.getUser(), null, false);
- }
-
- public UserRole(Role role, User user) {
- this(role, user, 0.0, false);
- }
-
- public UserRole(Role role, User user, Double hoursSpent, Boolean completed) {
- this.role = role;
- this.user = user;
- this.hoursSpent = hoursSpent;
- this.completed = completed;
- }
-
- public UserRole(String xml) {
- fromXml(xml);
- }
-
- public void update(UserRole dItem) throws OseeCoreException {
- fromXml(dItem.toXml());
- }
-
- public String toXml() throws OseeCoreException {
- StringBuffer sb = new StringBuffer();
- sb.append(AXml.addTagData("role", role.name()));
- sb.append(AXml.addTagData("userId", user.getUserId()));
- sb.append(AXml.addTagData("hoursSpent", hoursSpent == null ? "" : String.valueOf(hoursSpent)));
- sb.append(AXml.addTagData("completed", String.valueOf(completed)));
- sb.append(AXml.addTagData("guid", guid));
- return sb.toString();
- }
-
- public void fromXml(String xml) {
- try {
- this.role = Role.valueOf(AXml.getTagData(xml, "role"));
- this.user = UserManager.getUserByUserId(AXml.getTagData(xml, "userId"));
- String hoursSpent = AXml.getTagData(xml, "hoursSpent");
- if (Strings.isValid(hoursSpent)) {
- this.hoursSpent = NumberFormat.getInstance().parse(hoursSpent).doubleValue();
- } else {
- this.hoursSpent = null;
- }
- String completedStr = AXml.getTagData(xml, "completed");
- if (Strings.isValid(completedStr)) {
- this.completed = completedStr.equals("true");
- } else {
- this.completed = false;
- }
- this.guid = AXml.getTagData(xml, "guid");
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof UserRole) {
- UserRole userRole = (UserRole) obj;
- return userRole.getGuid().equals(getGuid());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return getGuid().hashCode();
- }
-
- @Override
- public String toString() {
- return role + " - " + user + " - " + hoursSpent + " - " + (completed ? "Completed" : "InWork");
- }
-
- /**
- * @return the role
- */
- public Role getRole() {
- return role;
- }
-
- /**
- * @param role the role to set
- */
- public void setRole(Role role) {
- this.role = role;
- }
-
- /**
- * @return the user
- */
- public User getUser() {
- return user;
- }
-
- /**
- * @param user the user to set
- */
- public void setUser(User user) {
- this.user = user;
- }
-
- /**
- * @return the hoursSpent
- */
- public Double getHoursSpent() {
- return hoursSpent;
- }
-
- public String getHoursSpentStr() {
- return hoursSpent == null ? "" : AtsUtil.doubleToI18nString(hoursSpent, true);
- }
-
- /**
- * @param hoursSpent the hoursSpent to set
- */
- public void setHoursSpent(Double hoursSpent) {
- this.hoursSpent = hoursSpent;
- }
-
- /**
- * @return the guid
- */
- public String getGuid() {
- return guid;
- }
-
- /**
- * @param guid the guid to set
- */
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- /**
- * @return the completed
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * @param completed the completed to set
- */
- public void setCompleted(boolean completed) {
- this.completed = completed;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.role;
+
+import java.text.NumberFormat;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AXml;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UserRole {
+
+ private Role role = Role.Reviewer;
+ private User user;
+ private Double hoursSpent = null;
+ private String guid = GUID.create();
+ private Boolean completed = false;
+
+ public static enum Role {
+ Moderator, Reviewer, Author;
+ public static Collection<String> strValues() {
+ Set<String> values = new HashSet<String>();
+ for (Enum<Role> e : values()) {
+ values.add(e.name());
+ }
+ return values;
+ }
+ };
+
+ public UserRole() throws OseeCoreException {
+ this(Role.Reviewer, UserManager.getUser(), null, false);
+ }
+
+ public UserRole(Role role, User user) {
+ this(role, user, 0.0, false);
+ }
+
+ public UserRole(Role role, User user, Double hoursSpent, Boolean completed) {
+ this.role = role;
+ this.user = user;
+ this.hoursSpent = hoursSpent;
+ this.completed = completed;
+ }
+
+ public UserRole(String xml) {
+ fromXml(xml);
+ }
+
+ public void update(UserRole dItem) throws OseeCoreException {
+ fromXml(dItem.toXml());
+ }
+
+ public String toXml() throws OseeCoreException {
+ StringBuffer sb = new StringBuffer();
+ sb.append(AXml.addTagData("role", role.name()));
+ sb.append(AXml.addTagData("userId", user.getUserId()));
+ sb.append(AXml.addTagData("hoursSpent", hoursSpent == null ? "" : String.valueOf(hoursSpent)));
+ sb.append(AXml.addTagData("completed", String.valueOf(completed)));
+ sb.append(AXml.addTagData("guid", guid));
+ return sb.toString();
+ }
+
+ public void fromXml(String xml) {
+ try {
+ this.role = Role.valueOf(AXml.getTagData(xml, "role"));
+ this.user = UserManager.getUserByUserId(AXml.getTagData(xml, "userId"));
+ String hoursSpent = AXml.getTagData(xml, "hoursSpent");
+ if (Strings.isValid(hoursSpent)) {
+ this.hoursSpent = NumberFormat.getInstance().parse(hoursSpent).doubleValue();
+ } else {
+ this.hoursSpent = null;
+ }
+ String completedStr = AXml.getTagData(xml, "completed");
+ if (Strings.isValid(completedStr)) {
+ this.completed = completedStr.equals("true");
+ } else {
+ this.completed = false;
+ }
+ this.guid = AXml.getTagData(xml, "guid");
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof UserRole) {
+ UserRole userRole = (UserRole) obj;
+ return userRole.getGuid().equals(getGuid());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return getGuid().hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return role + " - " + user + " - " + hoursSpent + " - " + (completed ? "Completed" : "InWork");
+ }
+
+ /**
+ * @return the role
+ */
+ public Role getRole() {
+ return role;
+ }
+
+ /**
+ * @param role the role to set
+ */
+ public void setRole(Role role) {
+ this.role = role;
+ }
+
+ /**
+ * @return the user
+ */
+ public User getUser() {
+ return user;
+ }
+
+ /**
+ * @param user the user to set
+ */
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ /**
+ * @return the hoursSpent
+ */
+ public Double getHoursSpent() {
+ return hoursSpent;
+ }
+
+ public String getHoursSpentStr() {
+ return hoursSpent == null ? "" : AtsUtil.doubleToI18nString(hoursSpent, true);
+ }
+
+ /**
+ * @param hoursSpent the hoursSpent to set
+ */
+ public void setHoursSpent(Double hoursSpent) {
+ this.hoursSpent = hoursSpent;
+ }
+
+ /**
+ * @return the guid
+ */
+ public String getGuid() {
+ return guid;
+ }
+
+ /**
+ * @param guid the guid to set
+ */
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ /**
+ * @return the completed
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * @param completed the completed to set
+ */
+ public void setCompleted(boolean completed) {
+ this.completed = completed;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleContentProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleContentProvider.java
index 0f8620cf934..9f203120888 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleContentProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleContentProvider.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * 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.ats.util.widgets.role;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-public class UserRoleContentProvider implements ITreeContentProvider {
-
- protected Collection<UserRole> rootSet = new HashSet<UserRole>();
- private final UserRoleXViewer xViewer;
- private static Object[] EMPTY_ARRAY = new Object[0];
-
- public UserRoleContentProvider(UserRoleXViewer WorldXViewer) {
- super();
- this.xViewer = WorldXViewer;
- }
-
- public void add(final UserRole item) {
- add(Arrays.asList(item));
- }
-
- public void add(final Collection<? extends UserRole> items) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (xViewer.getInput() == null) xViewer.setInput(rootSet);
- rootSet.addAll(items);
- xViewer.refresh();
- };
- });
- }
-
- public void set(final Collection<? extends UserRole> arts) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (xViewer.getInput() == null) xViewer.setInput(rootSet);
- clear();
- add(arts);
- };
- });
- }
-
- public void clear() {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (xViewer.getInput() == null) xViewer.setInput(rootSet);
- rootSet.clear();
- xViewer.refresh();
- };
- });
- }
-
- @SuppressWarnings("rawtypes")
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Object[]) {
- return (Object[]) parentElement;
- }
- if (parentElement instanceof Collection) {
- return ((Collection) parentElement).toArray();
- }
- return EMPTY_ARRAY;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof String) return new Object[] {inputElement};
- return getChildren(inputElement);
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- /**
- * @return the rootSet
- */
- public Collection<UserRole> getRootSet() {
- return rootSet;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.role;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+public class UserRoleContentProvider implements ITreeContentProvider {
+
+ protected Collection<UserRole> rootSet = new HashSet<UserRole>();
+ private final UserRoleXViewer xViewer;
+ private static Object[] EMPTY_ARRAY = new Object[0];
+
+ public UserRoleContentProvider(UserRoleXViewer WorldXViewer) {
+ super();
+ this.xViewer = WorldXViewer;
+ }
+
+ public void add(final UserRole item) {
+ add(Arrays.asList(item));
+ }
+
+ public void add(final Collection<? extends UserRole> items) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ if (xViewer.getInput() == null) xViewer.setInput(rootSet);
+ rootSet.addAll(items);
+ xViewer.refresh();
+ };
+ });
+ }
+
+ public void set(final Collection<? extends UserRole> arts) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ if (xViewer.getInput() == null) xViewer.setInput(rootSet);
+ clear();
+ add(arts);
+ };
+ });
+ }
+
+ public void clear() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ if (xViewer.getInput() == null) xViewer.setInput(rootSet);
+ rootSet.clear();
+ xViewer.refresh();
+ };
+ });
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof Object[]) {
+ return (Object[]) parentElement;
+ }
+ if (parentElement instanceof Collection) {
+ return ((Collection) parentElement).toArray();
+ }
+ return EMPTY_ARRAY;
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof String) return new Object[] {inputElement};
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /**
+ * @return the rootSet
+ */
+ public Collection<UserRole> getRootSet() {
+ return rootSet;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java
index 70b6854e113..9a195007d4e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleLabelProvider.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * 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.ats.util.widgets.role;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.graphics.Image;
-
-public class UserRoleLabelProvider extends XViewerLabelProvider {
- private final UserRoleXViewer xViewer;
-
- public UserRoleLabelProvider(UserRoleXViewer xViewer) {
- super(xViewer);
- this.xViewer = xViewer;
- }
-
- @Override
- public Image getColumnImage(Object element, XViewerColumn dCol, int columnIndex) throws OseeCoreException {
- UserRole roleItem = (UserRole) element;
- if (dCol.equals(UserRoleXViewerFactory.User_Col)) {
- return ArtifactImageManager.getImage(roleItem.getUser());
- } else if (dCol.equals(UserRoleXViewerFactory.Role_Col)) {
- return ImageManager.getImage(AtsImage.ROLE);
- } else if (dCol.equals(UserRoleXViewerFactory.Hours_Spent_Col)) {
- return ImageManager.getImage(FrameworkImage.CLOCK);
- } else if (dCol.equals(UserRoleXViewerFactory.Completed_Col)) {
- return ImageManager.getImage(roleItem.isCompleted() ? PluginUiImage.CHECKBOX_ENABLED : PluginUiImage.CHECKBOX_DISABLED);
- } else if (dCol.equals(UserRoleXViewerFactory.Num_Major_Col)) {
- return Severity.getImage(Severity.Major);
- } else if (dCol.equals(UserRoleXViewerFactory.Num_Minor_Col)) {
- return Severity.getImage(Severity.Minor);
- } else if (dCol.equals(UserRoleXViewerFactory.Num_Issues_Col)) {
- return Severity.getImage(Severity.Issue);
- }
- return null;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn aCol, int columnIndex) throws OseeCoreException {
-
- UserRole defectItem = (UserRole) element;
- if (aCol.equals(UserRoleXViewerFactory.User_Col)) {
- return defectItem.getUser().getName();
- } else if (aCol.equals(UserRoleXViewerFactory.Hours_Spent_Col)) {
- return defectItem.getHoursSpent() == null ? "" : AtsUtil.doubleToI18nString(defectItem.getHoursSpent(), false);
- } else if (aCol.equals(UserRoleXViewerFactory.Role_Col)) {
- return defectItem.getRole().name();
- } else if (aCol.equals(UserRoleXViewerFactory.Completed_Col)) {
- return String.valueOf(defectItem.isCompleted());
- } else if (aCol.equals(UserRoleXViewerFactory.Num_Major_Col)) {
- return xViewer.getXUserRoleViewer().getReviewArt().getUserRoleManager().getNumMajor(defectItem.getUser()) + "";
- } else if (aCol.equals(UserRoleXViewerFactory.Num_Minor_Col)) {
- return xViewer.getXUserRoleViewer().getReviewArt().getUserRoleManager().getNumMinor(defectItem.getUser()) + "";
- } else if (aCol.equals(UserRoleXViewerFactory.Num_Issues_Col)) {
- return xViewer.getXUserRoleViewer().getReviewArt().getUserRoleManager().getNumIssues(defectItem.getUser()) + "";
- }
- return "unhandled column";
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public UserRoleXViewer getTreeViewer() {
- return xViewer;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.role;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.graphics.Image;
+
+public class UserRoleLabelProvider extends XViewerLabelProvider {
+ private final UserRoleXViewer xViewer;
+
+ public UserRoleLabelProvider(UserRoleXViewer xViewer) {
+ super(xViewer);
+ this.xViewer = xViewer;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, XViewerColumn dCol, int columnIndex) throws OseeCoreException {
+ UserRole roleItem = (UserRole) element;
+ if (dCol.equals(UserRoleXViewerFactory.User_Col)) {
+ return ArtifactImageManager.getImage(roleItem.getUser());
+ } else if (dCol.equals(UserRoleXViewerFactory.Role_Col)) {
+ return ImageManager.getImage(AtsImage.ROLE);
+ } else if (dCol.equals(UserRoleXViewerFactory.Hours_Spent_Col)) {
+ return ImageManager.getImage(FrameworkImage.CLOCK);
+ } else if (dCol.equals(UserRoleXViewerFactory.Completed_Col)) {
+ return ImageManager.getImage(roleItem.isCompleted() ? PluginUiImage.CHECKBOX_ENABLED : PluginUiImage.CHECKBOX_DISABLED);
+ } else if (dCol.equals(UserRoleXViewerFactory.Num_Major_Col)) {
+ return Severity.getImage(Severity.Major);
+ } else if (dCol.equals(UserRoleXViewerFactory.Num_Minor_Col)) {
+ return Severity.getImage(Severity.Minor);
+ } else if (dCol.equals(UserRoleXViewerFactory.Num_Issues_Col)) {
+ return Severity.getImage(Severity.Issue);
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn aCol, int columnIndex) throws OseeCoreException {
+
+ UserRole defectItem = (UserRole) element;
+ if (aCol.equals(UserRoleXViewerFactory.User_Col)) {
+ return defectItem.getUser().getName();
+ } else if (aCol.equals(UserRoleXViewerFactory.Hours_Spent_Col)) {
+ return defectItem.getHoursSpent() == null ? "" : AtsUtil.doubleToI18nString(defectItem.getHoursSpent(), false);
+ } else if (aCol.equals(UserRoleXViewerFactory.Role_Col)) {
+ return defectItem.getRole().name();
+ } else if (aCol.equals(UserRoleXViewerFactory.Completed_Col)) {
+ return String.valueOf(defectItem.isCompleted());
+ } else if (aCol.equals(UserRoleXViewerFactory.Num_Major_Col)) {
+ return xViewer.getXUserRoleViewer().getReviewArt().getUserRoleManager().getNumMajor(defectItem.getUser()) + "";
+ } else if (aCol.equals(UserRoleXViewerFactory.Num_Minor_Col)) {
+ return xViewer.getXUserRoleViewer().getReviewArt().getUserRoleManager().getNumMinor(defectItem.getUser()) + "";
+ } else if (aCol.equals(UserRoleXViewerFactory.Num_Issues_Col)) {
+ return xViewer.getXUserRoleViewer().getReviewArt().getUserRoleManager().getNumIssues(defectItem.getUser()) + "";
+ }
+ return "unhandled column";
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public UserRoleXViewer getTreeViewer() {
+ return xViewer;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleManager.java
index ad645c4467b..32f657df6ef 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleManager.java
@@ -1,229 +1,229 @@
-/*******************************************************************************
- * 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.ats.util.widgets.role;
-
-import java.lang.ref.WeakReference;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Matcher;
-import org.eclipse.osee.ats.artifact.IReviewArtifact;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem;
-import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
-import org.eclipse.osee.ats.util.widgets.role.UserRole.Role;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.AXml;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-
-/**
- * @author Donald G. Dunne
- */
-public class UserRoleManager {
-
- private WeakReference<ReviewSMArtifact> artifactRef;
- private boolean enabled = true;
- private static String ATS_DEFECT_TAG = "AtsRole";
- private static String DEFECT_ITEM_TAG = "Role";
- private static String REVIEW_DEFECT_ATTRIBUTE_NAME = "ats.Role";
-
- public UserRoleManager(ReviewSMArtifact artifact) {
- this.artifactRef = new WeakReference<ReviewSMArtifact>(artifact);
- }
-
- public String getHtml() throws OseeCoreException {
- if (getUserRoles().isEmpty()) return "";
- StringBuffer sb = new StringBuffer();
- sb.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Defects"));
- sb.append(getTable());
- return sb.toString();
- }
-
- public ReviewSMArtifact getArtifact() throws OseeStateException {
- if (artifactRef.get() == null) {
- throw new OseeStateException("Artifact has been garbage collected");
- }
- return artifactRef.get();
- }
-
- public Set<UserRole> getUserRoles() throws OseeCoreException {
- Set<UserRole> uRoles = new HashSet<UserRole>();
- String xml = getArtifact().getSoleAttributeValue(REVIEW_DEFECT_ATTRIBUTE_NAME, "");
- Matcher m =
- java.util.regex.Pattern.compile("<" + DEFECT_ITEM_TAG + ">(.*?)</" + DEFECT_ITEM_TAG + ">").matcher(xml);
- while (m.find()) {
- UserRole item = new UserRole(m.group());
- uRoles.add(item);
- }
- return uRoles;
- }
-
- public Set<UserRole> getRoleUsersReviewComplete() throws OseeCoreException {
- Set<UserRole> cRoles = new HashSet<UserRole>();
- for (UserRole role : getUserRoles(Role.Reviewer)) {
- if (role.isCompleted()) {
- cRoles.add(role);
- }
- }
- return cRoles;
- }
-
- public Set<User> getRoleUsersAuthorModerator() throws OseeCoreException {
- Set<User> roles = getRoleUsers(Role.Author);
- if (roles.isEmpty()) {
- roles = getRoleUsers(Role.Moderator);
- roles.add(UserManager.getUser());
- }
-
- return roles;
- }
-
- public Set<UserRole> getUserRoles(Role role) throws OseeCoreException {
- Set<UserRole> roles = new HashSet<UserRole>();
- for (UserRole uRole : getUserRoles())
- if (uRole.getRole() == role) roles.add(uRole);
- return roles;
- }
-
- public Set<User> getRoleUsers(Role role) throws OseeCoreException {
- Set<User> users = new HashSet<User>();
- for (UserRole uRole : getUserRoles())
- if (uRole.getRole() == role) users.add(uRole.getUser());
- return users;
- }
-
- private void saveRoleItems(Set<UserRole> defectItems, boolean persist, SkynetTransaction transaction) {
- try {
- StringBuffer sb = new StringBuffer("<" + ATS_DEFECT_TAG + ">");
- for (UserRole item : defectItems)
- sb.append(AXml.addTagData(DEFECT_ITEM_TAG, item.toXml()));
- sb.append("</" + ATS_DEFECT_TAG + ">");
- getArtifact().setSoleAttributeValue(REVIEW_DEFECT_ATTRIBUTE_NAME, sb.toString());
- updateAssignees();
- if (persist) {
- getArtifact().persist(transaction);
- }
- rollupHoursSpentToReviewState(persist, transaction);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't create ats review defect document", ex);
- }
- }
-
- public void addOrUpdateUserRole(UserRole userRole, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
- Set<UserRole> roleItems = getUserRoles();
- boolean found = false;
- for (UserRole uRole : roleItems) {
- if (userRole.equals(uRole)) {
- uRole.update(userRole);
- found = true;
- }
- }
- if (!found) roleItems.add(userRole);
- saveRoleItems(roleItems, persist, transaction);
- }
-
- private void updateAssignees() throws OseeCoreException {
- // Set assignees based on roles that are not set as completed
- Set<User> assignees = new HashSet<User>();
- for (UserRole uRole : getUserRoles()) {
- if (!uRole.isCompleted() && uRole.getUser() != null) assignees.add(uRole.getUser());
- }
- // If roles are all completed, then still need to select a user to assign to SMA
- if (assignees.isEmpty()) {
- if (getUserRoles(Role.Author).size() > 0)
- for (UserRole role : getUserRoles(Role.Author))
- assignees.add(role.getUser());
- else if (getUserRoles(Role.Moderator).size() > 0)
- for (UserRole role : getUserRoles(Role.Moderator))
- assignees.add(role.getUser());
- else
- assignees.add(UserManager.getUser());
- }
- // Set assignees based on roles
- getArtifact().getStateMgr().setAssignees(assignees);
- }
-
- public void removeUserRole(UserRole userRole, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
- Set<UserRole> roleItems = getUserRoles();
- roleItems.remove(userRole);
- saveRoleItems(roleItems, persist, transaction);
- }
-
- public String getTable() throws OseeCoreException {
- StringBuilder builder = new StringBuilder();
- builder.append("<TABLE BORDER=\"1\" cellspacing=\"1\" cellpadding=\"3%\" width=\"100%\"><THEAD><TR><TH>Role</TH>" + "<TH>User</TH><TH>Hours</TH><TH>Major</TH><TH>Minor</TH><TH>Issues</TH>");
- for (UserRole item : getUserRoles()) {
- User user = item.getUser();
- String name = "";
- if (user != null) {
- name = user.getName();
- if (name == null || name.equals("")) {
- name = user.getName();
- }
- }
- builder.append("<TR>");
- builder.append("<TD>" + item.getRole().name() + "</TD>");
- builder.append("<TD>" + item.getUser().getName() + "</TD>");
- builder.append("<TD>" + item.getHoursSpentStr() + "</TD>");
- builder.append("<TD>" + getNumMajor(item.getUser()) + "</TD>");
- builder.append("<TD>" + getNumMinor(item.getUser()) + "</TD>");
- builder.append("<TD>" + getNumIssues(item.getUser()) + "</TD>");
- builder.append("</TR>");
- }
- builder.append("</TABLE>");
- return builder.toString();
- }
-
- public int getNumMajor(User user) throws OseeCoreException {
- int x = 0;
- for (DefectItem dItem : ((IReviewArtifact) getArtifact()).getDefectManager().getDefectItems())
- if (dItem.getSeverity() == Severity.Major && dItem.getUser() == user) x++;
- return x;
- }
-
- public int getNumMinor(User user) throws OseeCoreException {
- int x = 0;
- for (DefectItem dItem : ((IReviewArtifact) getArtifact()).getDefectManager().getDefectItems())
- if (dItem.getSeverity() == Severity.Minor && dItem.getUser() == user) x++;
- return x;
- }
-
- public int getNumIssues(User user) throws OseeCoreException {
- int x = 0;
- for (DefectItem dItem : ((IReviewArtifact) getArtifact()).getDefectManager().getDefectItems())
- if (dItem.getSeverity() == Severity.Issue && dItem.getUser() == user) x++;
- return x;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public void rollupHoursSpentToReviewState(boolean persist, SkynetTransaction transaction) throws OseeCoreException {
- double hoursSpent = 0.0;
- for (UserRole role : getUserRoles())
- hoursSpent += role.getHoursSpent() == null ? 0 : role.getHoursSpent();
- StateMachineArtifact sma = (StateMachineArtifact) getArtifact();
- sma.getStateMgr().setMetrics(hoursSpent, sma.getStateMgr().getPercentComplete(), true);
- if (persist) getArtifact().persist(transaction);
- }
+/*******************************************************************************
+ * 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.ats.util.widgets.role;
+
+import java.lang.ref.WeakReference;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import org.eclipse.osee.ats.artifact.IReviewArtifact;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem;
+import org.eclipse.osee.ats.util.widgets.defect.DefectItem.Severity;
+import org.eclipse.osee.ats.util.widgets.role.UserRole.Role;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.AXml;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UserRoleManager {
+
+ private WeakReference<ReviewSMArtifact> artifactRef;
+ private boolean enabled = true;
+ private static String ATS_DEFECT_TAG = "AtsRole";
+ private static String DEFECT_ITEM_TAG = "Role";
+ private static String REVIEW_DEFECT_ATTRIBUTE_NAME = "ats.Role";
+
+ public UserRoleManager(ReviewSMArtifact artifact) {
+ this.artifactRef = new WeakReference<ReviewSMArtifact>(artifact);
+ }
+
+ public String getHtml() throws OseeCoreException {
+ if (getUserRoles().isEmpty()) return "";
+ StringBuffer sb = new StringBuffer();
+ sb.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, "Defects"));
+ sb.append(getTable());
+ return sb.toString();
+ }
+
+ public ReviewSMArtifact getArtifact() throws OseeStateException {
+ if (artifactRef.get() == null) {
+ throw new OseeStateException("Artifact has been garbage collected");
+ }
+ return artifactRef.get();
+ }
+
+ public Set<UserRole> getUserRoles() throws OseeCoreException {
+ Set<UserRole> uRoles = new HashSet<UserRole>();
+ String xml = getArtifact().getSoleAttributeValue(REVIEW_DEFECT_ATTRIBUTE_NAME, "");
+ Matcher m =
+ java.util.regex.Pattern.compile("<" + DEFECT_ITEM_TAG + ">(.*?)</" + DEFECT_ITEM_TAG + ">").matcher(xml);
+ while (m.find()) {
+ UserRole item = new UserRole(m.group());
+ uRoles.add(item);
+ }
+ return uRoles;
+ }
+
+ public Set<UserRole> getRoleUsersReviewComplete() throws OseeCoreException {
+ Set<UserRole> cRoles = new HashSet<UserRole>();
+ for (UserRole role : getUserRoles(Role.Reviewer)) {
+ if (role.isCompleted()) {
+ cRoles.add(role);
+ }
+ }
+ return cRoles;
+ }
+
+ public Set<User> getRoleUsersAuthorModerator() throws OseeCoreException {
+ Set<User> roles = getRoleUsers(Role.Author);
+ if (roles.isEmpty()) {
+ roles = getRoleUsers(Role.Moderator);
+ roles.add(UserManager.getUser());
+ }
+
+ return roles;
+ }
+
+ public Set<UserRole> getUserRoles(Role role) throws OseeCoreException {
+ Set<UserRole> roles = new HashSet<UserRole>();
+ for (UserRole uRole : getUserRoles())
+ if (uRole.getRole() == role) roles.add(uRole);
+ return roles;
+ }
+
+ public Set<User> getRoleUsers(Role role) throws OseeCoreException {
+ Set<User> users = new HashSet<User>();
+ for (UserRole uRole : getUserRoles())
+ if (uRole.getRole() == role) users.add(uRole.getUser());
+ return users;
+ }
+
+ private void saveRoleItems(Set<UserRole> defectItems, boolean persist, SkynetTransaction transaction) {
+ try {
+ StringBuffer sb = new StringBuffer("<" + ATS_DEFECT_TAG + ">");
+ for (UserRole item : defectItems)
+ sb.append(AXml.addTagData(DEFECT_ITEM_TAG, item.toXml()));
+ sb.append("</" + ATS_DEFECT_TAG + ">");
+ getArtifact().setSoleAttributeValue(REVIEW_DEFECT_ATTRIBUTE_NAME, sb.toString());
+ updateAssignees();
+ if (persist) {
+ getArtifact().persist(transaction);
+ }
+ rollupHoursSpentToReviewState(persist, transaction);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, "Can't create ats review defect document", ex);
+ }
+ }
+
+ public void addOrUpdateUserRole(UserRole userRole, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
+ Set<UserRole> roleItems = getUserRoles();
+ boolean found = false;
+ for (UserRole uRole : roleItems) {
+ if (userRole.equals(uRole)) {
+ uRole.update(userRole);
+ found = true;
+ }
+ }
+ if (!found) roleItems.add(userRole);
+ saveRoleItems(roleItems, persist, transaction);
+ }
+
+ private void updateAssignees() throws OseeCoreException {
+ // Set assignees based on roles that are not set as completed
+ Set<User> assignees = new HashSet<User>();
+ for (UserRole uRole : getUserRoles()) {
+ if (!uRole.isCompleted() && uRole.getUser() != null) assignees.add(uRole.getUser());
+ }
+ // If roles are all completed, then still need to select a user to assign to SMA
+ if (assignees.isEmpty()) {
+ if (getUserRoles(Role.Author).size() > 0)
+ for (UserRole role : getUserRoles(Role.Author))
+ assignees.add(role.getUser());
+ else if (getUserRoles(Role.Moderator).size() > 0)
+ for (UserRole role : getUserRoles(Role.Moderator))
+ assignees.add(role.getUser());
+ else
+ assignees.add(UserManager.getUser());
+ }
+ // Set assignees based on roles
+ getArtifact().getStateMgr().setAssignees(assignees);
+ }
+
+ public void removeUserRole(UserRole userRole, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
+ Set<UserRole> roleItems = getUserRoles();
+ roleItems.remove(userRole);
+ saveRoleItems(roleItems, persist, transaction);
+ }
+
+ public String getTable() throws OseeCoreException {
+ StringBuilder builder = new StringBuilder();
+ builder.append("<TABLE BORDER=\"1\" cellspacing=\"1\" cellpadding=\"3%\" width=\"100%\"><THEAD><TR><TH>Role</TH>" + "<TH>User</TH><TH>Hours</TH><TH>Major</TH><TH>Minor</TH><TH>Issues</TH>");
+ for (UserRole item : getUserRoles()) {
+ User user = item.getUser();
+ String name = "";
+ if (user != null) {
+ name = user.getName();
+ if (name == null || name.equals("")) {
+ name = user.getName();
+ }
+ }
+ builder.append("<TR>");
+ builder.append("<TD>" + item.getRole().name() + "</TD>");
+ builder.append("<TD>" + item.getUser().getName() + "</TD>");
+ builder.append("<TD>" + item.getHoursSpentStr() + "</TD>");
+ builder.append("<TD>" + getNumMajor(item.getUser()) + "</TD>");
+ builder.append("<TD>" + getNumMinor(item.getUser()) + "</TD>");
+ builder.append("<TD>" + getNumIssues(item.getUser()) + "</TD>");
+ builder.append("</TR>");
+ }
+ builder.append("</TABLE>");
+ return builder.toString();
+ }
+
+ public int getNumMajor(User user) throws OseeCoreException {
+ int x = 0;
+ for (DefectItem dItem : ((IReviewArtifact) getArtifact()).getDefectManager().getDefectItems())
+ if (dItem.getSeverity() == Severity.Major && dItem.getUser() == user) x++;
+ return x;
+ }
+
+ public int getNumMinor(User user) throws OseeCoreException {
+ int x = 0;
+ for (DefectItem dItem : ((IReviewArtifact) getArtifact()).getDefectManager().getDefectItems())
+ if (dItem.getSeverity() == Severity.Minor && dItem.getUser() == user) x++;
+ return x;
+ }
+
+ public int getNumIssues(User user) throws OseeCoreException {
+ int x = 0;
+ for (DefectItem dItem : ((IReviewArtifact) getArtifact()).getDefectManager().getDefectItems())
+ if (dItem.getSeverity() == Severity.Issue && dItem.getUser() == user) x++;
+ return x;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public void rollupHoursSpentToReviewState(boolean persist, SkynetTransaction transaction) throws OseeCoreException {
+ double hoursSpent = 0.0;
+ for (UserRole role : getUserRoles())
+ hoursSpent += role.getHoursSpent() == null ? 0 : role.getHoursSpent();
+ StateMachineArtifact sma = (StateMachineArtifact) getArtifact();
+ sma.getStateMgr().setMetrics(hoursSpent, sma.getStateMgr().getPercentComplete(), true);
+ if (persist) getArtifact().persist(transaction);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java
index e8f91e36a3c..3f64afcd563 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewer.java
@@ -1,268 +1,268 @@
-/*******************************************************************************
- * 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.ats.util.widgets.role;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-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.nebula.widgets.xviewer.XPromptChange;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.util.EnumStringSingleSelectionDialog;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.role.UserRole.Role;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserListDialog;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class UserRoleXViewer extends XViewer {
-
- private final XUserRoleViewer xUserRoleViewer;
-
- /**
- * @param parent
- * @param style
- */
- public UserRoleXViewer(Composite parent, int style, XUserRoleViewer xUserRoleViewer) {
- super(parent, style, new UserRoleXViewerFactory());
- this.xUserRoleViewer = xUserRoleViewer;
- }
-
- @Override
- protected void createSupportWidgets(Composite parent) {
- super.createSupportWidgets(parent);
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- ((UserRoleContentProvider) getContentProvider()).clear();
- }
- });
- createMenuActions();
- }
-
- public void createMenuActions() {
- setColumnMultiEditEnabled(true);
- MenuManager mm = getMenuManager();
- mm.createContextMenu(getControl());
- mm.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- updateMenuActionsForTable();
- }
- });
- }
-
- public void updateEditMenuActions() {
- // MenuManager mm = getMenuManager();
- // EDIT MENU BLOCK
- }
-
- public void updateMenuActionsForTable() {
- MenuManager mm = getMenuManager();
- updateEditMenuActions();
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
- }
-
- public Collection<UserRole> getLoadedUserRoleItems() {
- return ((UserRoleContentProvider) getContentProvider()).getRootSet();
- }
-
- public void add(Collection<UserRole> userRoles) {
- ((UserRoleContentProvider) getContentProvider()).add(userRoles);
- }
-
- public void set(Collection<? extends UserRole> userRoles) {
- if (((UserRoleContentProvider) getContentProvider()) != null) ((UserRoleContentProvider) getContentProvider()).set(userRoles);
- }
-
- public void clear() {
- ((UserRoleContentProvider) getContentProvider()).clear();
- }
-
- /**
- * Release resources
- */
- @Override
- public void dispose() {
- // Dispose of the table objects is done through separate dispose listener off tree
- // Tell the label provider to release its resources
- getLabelProvider().dispose();
- }
-
- public ArrayList<UserRole> getSelectedUserRoleItems() {
- ArrayList<UserRole> arts = new ArrayList<UserRole>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) for (TreeItem item : items)
- arts.add((UserRole) item.getData());
- return arts;
- }
-
- public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
- if (!xUserRoleViewer.isEditable()) {
- return;
- }
- ArrayList<UserRole> userRoles = new ArrayList<UserRole>();
- for (TreeItem item : treeItems) {
- userRoles.add((UserRole) item.getData());
- }
- try {
- promptChangeDate((XViewerColumn) treeColumn.getData(), userRoles, isColumnMultiEditEnabled());
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
- return handleAltLeftClick(treeColumn, treeItem);
- }
-
- @Override
- public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
- if (!xUserRoleViewer.isEditable()) {
- return false;
- }
- try {
- // System.out.println("Column " + treeColumn.getText() + " item " +
- // treeItem);
- XViewerColumn aCol = (XViewerColumn) treeColumn.getData();
- UserRole userRole = (UserRole) treeItem.getData();
- List<UserRole> userRoles = new ArrayList<UserRole>();
- userRoles.add(userRole);
-
- if (aCol.equals(UserRoleXViewerFactory.Completed_Col) || aCol.equals(UserRoleXViewerFactory.Hours_Spent_Col) || aCol.equals(UserRoleXViewerFactory.Num_Minor_Col) || aCol.equals(UserRoleXViewerFactory.Num_Major_Col) || aCol.equals(UserRoleXViewerFactory.Num_Issues_Col) || aCol.equals(UserRoleXViewerFactory.User_Col) || aCol.equals(UserRoleXViewerFactory.Role_Col)) {
- promptChangeDate(aCol, userRoles, false);
- } else
- throw new OseeStateException("Unhandled user role column");
-
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- private boolean setHoursSpent(Collection<UserRole> userRoles, String hours) {
- boolean modified = false;
- for (UserRole userRole : userRoles) {
- userRole.setHoursSpent(hours.equals("") ? 0 : (new Double(hours)).doubleValue());
- if (!modified) modified = true;
- }
- return modified;
- }
-
- private boolean setCompleted(Collection<UserRole> userRoles) {
- boolean modified = false;
- for (UserRole userRole : userRoles) {
- if (userRole.getHoursSpent() == null) {
- AWorkbench.popup("ERROR", "Must enter Hours Spent");
- return false;
- }
- userRole.setCompleted(!userRole.isCompleted());
- if (!modified) modified = true;
- }
- return modified;
- }
-
- private boolean setUser(Collection<UserRole> userRoles, User user) {
- boolean modified = false;
- for (UserRole userRole : userRoles) {
- if (user != null && userRole.getUser() != user) {
- userRole.setUser(user);
- if (!modified) modified = true;
- }
- }
- return modified;
- }
-
- private boolean setRole(Collection<UserRole> userRoles, String role) {
- boolean modified = false;
- for (UserRole userRole : userRoles) {
- userRole.setRole(Role.valueOf((String) role));
- if (!modified) modified = true;
- }
- return modified;
- }
-
- public boolean promptChangeDate(XViewerColumn xCol, Collection<UserRole> userRoles, boolean columnMultiEdit) throws OseeCoreException {
- boolean modified = false;
- if (userRoles != null && !userRoles.isEmpty()) {
- UserRole userRole = (UserRole) userRoles.toArray()[0];
- if (xCol.equals(UserRoleXViewerFactory.Hours_Spent_Col)) {
- String hours =
- XPromptChange.promptChangeFloat(xCol.getName(),
- (columnMultiEdit ? 0 : (userRole.getHoursSpent() == null ? 0 : userRole.getHoursSpent())));
- if (hours != null) {
- modified = setHoursSpent(userRoles, hours);
- }
- } else if (xCol.equals(UserRoleXViewerFactory.Num_Minor_Col) || xCol.equals(UserRoleXViewerFactory.Num_Major_Col) || xCol.equals(UserRoleXViewerFactory.Num_Issues_Col)) {
- AWorkbench.popup("ERROR", "Field is calculated");
- } else if (xCol.equals(UserRoleXViewerFactory.Completed_Col)) {
- modified = setCompleted(userRoles);
- } else if (xCol.equals(UserRoleXViewerFactory.User_Col)) {
- UserListDialog ld = new UserListDialog(Displays.getActiveShell(), "Select New User");
- int result = ld.open();
- if (result == 0) {
- modified = setUser(userRoles, ld.getSelection());
- }
- } else if (xCol.equals(UserRoleXViewerFactory.Role_Col)) {
- EnumStringSingleSelectionDialog enumDialog =
- XPromptChange.promptChangeSingleSelectEnumeration(xCol.getName(), Role.strValues(),
- (columnMultiEdit ? null : userRole.getRole().name()));
- if (enumDialog != null) {
- if (enumDialog.getResult()[0] != null) {
- modified = setRole(userRoles, (String) enumDialog.getResult()[0]);
- }
- }
- }
- if (modified) {
- return executeTransaction(userRoles);
- }
- }
- return false;
- }
-
- public boolean executeTransaction(Collection<UserRole> userRoles) throws OseeCoreException {
- SkynetTransaction transaction =
- new SkynetTransaction(xUserRoleViewer.getReviewArt().getArtifact().getBranch(), "Modify Review Roles");
- for (UserRole userRole : userRoles) {
- xUserRoleViewer.getReviewArt().getUserRoleManager().addOrUpdateUserRole(userRole, false, transaction);
- update(userRole, null);
- }
- transaction.execute();
- xUserRoleViewer.refresh();
- xUserRoleViewer.notifyXModifiedListeners();
- return true;
- }
-
- /**
- * @return the xUserRoleViewer
- */
- public XUserRoleViewer getXUserRoleViewer() {
- return xUserRoleViewer;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.role;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+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.nebula.widgets.xviewer.XPromptChange;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.util.EnumStringSingleSelectionDialog;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.role.UserRole.Role;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserListDialog;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UserRoleXViewer extends XViewer {
+
+ private final XUserRoleViewer xUserRoleViewer;
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public UserRoleXViewer(Composite parent, int style, XUserRoleViewer xUserRoleViewer) {
+ super(parent, style, new UserRoleXViewerFactory());
+ this.xUserRoleViewer = xUserRoleViewer;
+ }
+
+ @Override
+ protected void createSupportWidgets(Composite parent) {
+ super.createSupportWidgets(parent);
+ parent.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ ((UserRoleContentProvider) getContentProvider()).clear();
+ }
+ });
+ createMenuActions();
+ }
+
+ public void createMenuActions() {
+ setColumnMultiEditEnabled(true);
+ MenuManager mm = getMenuManager();
+ mm.createContextMenu(getControl());
+ mm.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ updateMenuActionsForTable();
+ }
+ });
+ }
+
+ public void updateEditMenuActions() {
+ // MenuManager mm = getMenuManager();
+ // EDIT MENU BLOCK
+ }
+
+ public void updateMenuActionsForTable() {
+ MenuManager mm = getMenuManager();
+ updateEditMenuActions();
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+ }
+
+ public Collection<UserRole> getLoadedUserRoleItems() {
+ return ((UserRoleContentProvider) getContentProvider()).getRootSet();
+ }
+
+ public void add(Collection<UserRole> userRoles) {
+ ((UserRoleContentProvider) getContentProvider()).add(userRoles);
+ }
+
+ public void set(Collection<? extends UserRole> userRoles) {
+ if (((UserRoleContentProvider) getContentProvider()) != null) ((UserRoleContentProvider) getContentProvider()).set(userRoles);
+ }
+
+ public void clear() {
+ ((UserRoleContentProvider) getContentProvider()).clear();
+ }
+
+ /**
+ * Release resources
+ */
+ @Override
+ public void dispose() {
+ // Dispose of the table objects is done through separate dispose listener off tree
+ // Tell the label provider to release its resources
+ getLabelProvider().dispose();
+ }
+
+ public ArrayList<UserRole> getSelectedUserRoleItems() {
+ ArrayList<UserRole> arts = new ArrayList<UserRole>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) for (TreeItem item : items)
+ arts.add((UserRole) item.getData());
+ return arts;
+ }
+
+ public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
+ if (!xUserRoleViewer.isEditable()) {
+ return;
+ }
+ ArrayList<UserRole> userRoles = new ArrayList<UserRole>();
+ for (TreeItem item : treeItems) {
+ userRoles.add((UserRole) item.getData());
+ }
+ try {
+ promptChangeDate((XViewerColumn) treeColumn.getData(), userRoles, isColumnMultiEditEnabled());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
+ return handleAltLeftClick(treeColumn, treeItem);
+ }
+
+ @Override
+ public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
+ if (!xUserRoleViewer.isEditable()) {
+ return false;
+ }
+ try {
+ // System.out.println("Column " + treeColumn.getText() + " item " +
+ // treeItem);
+ XViewerColumn aCol = (XViewerColumn) treeColumn.getData();
+ UserRole userRole = (UserRole) treeItem.getData();
+ List<UserRole> userRoles = new ArrayList<UserRole>();
+ userRoles.add(userRole);
+
+ if (aCol.equals(UserRoleXViewerFactory.Completed_Col) || aCol.equals(UserRoleXViewerFactory.Hours_Spent_Col) || aCol.equals(UserRoleXViewerFactory.Num_Minor_Col) || aCol.equals(UserRoleXViewerFactory.Num_Major_Col) || aCol.equals(UserRoleXViewerFactory.Num_Issues_Col) || aCol.equals(UserRoleXViewerFactory.User_Col) || aCol.equals(UserRoleXViewerFactory.Role_Col)) {
+ promptChangeDate(aCol, userRoles, false);
+ } else
+ throw new OseeStateException("Unhandled user role column");
+
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ private boolean setHoursSpent(Collection<UserRole> userRoles, String hours) {
+ boolean modified = false;
+ for (UserRole userRole : userRoles) {
+ userRole.setHoursSpent(hours.equals("") ? 0 : (new Double(hours)).doubleValue());
+ if (!modified) modified = true;
+ }
+ return modified;
+ }
+
+ private boolean setCompleted(Collection<UserRole> userRoles) {
+ boolean modified = false;
+ for (UserRole userRole : userRoles) {
+ if (userRole.getHoursSpent() == null) {
+ AWorkbench.popup("ERROR", "Must enter Hours Spent");
+ return false;
+ }
+ userRole.setCompleted(!userRole.isCompleted());
+ if (!modified) modified = true;
+ }
+ return modified;
+ }
+
+ private boolean setUser(Collection<UserRole> userRoles, User user) {
+ boolean modified = false;
+ for (UserRole userRole : userRoles) {
+ if (user != null && userRole.getUser() != user) {
+ userRole.setUser(user);
+ if (!modified) modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private boolean setRole(Collection<UserRole> userRoles, String role) {
+ boolean modified = false;
+ for (UserRole userRole : userRoles) {
+ userRole.setRole(Role.valueOf((String) role));
+ if (!modified) modified = true;
+ }
+ return modified;
+ }
+
+ public boolean promptChangeDate(XViewerColumn xCol, Collection<UserRole> userRoles, boolean columnMultiEdit) throws OseeCoreException {
+ boolean modified = false;
+ if (userRoles != null && !userRoles.isEmpty()) {
+ UserRole userRole = (UserRole) userRoles.toArray()[0];
+ if (xCol.equals(UserRoleXViewerFactory.Hours_Spent_Col)) {
+ String hours =
+ XPromptChange.promptChangeFloat(xCol.getName(),
+ (columnMultiEdit ? 0 : (userRole.getHoursSpent() == null ? 0 : userRole.getHoursSpent())));
+ if (hours != null) {
+ modified = setHoursSpent(userRoles, hours);
+ }
+ } else if (xCol.equals(UserRoleXViewerFactory.Num_Minor_Col) || xCol.equals(UserRoleXViewerFactory.Num_Major_Col) || xCol.equals(UserRoleXViewerFactory.Num_Issues_Col)) {
+ AWorkbench.popup("ERROR", "Field is calculated");
+ } else if (xCol.equals(UserRoleXViewerFactory.Completed_Col)) {
+ modified = setCompleted(userRoles);
+ } else if (xCol.equals(UserRoleXViewerFactory.User_Col)) {
+ UserListDialog ld = new UserListDialog(Displays.getActiveShell(), "Select New User");
+ int result = ld.open();
+ if (result == 0) {
+ modified = setUser(userRoles, ld.getSelection());
+ }
+ } else if (xCol.equals(UserRoleXViewerFactory.Role_Col)) {
+ EnumStringSingleSelectionDialog enumDialog =
+ XPromptChange.promptChangeSingleSelectEnumeration(xCol.getName(), Role.strValues(),
+ (columnMultiEdit ? null : userRole.getRole().name()));
+ if (enumDialog != null) {
+ if (enumDialog.getResult()[0] != null) {
+ modified = setRole(userRoles, (String) enumDialog.getResult()[0]);
+ }
+ }
+ }
+ if (modified) {
+ return executeTransaction(userRoles);
+ }
+ }
+ return false;
+ }
+
+ public boolean executeTransaction(Collection<UserRole> userRoles) throws OseeCoreException {
+ SkynetTransaction transaction =
+ new SkynetTransaction(xUserRoleViewer.getReviewArt().getArtifact().getBranch(), "Modify Review Roles");
+ for (UserRole userRole : userRoles) {
+ xUserRoleViewer.getReviewArt().getUserRoleManager().addOrUpdateUserRole(userRole, false, transaction);
+ update(userRole, null);
+ }
+ transaction.execute();
+ xUserRoleViewer.refresh();
+ xUserRoleViewer.notifyXModifiedListeners();
+ return true;
+ }
+
+ /**
+ * @return the xUserRoleViewer
+ */
+ public XUserRoleViewer getXUserRoleViewer() {
+ return xUserRoleViewer;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewerFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewerFactory.java
index a6afc79b4e5..6bb4fcb9e49 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewerFactory.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/role/UserRoleXViewerFactory.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * 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.ats.util.widgets.role;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class UserRoleXViewerFactory extends SkynetXViewerFactory {
-
- private static String NAMESPACE = "osee.ats.UserRoleXViewer";
- public static XViewerColumn Role_Col =
- new XViewerColumn("osee.userRole.role", "Role", 100, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn User_Col =
- new XViewerColumn("osee.userRole.user", "User", 150, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Hours_Spent_Col =
- new XViewerColumn("osee.userRole.hoursSpent", "Hours Spent", 80, SWT.LEFT, true, SortDataType.Float, false,
- null);
- public static XViewerColumn Completed_Col =
- new XViewerColumn("osee.userRole.completed", "Completed", 80, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn Num_Major_Col =
- new XViewerColumn("osee.userRole.major", "Major", 60, SWT.CENTER, true, SortDataType.Integer, false, null);
- public static XViewerColumn Num_Minor_Col =
- new XViewerColumn("osee.userRole.minor", "Minor", 60, SWT.CENTER, true, SortDataType.Integer, false, null);
- public static XViewerColumn Num_Issues_Col =
- new XViewerColumn("osee.userRole.issues", "Issues", 60, SWT.CENTER, true, SortDataType.Integer, false, null);
-
- public UserRoleXViewerFactory() {
- super(NAMESPACE);
- registerColumns(Role_Col, User_Col, Hours_Spent_Col, Completed_Col, Num_Major_Col, Num_Minor_Col, Num_Issues_Col);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.widgets.role;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UserRoleXViewerFactory extends SkynetXViewerFactory {
+
+ private static String NAMESPACE = "osee.ats.UserRoleXViewer";
+ public static XViewerColumn Role_Col =
+ new XViewerColumn("osee.userRole.role", "Role", 100, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn User_Col =
+ new XViewerColumn("osee.userRole.user", "User", 150, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Hours_Spent_Col =
+ new XViewerColumn("osee.userRole.hoursSpent", "Hours Spent", 80, SWT.LEFT, true, SortDataType.Float, false,
+ null);
+ public static XViewerColumn Completed_Col =
+ new XViewerColumn("osee.userRole.completed", "Completed", 80, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn Num_Major_Col =
+ new XViewerColumn("osee.userRole.major", "Major", 60, SWT.CENTER, true, SortDataType.Integer, false, null);
+ public static XViewerColumn Num_Minor_Col =
+ new XViewerColumn("osee.userRole.minor", "Minor", 60, SWT.CENTER, true, SortDataType.Integer, false, null);
+ public static XViewerColumn Num_Issues_Col =
+ new XViewerColumn("osee.userRole.issues", "Issues", 60, SWT.CENTER, true, SortDataType.Integer, false, null);
+
+ public UserRoleXViewerFactory() {
+ super(NAMESPACE);
+ registerColumns(Role_Col, User_Col, Hours_Spent_Col, Completed_Col, Num_Major_Col, Num_Minor_Col, Num_Issues_Col);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsAttributeColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsAttributeColumn.java
index 1affddc3bb8..700595d9cfd 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsAttributeColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsAttributeColumn.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * 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.ats.util.xviewer.column;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.world.WorldXViewerFactory;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerAtsAttributeColumn extends XViewerColumn {
-
- private final String attributeTypeName;
-
- /**
- * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
- * XViewerValueColumn need to extend this constructor to copy extra stored fields
- *
- * @param col
- */
- @Override
- public XViewerAtsAttributeColumn copy() {
- return new XViewerAtsAttributeColumn(getId(), getName(), getAttributeTypeName(), getWidth(), getAlign(),
- isShow(), getSortDataType(), isMultiColumnEditable(), getDescription());
- }
-
- public XViewerAtsAttributeColumn(String id, ATSAttributes atsAttribute, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable) {
- this(id, atsAttribute, width, align, show, sortDataType, multiColumnEditable, atsAttribute.getDescription());
- }
-
- public XViewerAtsAttributeColumn(String id, ATSAttributes atsAttribute, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
- this(id, atsAttribute.getDisplayName(), atsAttribute.getStoreName(), width, align, show, sortDataType,
- multiColumnEditable, description);
- }
-
- public XViewerAtsAttributeColumn(ATSAttributes atsAttribute, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable) {
- this(atsAttribute, width, align, show, sortDataType, multiColumnEditable, atsAttribute.getDescription());
- }
-
- public XViewerAtsAttributeColumn(ATSAttributes atsAttribute, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
- this(
- WorldXViewerFactory.COLUMN_NAMESPACE + "." + (atsAttribute.getDisplayName().replaceAll(" ", "").toLowerCase()),
- atsAttribute.getDisplayName(), atsAttribute.getStoreName(), width, align, show, sortDataType,
- multiColumnEditable,
- description == null || description.equals("") ? atsAttribute.getDescription() : description);
- }
-
- public XViewerAtsAttributeColumn(String id, String name, String attributeTypeName, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
- super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
- this.attributeTypeName = attributeTypeName;
- }
-
- public String getAttributeTypeName() {
- return attributeTypeName;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.xviewer.column;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.world.WorldXViewerFactory;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerAtsAttributeColumn extends XViewerColumn {
+
+ private final String attributeTypeName;
+
+ /**
+ * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
+ * XViewerValueColumn need to extend this constructor to copy extra stored fields
+ *
+ * @param col
+ */
+ @Override
+ public XViewerAtsAttributeColumn copy() {
+ return new XViewerAtsAttributeColumn(getId(), getName(), getAttributeTypeName(), getWidth(), getAlign(),
+ isShow(), getSortDataType(), isMultiColumnEditable(), getDescription());
+ }
+
+ public XViewerAtsAttributeColumn(String id, ATSAttributes atsAttribute, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable) {
+ this(id, atsAttribute, width, align, show, sortDataType, multiColumnEditable, atsAttribute.getDescription());
+ }
+
+ public XViewerAtsAttributeColumn(String id, ATSAttributes atsAttribute, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
+ this(id, atsAttribute.getDisplayName(), atsAttribute.getStoreName(), width, align, show, sortDataType,
+ multiColumnEditable, description);
+ }
+
+ public XViewerAtsAttributeColumn(ATSAttributes atsAttribute, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable) {
+ this(atsAttribute, width, align, show, sortDataType, multiColumnEditable, atsAttribute.getDescription());
+ }
+
+ public XViewerAtsAttributeColumn(ATSAttributes atsAttribute, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
+ this(
+ WorldXViewerFactory.COLUMN_NAMESPACE + "." + (atsAttribute.getDisplayName().replaceAll(" ", "").toLowerCase()),
+ atsAttribute.getDisplayName(), atsAttribute.getStoreName(), width, align, show, sortDataType,
+ multiColumnEditable,
+ description == null || description.equals("") ? atsAttribute.getDescription() : description);
+ }
+
+ public XViewerAtsAttributeColumn(String id, String name, String attributeTypeName, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
+ super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
+ this.attributeTypeName = attributeTypeName;
+ }
+
+ public String getAttributeTypeName() {
+ return attributeTypeName;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java
index 056691b0a46..6a0c0b97202 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerReviewRoleColumn.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * 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.ats.util.xviewer.column;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
-import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
-import org.eclipse.osee.ats.util.widgets.role.UserRole;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerReviewRoleColumn extends XViewerValueColumn {
-
- private final User user;
-
- /**
- * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
- * XViewerValueColumn need to extend this constructor to copy extra stored fields
- *
- * @param col
- */
- @Override
- public XViewerReviewRoleColumn copy() {
- return new XViewerReviewRoleColumn(getUser(), getId(), getName(), getWidth(), getAlign(), isShow(),
- getSortDataType(), isMultiColumnEditable(), getDescription());
- }
-
- public XViewerReviewRoleColumn(User user) {
- super("ats.column.role", "Role", 75, SWT.LEFT, true, SortDataType.String, false, null);
- this.user = user;
- }
-
- public XViewerReviewRoleColumn(User user, String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
- super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
- this.user = user;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- try {
- if (element instanceof ReviewSMArtifact) {
- return getRolesStr((ReviewSMArtifact) element, user);
- }
- return "";
- } catch (OseeCoreException ex) {
- throw new XViewerException(ex);
- }
- }
-
- private static String getRolesStr(ReviewSMArtifact reviewArt, User user) throws OseeCoreException {
- StringBuilder builder = new StringBuilder();
- for (UserRole role : reviewArt.getUserRoleManager().getUserRoles()) {
- if (role.getUser().equals(user)) {
- builder.append(role.getRole().name());
- builder.append(", ");
- }
- }
-
- return builder.toString().replaceFirst(", $", "");
- }
-
- public User getUser() {
- return user;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.xviewer.column;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
+import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
+import org.eclipse.osee.ats.util.widgets.role.UserRole;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerReviewRoleColumn extends XViewerValueColumn {
+
+ private final User user;
+
+ /**
+ * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
+ * XViewerValueColumn need to extend this constructor to copy extra stored fields
+ *
+ * @param col
+ */
+ @Override
+ public XViewerReviewRoleColumn copy() {
+ return new XViewerReviewRoleColumn(getUser(), getId(), getName(), getWidth(), getAlign(), isShow(),
+ getSortDataType(), isMultiColumnEditable(), getDescription());
+ }
+
+ public XViewerReviewRoleColumn(User user) {
+ super("ats.column.role", "Role", 75, SWT.LEFT, true, SortDataType.String, false, null);
+ this.user = user;
+ }
+
+ public XViewerReviewRoleColumn(User user, String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
+ super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
+ this.user = user;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ try {
+ if (element instanceof ReviewSMArtifact) {
+ return getRolesStr((ReviewSMArtifact) element, user);
+ }
+ return "";
+ } catch (OseeCoreException ex) {
+ throw new XViewerException(ex);
+ }
+ }
+
+ private static String getRolesStr(ReviewSMArtifact reviewArt, User user) throws OseeCoreException {
+ StringBuilder builder = new StringBuilder();
+ for (UserRole role : reviewArt.getUserRoleManager().getUserRoles()) {
+ if (role.getUser().equals(user)) {
+ builder.append(role.getRole().name());
+ builder.append(", ");
+ }
+ }
+
+ return builder.toString().replaceFirst(", $", "");
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCompletedDateColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCompletedDateColumn.java
index fda58448613..839fb63c5fe 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCompletedDateColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCompletedDateColumn.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.ats.util.xviewer.column;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
-import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.world.WorldXViewerFactory;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerSmaCompletedDateColumn extends XViewerValueColumn {
-
- public XViewerSmaCompletedDateColumn() {
- this("Completed");
- }
-
- public XViewerSmaCompletedDateColumn(String name) {
- super(WorldXViewerFactory.COLUMN_NAMESPACE + "completeDate", name, 80, SWT.LEFT, true, SortDataType.Date, false,
- "Date this workflow transitioned to the Completed state.");
- }
-
- public XViewerSmaCompletedDateColumn(String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
- super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
- }
-
- /**
- * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
- * XViewerValueColumn need to extend this constructor to copy extra stored fields
- *
- * @param col
- */
- @Override
- public XViewerSmaCompletedDateColumn copy() {
- return new XViewerSmaCompletedDateColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- try {
- if (element instanceof StateMachineArtifact) {
- return ((StateMachineArtifact) element).getWorldViewCompletedDateStr();
- }
- return super.getColumnText(element, column, columnIndex);
- } catch (OseeCoreException ex) {
- throw new XViewerException(ex);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.xviewer.column;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
+import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.world.WorldXViewerFactory;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerSmaCompletedDateColumn extends XViewerValueColumn {
+
+ public XViewerSmaCompletedDateColumn() {
+ this("Completed");
+ }
+
+ public XViewerSmaCompletedDateColumn(String name) {
+ super(WorldXViewerFactory.COLUMN_NAMESPACE + "completeDate", name, 80, SWT.LEFT, true, SortDataType.Date, false,
+ "Date this workflow transitioned to the Completed state.");
+ }
+
+ public XViewerSmaCompletedDateColumn(String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
+ super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
+ }
+
+ /**
+ * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
+ * XViewerValueColumn need to extend this constructor to copy extra stored fields
+ *
+ * @param col
+ */
+ @Override
+ public XViewerSmaCompletedDateColumn copy() {
+ return new XViewerSmaCompletedDateColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ try {
+ if (element instanceof StateMachineArtifact) {
+ return ((StateMachineArtifact) element).getWorldViewCompletedDateStr();
+ }
+ return super.getColumnText(element, column, columnIndex);
+ } catch (OseeCoreException ex) {
+ throw new XViewerException(ex);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCreatedDateColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCreatedDateColumn.java
index ebfb494436f..39e5589ca2c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCreatedDateColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaCreatedDateColumn.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.ats.util.xviewer.column;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
-import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
-import org.eclipse.osee.ats.world.IWorldViewArtifact;
-import org.eclipse.osee.ats.world.WorldXViewerFactory;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerSmaCreatedDateColumn extends XViewerValueColumn {
-
- public XViewerSmaCreatedDateColumn() {
- this("Created Date");
- }
-
- public XViewerSmaCreatedDateColumn(String name) {
- super(WorldXViewerFactory.COLUMN_NAMESPACE + ".createdDate", name, 80, SWT.LEFT, true, SortDataType.Date, false,
- "Date this workflow was created.");
- }
-
- public XViewerSmaCreatedDateColumn(String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
- super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
- }
-
- /**
- * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
- * XViewerValueColumn need to extend this constructor to copy extra stored fields
- *
- * @param col
- */
- @Override
- public XViewerSmaCreatedDateColumn copy() {
- return new XViewerSmaCreatedDateColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- try {
- if (element instanceof IWorldViewArtifact) {
- return ((IWorldViewArtifact) element).getWorldViewCreatedDateStr();
- }
- return super.getColumnText(element, column, columnIndex);
- } catch (OseeCoreException ex) {
- throw new XViewerException(ex);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.util.xviewer.column;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
+import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
+import org.eclipse.osee.ats.world.IWorldViewArtifact;
+import org.eclipse.osee.ats.world.WorldXViewerFactory;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerSmaCreatedDateColumn extends XViewerValueColumn {
+
+ public XViewerSmaCreatedDateColumn() {
+ this("Created Date");
+ }
+
+ public XViewerSmaCreatedDateColumn(String name) {
+ super(WorldXViewerFactory.COLUMN_NAMESPACE + ".createdDate", name, 80, SWT.LEFT, true, SortDataType.Date, false,
+ "Date this workflow was created.");
+ }
+
+ public XViewerSmaCreatedDateColumn(String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
+ super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
+ }
+
+ /**
+ * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
+ * XViewerValueColumn need to extend this constructor to copy extra stored fields
+ *
+ * @param col
+ */
+ @Override
+ public XViewerSmaCreatedDateColumn copy() {
+ return new XViewerSmaCreatedDateColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ try {
+ if (element instanceof IWorldViewArtifact) {
+ return ((IWorldViewArtifact) element).getWorldViewCreatedDateStr();
+ }
+ return super.getColumnText(element, column, columnIndex);
+ } catch (OseeCoreException ex) {
+ throw new XViewerException(ex);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaStateColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaStateColumn.java
index dc6edde7b0a..a2d11fba4e0 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaStateColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerSmaStateColumn.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * 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.ats.util.xviewer.column;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
-import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
-import org.eclipse.osee.ats.world.IWorldViewArtifact;
-import org.eclipse.osee.ats.world.WorldXViewerFactory;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerSmaStateColumn extends XViewerValueColumn {
-
- public XViewerSmaStateColumn() {
- super(WorldXViewerFactory.COLUMN_NAMESPACE + "smaState", "State", 75, SWT.LEFT, true, SortDataType.String, false,
- null);
- }
-
- public XViewerSmaStateColumn(String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
- super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
- }
-
- /**
- * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
- * XViewerValueColumn need to extend this constructor to copy extra stored fields
- *
- * @param col
- */
- @Override
- public XViewerSmaStateColumn copy() {
- return new XViewerSmaStateColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- try {
- if (element instanceof IWorldViewArtifact) {
- return ((IWorldViewArtifact) element).getWorldViewState();
- }
- return "";
- } catch (OseeCoreException ex) {
- throw new XViewerException(ex);
- }
- }
-}
+/*******************************************************************************
+ * 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.ats.util.xviewer.column;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
+import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
+import org.eclipse.osee.ats.world.IWorldViewArtifact;
+import org.eclipse.osee.ats.world.WorldXViewerFactory;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerSmaStateColumn extends XViewerValueColumn {
+
+ public XViewerSmaStateColumn() {
+ super(WorldXViewerFactory.COLUMN_NAMESPACE + "smaState", "State", 75, SWT.LEFT, true, SortDataType.String, false,
+ null);
+ }
+
+ public XViewerSmaStateColumn(String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
+ super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
+ }
+
+ /**
+ * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
+ * XViewerValueColumn need to extend this constructor to copy extra stored fields
+ *
+ * @param col
+ */
+ @Override
+ public XViewerSmaStateColumn copy() {
+ return new XViewerSmaStateColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ try {
+ if (element instanceof IWorldViewArtifact) {
+ return ((IWorldViewArtifact) element).getWorldViewState();
+ }
+ return "";
+ } catch (OseeCoreException ex) {
+ throw new XViewerException(ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java
index 1313ab362c1..f7d39e6df76 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java
@@ -1,440 +1,440 @@
-/*******************************************************************************
- * 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.ats.workflow.editor;
-
-import java.util.Arrays;
-import java.util.EventObject;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.ContextMenuProvider;
-import org.eclipse.gef.DefaultEditDomain;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.dnd.TemplateTransferDragSourceListener;
-import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
-import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.requests.CreationFactory;
-import org.eclipse.gef.requests.SimpleFactory;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.palette.PaletteViewer;
-import org.eclipse.gef.ui.palette.PaletteViewerProvider;
-import org.eclipse.gef.ui.parts.ContentOutlinePage;
-import org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette;
-import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
-import org.eclipse.gef.ui.parts.TreeViewer;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.util.TransferDropTargetListener;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.workflow.ATSXWidgetOptionResolver;
-import org.eclipse.osee.ats.workflow.AtsWorkPage;
-import org.eclipse.osee.ats.workflow.editor.actions.EditAction;
-import org.eclipse.osee.ats.workflow.editor.model.CancelledWorkPageShape;
-import org.eclipse.osee.ats.workflow.editor.model.CompletedWorkPageShape;
-import org.eclipse.osee.ats.workflow.editor.model.DefaultTransitionConnection;
-import org.eclipse.osee.ats.workflow.editor.model.ReturnTransitionConnection;
-import org.eclipse.osee.ats.workflow.editor.model.TransitionConnection;
-import org.eclipse.osee.ats.workflow.editor.model.WorkPageShape;
-import org.eclipse.osee.ats.workflow.editor.model.WorkflowDiagram;
-import org.eclipse.osee.ats.workflow.editor.parts.ShapesEditPartFactory;
-import org.eclipse.osee.ats.workflow.editor.parts.ShapesTreeEditPartFactory;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-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.EventModType;
-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.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * A graphical editor for the configuration of ATS workflows<br>
- * <REM2>
- *
- * @author Donald G. Dunne
- */
-public class AtsWorkflowConfigEditor extends GraphicalEditorWithFlyoutPalette implements IArtifactEventListener, IFrameworkTransactionEventListener {
-
- /** This is the root of the editor's model. */
- private WorkflowDiagram diagram;
- /** Palette component, holding the tools and shapes. */
- private static PaletteRoot PALETTE_MODEL;
- public static String EDITOR_ID = "org.eclipse.osee.ats.workflow.editor.AtsWorkflowConfigEditor";
-
- /** Create a new ShapesEditor instance. This is called by the Workspace. */
- public AtsWorkflowConfigEditor() {
- setEditDomain(new DefaultEditDomain(this));
- OseeEventManager.addListener(this);
- }
-
- /**
- * Configure the graphical viewer before it receives contents.
- * <p>
- * This is the place to choose an appropriate RootEditPart and EditPartFactory for your editor. The RootEditPart
- * determines the behavior of the editor's "work-area". For example, GEF includes zoomable and scrollable root edit
- * parts. The EditPartFactory maps model elements to edit parts (controllers).
- * </p>
- *
- * @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer()
- */
- @Override
- protected void configureGraphicalViewer() {
- super.configureGraphicalViewer();
-
- GraphicalViewer viewer = getGraphicalViewer();
- viewer.setEditPartFactory(new ShapesEditPartFactory());
- viewer.setRootEditPart(new ScalableFreeformRootEditPart());
- viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
-
- // configure the context menu provider
- ContextMenuProvider cmProvider = new AtsWorkflowConfigEditorContextMenuProvider(viewer, getActionRegistry());
- viewer.setContextMenu(cmProvider);
- getSite().registerContextMenu(cmProvider, viewer);
- AtsPlugin.getInstance().setHelp(viewer.getControl(), "atsConfigureWorkflow", "org.eclipse.osee.ats.help.ui");
-
- }
-
- @Override
- public void commandStackChanged(EventObject event) {
- firePropertyChange(IEditorPart.PROP_DIRTY);
- super.commandStackChanged(event);
- }
-
- @Override
- protected PaletteViewerProvider createPaletteViewerProvider() {
- return new PaletteViewerProvider(getEditDomain()) {
- @Override
- protected void configurePaletteViewer(PaletteViewer viewer) {
- super.configurePaletteViewer(viewer);
- // create a drag source listener for this palette viewer
- // together with an appropriate transfer drop target listener, this will enable
- // model element creation by dragging a CombinatedTemplateCreationEntries
- // from the palette into the editor
- // @see ShapesEditor#createTransferDropTargetListener()
- viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));
- }
- };
- }
-
- /**
- * Create a transfer drop target listener. When using a CombinedTemplateCreationEntry tool in the palette, this will
- * enable model element creation by dragging from the palette.
- *
- * @see #createPaletteViewerProvider()
- */
- private TransferDropTargetListener createTransferDropTargetListener() {
- return new TemplateTransferDropTargetListener(getGraphicalViewer()) {
- @Override
- protected CreationFactory getFactory(Object template) {
- return new SimpleFactory((Class<?>) template);
- }
- };
- }
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- try {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Configuration Editor Save");
- Result result = diagram.doSave(transaction);
- if (result.isFalse()) {
- AWorkbench.popup("Save Error", result.getText());
- return;
- }
- transaction.execute();
- diagram.getWorkFlowDefinition().loadPageData(true);
- getCommandStack().markSaveLocation();
-
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public void doSaveAs() {
- AWorkbench.popup("ERROR", "Not implemented yet");
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class type) {
- if (type == IContentOutlinePage.class) {
- return new ShapesOutlinePage(new TreeViewer());
- }
- return super.getAdapter(type);
- }
-
- WorkflowDiagram getModel() {
- return diagram;
- }
-
- @Override
- protected PaletteRoot getPaletteRoot() {
- if (PALETTE_MODEL == null) {
- PALETTE_MODEL = AtsWorkflowConfigEditorPaletteFactory.createPalette(this);
- }
- return PALETTE_MODEL;
- }
-
- /**
- * Set up the editor's inital content (after creation).
- *
- * @see org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette#initializeGraphicalViewer()
- */
- @Override
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
- GraphicalViewer viewer = getGraphicalViewer();
- viewer.setContents(getModel()); // set the contents of this editor
-
- // listen for dropped parts
- viewer.addDropTargetListener(createTransferDropTargetListener());
- createActions();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void createActions() {
- super.createActions();
- ActionRegistry registry = getActionRegistry();
- IAction action;
-
- action = new EditAction();
- registry.registerAction(action);
- getStackActions().add(action.getId());
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- @Override
- protected void setInput(IEditorInput input) {
- super.setInput(input);
- if (input instanceof AtsWorkflowConfigEditorInput) {
- AtsWorkflowConfigEditorInput editorInput = (AtsWorkflowConfigEditorInput) input;
- WorkFlowDefinition workflowDef = editorInput.workflow;
- try {
- setPartName(workflowDef.getName());
- diagram = new WorkflowDiagram(workflowDef);
- int yLoc = 0;
- WorkPageDefinition startPage = workflowDef.getStartPage();
- if (startPage == null || startPage.getName().equals("")) {
- throw new OseeArgumentException("StartPage null for workflow " + workflowDef);
- }
- // Create states
- List<WorkPageDefinition> pages = workflowDef.getPagesOrdered();
- for (WorkPageDefinition page : workflowDef.getPages()) {
- if (!pages.contains(page)) {
- pages.add(page);
- }
- }
- for (WorkPageDefinition pageDef : pages) {
- WorkPageShape pageShape = null;
- if (pageDef.isCancelledPage()) {
- pageShape = new CancelledWorkPageShape(pageDef);
- pageShape.setLocation(new Point(250, 300));
- } else if (pageDef.isCompletePage()) {
- pageShape = new CompletedWorkPageShape(pageDef);
- pageShape.setLocation(new Point(50, yLoc += 90));
- } else {
- pageShape = new WorkPageShape(pageDef);
- pageShape.setLocation(new Point(50, yLoc += 90));
- }
- pageShape.setStartPage(startPage.getId().equals(pageShape.getId()) || pageShape.getId().endsWith(
- startPage.getId()));
- diagram.addChild(pageShape);
- }
-
- // Create transitions
- for (WorkPageDefinition workPageDefinition : workflowDef.getPagesOrdered()) {
- WorkPageShape pageShape = getWorkPageShape(workPageDefinition);
- AtsWorkPage atsWorkPage =
- new AtsWorkPage(workflowDef, workPageDefinition, null, ATSXWidgetOptionResolver.getInstance());
- // Handle to pages
- Set<WorkPageDefinition> toPages = new HashSet<WorkPageDefinition>();
- toPages.addAll(atsWorkPage.getToPages());
- List<WorkPageDefinition> returnPages = atsWorkPage.getReturnPages();
- for (WorkPageDefinition toPageDef : toPages) {
- // Don't want to show return pages twice
- if (returnPages.contains(toPageDef)) {
- continue;
- }
- WorkPageShape toPageShape = getWorkPageShape(toPageDef);
- if (toPageDef.equals(atsWorkPage.getDefaultToPage())) {
- new DefaultTransitionConnection(pageShape, toPageShape);
- // System.out.println("Default: " + atsWorkPage.getName() + " -> " + toPageShape.getName());
- } else {
- new TransitionConnection(pageShape, toPageShape);
- // System.out.println("To: " + atsWorkPage.getName() + " -> " + toPageShape.getName());
- }
- }
- // Handle return pages
- for (WorkPageDefinition toPageDef : returnPages) {
- WorkPageShape toPageShape = getWorkPageShape(toPageDef);
- new ReturnTransitionConnection(pageShape, toPageShape);
- // System.out.println("Return: " + atsWorkPage.getName() + " -> " + toPageShape.getName());
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- } else {
- throw new IllegalStateException("Invalid editor input");
- }
-
- }
-
- private WorkPageShape getWorkPageShape(WorkPageDefinition page) {
- for (Object object : getModel().getChildren()) {
- if (object instanceof WorkPageShape) {
- if (((WorkPageShape) object).getId().equals(page.getId()) || (page.getParentId() != null && ((WorkPageShape) object).getId().equals(
- page.getParentId()))) {
- return (WorkPageShape) object;
- }
- }
- }
- return null;
- }
- /**
- * Creates an outline pagebook for this editor.
- */
- public class ShapesOutlinePage extends ContentOutlinePage {
- /**
- * Create a new outline page for the shapes editor.
- *
- * @param viewer a viewer (TreeViewer instance) used for this outline page
- * @throws OseeArgumentException if editor is null
- */
- public ShapesOutlinePage(EditPartViewer viewer) {
- super(viewer);
- }
-
- @Override
- public void createControl(Composite parent) {
- // create outline viewer page
- getViewer().createControl(parent);
- // configure outline viewer
- getViewer().setEditDomain(getEditDomain());
- getViewer().setEditPartFactory(new ShapesTreeEditPartFactory());
- // configure & add context menu to viewer
- ContextMenuProvider cmProvider =
- new AtsWorkflowConfigEditorContextMenuProvider(getViewer(), getActionRegistry());
- getViewer().setContextMenu(cmProvider);
- getSite().registerContextMenu("org.eclipse.osee.ats.config.editor.contextmenu", cmProvider,
- getSite().getSelectionProvider());
- // hook outline viewer
- getSelectionSynchronizer().addViewer(getViewer());
- // initialize outline viewer with model
- getViewer().setContents(getModel());
- // show outline viewer
- }
-
- @Override
- public void dispose() {
- // unhook outline viewer
- getSelectionSynchronizer().removeViewer(getViewer());
- // dispose
- super.dispose();
- }
-
- @Override
- public Control getControl() {
- return getViewer().getControl();
- }
-
- /**
- * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite)
- */
- @Override
- public void init(IPageSite pageSite) {
- super.init(pageSite);
- ActionRegistry registry = getActionRegistry();
- IActionBars bars = pageSite.getActionBars();
- String id = ActionFactory.UNDO.getId();
- bars.setGlobalActionHandler(id, registry.getAction(id));
- id = ActionFactory.REDO.getId();
- bars.setGlobalActionHandler(id, registry.getAction(id));
- id = ActionFactory.DELETE.getId();
- bars.setGlobalActionHandler(id, registry.getAction(id));
- }
- }
-
- public void closeEditor() {
- final IEditorPart editor = this;
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (AWorkbench.getActivePage() != null) {
- AWorkbench.getActivePage().closeEditor(editor, false);
- }
- }
- });
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
- if (transData.branchId != AtsUtil.getAtsBranch().getId()) {
- return;
- }
- for (Artifact delArt : transData.cacheDeletedArtifacts) {
- if (delArt.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
- if (delArt.getName().equals(getPartName())) {
- closeEditor();
- }
- }
- }
- System.out.println("Add refresh of editor if workflow mod");
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getWorkItemArtifactTypeEventFilter());
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- for (Artifact delArt : artifactEvent.getCacheArtifacts(EventModType.Deleted)) {
- if (delArt.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
- if (delArt.getName().equals(getPartName())) {
- closeEditor();
- }
- }
- }
- System.out.println("Add refresh of editor if workflow mod");
- }
-
+/*******************************************************************************
+ * 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.ats.workflow.editor;
+
+import java.util.Arrays;
+import java.util.EventObject;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.dnd.TemplateTransferDragSourceListener;
+import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
+import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.palette.PaletteViewer;
+import org.eclipse.gef.ui.palette.PaletteViewerProvider;
+import org.eclipse.gef.ui.parts.ContentOutlinePage;
+import org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette;
+import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
+import org.eclipse.gef.ui.parts.TreeViewer;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.util.TransferDropTargetListener;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.workflow.ATSXWidgetOptionResolver;
+import org.eclipse.osee.ats.workflow.AtsWorkPage;
+import org.eclipse.osee.ats.workflow.editor.actions.EditAction;
+import org.eclipse.osee.ats.workflow.editor.model.CancelledWorkPageShape;
+import org.eclipse.osee.ats.workflow.editor.model.CompletedWorkPageShape;
+import org.eclipse.osee.ats.workflow.editor.model.DefaultTransitionConnection;
+import org.eclipse.osee.ats.workflow.editor.model.ReturnTransitionConnection;
+import org.eclipse.osee.ats.workflow.editor.model.TransitionConnection;
+import org.eclipse.osee.ats.workflow.editor.model.WorkPageShape;
+import org.eclipse.osee.ats.workflow.editor.model.WorkflowDiagram;
+import org.eclipse.osee.ats.workflow.editor.parts.ShapesEditPartFactory;
+import org.eclipse.osee.ats.workflow.editor.parts.ShapesTreeEditPartFactory;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+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.EventModType;
+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.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * A graphical editor for the configuration of ATS workflows<br>
+ * <REM2>
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsWorkflowConfigEditor extends GraphicalEditorWithFlyoutPalette implements IArtifactEventListener, IFrameworkTransactionEventListener {
+
+ /** This is the root of the editor's model. */
+ private WorkflowDiagram diagram;
+ /** Palette component, holding the tools and shapes. */
+ private static PaletteRoot PALETTE_MODEL;
+ public static String EDITOR_ID = "org.eclipse.osee.ats.workflow.editor.AtsWorkflowConfigEditor";
+
+ /** Create a new ShapesEditor instance. This is called by the Workspace. */
+ public AtsWorkflowConfigEditor() {
+ setEditDomain(new DefaultEditDomain(this));
+ OseeEventManager.addListener(this);
+ }
+
+ /**
+ * Configure the graphical viewer before it receives contents.
+ * <p>
+ * This is the place to choose an appropriate RootEditPart and EditPartFactory for your editor. The RootEditPart
+ * determines the behavior of the editor's "work-area". For example, GEF includes zoomable and scrollable root edit
+ * parts. The EditPartFactory maps model elements to edit parts (controllers).
+ * </p>
+ *
+ * @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer()
+ */
+ @Override
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+
+ GraphicalViewer viewer = getGraphicalViewer();
+ viewer.setEditPartFactory(new ShapesEditPartFactory());
+ viewer.setRootEditPart(new ScalableFreeformRootEditPart());
+ viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
+
+ // configure the context menu provider
+ ContextMenuProvider cmProvider = new AtsWorkflowConfigEditorContextMenuProvider(viewer, getActionRegistry());
+ viewer.setContextMenu(cmProvider);
+ getSite().registerContextMenu(cmProvider, viewer);
+ AtsPlugin.getInstance().setHelp(viewer.getControl(), "atsConfigureWorkflow", "org.eclipse.osee.ats.help.ui");
+
+ }
+
+ @Override
+ public void commandStackChanged(EventObject event) {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ super.commandStackChanged(event);
+ }
+
+ @Override
+ protected PaletteViewerProvider createPaletteViewerProvider() {
+ return new PaletteViewerProvider(getEditDomain()) {
+ @Override
+ protected void configurePaletteViewer(PaletteViewer viewer) {
+ super.configurePaletteViewer(viewer);
+ // create a drag source listener for this palette viewer
+ // together with an appropriate transfer drop target listener, this will enable
+ // model element creation by dragging a CombinatedTemplateCreationEntries
+ // from the palette into the editor
+ // @see ShapesEditor#createTransferDropTargetListener()
+ viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));
+ }
+ };
+ }
+
+ /**
+ * Create a transfer drop target listener. When using a CombinedTemplateCreationEntry tool in the palette, this will
+ * enable model element creation by dragging from the palette.
+ *
+ * @see #createPaletteViewerProvider()
+ */
+ private TransferDropTargetListener createTransferDropTargetListener() {
+ return new TemplateTransferDropTargetListener(getGraphicalViewer()) {
+ @Override
+ protected CreationFactory getFactory(Object template) {
+ return new SimpleFactory((Class<?>) template);
+ }
+ };
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "ATS Configuration Editor Save");
+ Result result = diagram.doSave(transaction);
+ if (result.isFalse()) {
+ AWorkbench.popup("Save Error", result.getText());
+ return;
+ }
+ transaction.execute();
+ diagram.getWorkFlowDefinition().loadPageData(true);
+ getCommandStack().markSaveLocation();
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public void doSaveAs() {
+ AWorkbench.popup("ERROR", "Not implemented yet");
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class type) {
+ if (type == IContentOutlinePage.class) {
+ return new ShapesOutlinePage(new TreeViewer());
+ }
+ return super.getAdapter(type);
+ }
+
+ WorkflowDiagram getModel() {
+ return diagram;
+ }
+
+ @Override
+ protected PaletteRoot getPaletteRoot() {
+ if (PALETTE_MODEL == null) {
+ PALETTE_MODEL = AtsWorkflowConfigEditorPaletteFactory.createPalette(this);
+ }
+ return PALETTE_MODEL;
+ }
+
+ /**
+ * Set up the editor's inital content (after creation).
+ *
+ * @see org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette#initializeGraphicalViewer()
+ */
+ @Override
+ protected void initializeGraphicalViewer() {
+ super.initializeGraphicalViewer();
+ GraphicalViewer viewer = getGraphicalViewer();
+ viewer.setContents(getModel()); // set the contents of this editor
+
+ // listen for dropped parts
+ viewer.addDropTargetListener(createTransferDropTargetListener());
+ createActions();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void createActions() {
+ super.createActions();
+ ActionRegistry registry = getActionRegistry();
+ IAction action;
+
+ action = new EditAction();
+ registry.registerAction(action);
+ getStackActions().add(action.getId());
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ @Override
+ protected void setInput(IEditorInput input) {
+ super.setInput(input);
+ if (input instanceof AtsWorkflowConfigEditorInput) {
+ AtsWorkflowConfigEditorInput editorInput = (AtsWorkflowConfigEditorInput) input;
+ WorkFlowDefinition workflowDef = editorInput.workflow;
+ try {
+ setPartName(workflowDef.getName());
+ diagram = new WorkflowDiagram(workflowDef);
+ int yLoc = 0;
+ WorkPageDefinition startPage = workflowDef.getStartPage();
+ if (startPage == null || startPage.getName().equals("")) {
+ throw new OseeArgumentException("StartPage null for workflow " + workflowDef);
+ }
+ // Create states
+ List<WorkPageDefinition> pages = workflowDef.getPagesOrdered();
+ for (WorkPageDefinition page : workflowDef.getPages()) {
+ if (!pages.contains(page)) {
+ pages.add(page);
+ }
+ }
+ for (WorkPageDefinition pageDef : pages) {
+ WorkPageShape pageShape = null;
+ if (pageDef.isCancelledPage()) {
+ pageShape = new CancelledWorkPageShape(pageDef);
+ pageShape.setLocation(new Point(250, 300));
+ } else if (pageDef.isCompletePage()) {
+ pageShape = new CompletedWorkPageShape(pageDef);
+ pageShape.setLocation(new Point(50, yLoc += 90));
+ } else {
+ pageShape = new WorkPageShape(pageDef);
+ pageShape.setLocation(new Point(50, yLoc += 90));
+ }
+ pageShape.setStartPage(startPage.getId().equals(pageShape.getId()) || pageShape.getId().endsWith(
+ startPage.getId()));
+ diagram.addChild(pageShape);
+ }
+
+ // Create transitions
+ for (WorkPageDefinition workPageDefinition : workflowDef.getPagesOrdered()) {
+ WorkPageShape pageShape = getWorkPageShape(workPageDefinition);
+ AtsWorkPage atsWorkPage =
+ new AtsWorkPage(workflowDef, workPageDefinition, null, ATSXWidgetOptionResolver.getInstance());
+ // Handle to pages
+ Set<WorkPageDefinition> toPages = new HashSet<WorkPageDefinition>();
+ toPages.addAll(atsWorkPage.getToPages());
+ List<WorkPageDefinition> returnPages = atsWorkPage.getReturnPages();
+ for (WorkPageDefinition toPageDef : toPages) {
+ // Don't want to show return pages twice
+ if (returnPages.contains(toPageDef)) {
+ continue;
+ }
+ WorkPageShape toPageShape = getWorkPageShape(toPageDef);
+ if (toPageDef.equals(atsWorkPage.getDefaultToPage())) {
+ new DefaultTransitionConnection(pageShape, toPageShape);
+ // System.out.println("Default: " + atsWorkPage.getName() + " -> " + toPageShape.getName());
+ } else {
+ new TransitionConnection(pageShape, toPageShape);
+ // System.out.println("To: " + atsWorkPage.getName() + " -> " + toPageShape.getName());
+ }
+ }
+ // Handle return pages
+ for (WorkPageDefinition toPageDef : returnPages) {
+ WorkPageShape toPageShape = getWorkPageShape(toPageDef);
+ new ReturnTransitionConnection(pageShape, toPageShape);
+ // System.out.println("Return: " + atsWorkPage.getName() + " -> " + toPageShape.getName());
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ } else {
+ throw new IllegalStateException("Invalid editor input");
+ }
+
+ }
+
+ private WorkPageShape getWorkPageShape(WorkPageDefinition page) {
+ for (Object object : getModel().getChildren()) {
+ if (object instanceof WorkPageShape) {
+ if (((WorkPageShape) object).getId().equals(page.getId()) || (page.getParentId() != null && ((WorkPageShape) object).getId().equals(
+ page.getParentId()))) {
+ return (WorkPageShape) object;
+ }
+ }
+ }
+ return null;
+ }
+ /**
+ * Creates an outline pagebook for this editor.
+ */
+ public class ShapesOutlinePage extends ContentOutlinePage {
+ /**
+ * Create a new outline page for the shapes editor.
+ *
+ * @param viewer a viewer (TreeViewer instance) used for this outline page
+ * @throws OseeArgumentException if editor is null
+ */
+ public ShapesOutlinePage(EditPartViewer viewer) {
+ super(viewer);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ // create outline viewer page
+ getViewer().createControl(parent);
+ // configure outline viewer
+ getViewer().setEditDomain(getEditDomain());
+ getViewer().setEditPartFactory(new ShapesTreeEditPartFactory());
+ // configure & add context menu to viewer
+ ContextMenuProvider cmProvider =
+ new AtsWorkflowConfigEditorContextMenuProvider(getViewer(), getActionRegistry());
+ getViewer().setContextMenu(cmProvider);
+ getSite().registerContextMenu("org.eclipse.osee.ats.config.editor.contextmenu", cmProvider,
+ getSite().getSelectionProvider());
+ // hook outline viewer
+ getSelectionSynchronizer().addViewer(getViewer());
+ // initialize outline viewer with model
+ getViewer().setContents(getModel());
+ // show outline viewer
+ }
+
+ @Override
+ public void dispose() {
+ // unhook outline viewer
+ getSelectionSynchronizer().removeViewer(getViewer());
+ // dispose
+ super.dispose();
+ }
+
+ @Override
+ public Control getControl() {
+ return getViewer().getControl();
+ }
+
+ /**
+ * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite)
+ */
+ @Override
+ public void init(IPageSite pageSite) {
+ super.init(pageSite);
+ ActionRegistry registry = getActionRegistry();
+ IActionBars bars = pageSite.getActionBars();
+ String id = ActionFactory.UNDO.getId();
+ bars.setGlobalActionHandler(id, registry.getAction(id));
+ id = ActionFactory.REDO.getId();
+ bars.setGlobalActionHandler(id, registry.getAction(id));
+ id = ActionFactory.DELETE.getId();
+ bars.setGlobalActionHandler(id, registry.getAction(id));
+ }
+ }
+
+ public void closeEditor() {
+ final IEditorPart editor = this;
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (AWorkbench.getActivePage() != null) {
+ AWorkbench.getActivePage().closeEditor(editor, false);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
+ if (transData.branchId != AtsUtil.getAtsBranch().getId()) {
+ return;
+ }
+ for (Artifact delArt : transData.cacheDeletedArtifacts) {
+ if (delArt.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
+ if (delArt.getName().equals(getPartName())) {
+ closeEditor();
+ }
+ }
+ }
+ System.out.println("Add refresh of editor if workflow mod");
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return Arrays.asList(OseeEventManager.getCommonBranchFilter(), AtsUtil.getWorkItemArtifactTypeEventFilter());
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ for (Artifact delArt : artifactEvent.getCacheArtifacts(EventModType.Deleted)) {
+ if (delArt.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
+ if (delArt.getName().equals(getPartName())) {
+ closeEditor();
+ }
+ }
+ }
+ System.out.println("Add refresh of editor if workflow mod");
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditorInput.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditorInput.java
index 098f2219293..bc62ccad106 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditorInput.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditorInput.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * 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.ats.workflow.editor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsWorkflowConfigEditorInput implements IEditorInput {
- protected WorkFlowDefinition workflow;
-
- public AtsWorkflowConfigEditorInput(WorkFlowDefinition workflow) {
- this.workflow = workflow;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof AtsWorkflowConfigEditorInput) {
- AtsWorkflowConfigEditorInput otherEdInput = (AtsWorkflowConfigEditorInput) obj;
- return workflow.getId().equals(otherEdInput.workflow.getId());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return workflow.getId().hashCode();
- }
-
- public boolean exists() {
- return true;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public String getName() {
- if (workflow == null) {
- return "No Artifact Input Provided";
- }
- return workflow.getName();
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getToolTipText() {
- return getName();
- }
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- return 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.ats.workflow.editor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsWorkflowConfigEditorInput implements IEditorInput {
+ protected WorkFlowDefinition workflow;
+
+ public AtsWorkflowConfigEditorInput(WorkFlowDefinition workflow) {
+ this.workflow = workflow;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof AtsWorkflowConfigEditorInput) {
+ AtsWorkflowConfigEditorInput otherEdInput = (AtsWorkflowConfigEditorInput) obj;
+ return workflow.getId().equals(otherEdInput.workflow.getId());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return workflow.getId().hashCode();
+ }
+
+ public boolean exists() {
+ return true;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public String getName() {
+ if (workflow == null) {
+ return "No Artifact Input Provided";
+ }
+ return workflow.getName();
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public String getToolTipText() {
+ return getName();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/EditAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/EditAction.java
index cd0eb5f88f5..b572cfee1ac 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/EditAction.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/EditAction.java
@@ -1,101 +1,101 @@
-/*******************************************************************************
- * 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.ats.workflow.editor.actions;
-
-import java.util.Iterator;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.workflow.editor.model.WorkPageShape;
-import org.eclipse.osee.ats.workflow.editor.model.WorkflowDiagram;
-import org.eclipse.osee.ats.workflow.editor.parts.DiagramEditPart;
-import org.eclipse.osee.ats.workflow.editor.parts.WorkPageEditPart;
-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.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class EditAction extends Action {
-
- public static String ID = "osee.ats.workflowConfigEdit.edit";
-
- public EditAction() {
- super("Edit");
- }
-
- @Override
- public String getId() {
- return ID;
- }
-
- @Override
- public void run() {
- ISelectionProvider selectionProvider =
+/*******************************************************************************
+ * 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.ats.workflow.editor.actions;
+
+import java.util.Iterator;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.workflow.editor.model.WorkPageShape;
+import org.eclipse.osee.ats.workflow.editor.model.WorkflowDiagram;
+import org.eclipse.osee.ats.workflow.editor.parts.DiagramEditPart;
+import org.eclipse.osee.ats.workflow.editor.parts.WorkPageEditPart;
+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.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class EditAction extends Action {
+
+ public static String ID = "osee.ats.workflowConfigEdit.edit";
+
+ public EditAction() {
+ super("Edit");
+ }
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+
+ @Override
+ public void run() {
+ ISelectionProvider selectionProvider =
AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
-
- try {
- Iterator<?> i = structuredSelection.iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof DiagramEditPart) {
- if (((DiagramEditPart) obj).getModel() instanceof WorkflowDiagram) {
- WorkflowDiagram diagram = (WorkflowDiagram) ((DiagramEditPart) obj).getModel();
- Artifact artifact = null;
- if (diagram.getWorkFlowDefinition() != null) {
- WorkFlowDefinition def = diagram.getWorkFlowDefinition();
- artifact = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(def.getId());
- }
- if (artifact != null) {
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+
+ try {
+ Iterator<?> i = structuredSelection.iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof DiagramEditPart) {
+ if (((DiagramEditPart) obj).getModel() instanceof WorkflowDiagram) {
+ WorkflowDiagram diagram = (WorkflowDiagram) ((DiagramEditPart) obj).getModel();
+ Artifact artifact = null;
+ if (diagram.getWorkFlowDefinition() != null) {
+ WorkFlowDefinition def = diagram.getWorkFlowDefinition();
+ artifact = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(def.getId());
+ }
+ if (artifact != null) {
RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
- return;
- }
- }
- }
- if (obj instanceof WorkPageEditPart) {
- if (((WorkPageEditPart) obj).getModel() instanceof WorkPageShape) {
- WorkPageShape shape = (WorkPageShape) ((WorkPageEditPart) obj).getModel();
- Artifact artifact = null;
- if (shape.getWorkPageDefinition() != null) {
- WorkPageDefinition def = shape.getWorkPageDefinition();
- artifact = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(def.getId());
- } else {
- String id = shape.getId();
- artifact = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(id);
+ return;
+ }
+ }
+ }
+ if (obj instanceof WorkPageEditPart) {
+ if (((WorkPageEditPart) obj).getModel() instanceof WorkPageShape) {
+ WorkPageShape shape = (WorkPageShape) ((WorkPageEditPart) obj).getModel();
+ Artifact artifact = null;
+ if (shape.getWorkPageDefinition() != null) {
+ WorkPageDefinition def = shape.getWorkPageDefinition();
+ artifact = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(def.getId());
+ } else {
+ String id = shape.getId();
+ artifact = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(id);
RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
- return;
- }
- if (artifact != null) {
+ return;
+ }
+ if (artifact != null) {
RendererManager.open(artifact, PresentationType.GENERALIZED_EDIT);
- return;
- }
- }
- }
- }
- AWorkbench.popup("ERROR", "Can't locate corresponding artifact");
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
-}
+ return;
+ }
+ }
+ }
+ }
+ AWorkbench.popup("ERROR", "Can't locate corresponding artifact");
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramTool.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramTool.java
index 1fa6b330d9d..8f95e116317 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramTool.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramTool.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * 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.ats.workflow.editor.actions;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.SharedCursors;
-import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
-import org.eclipse.gef.tools.SelectionTool;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.workflow.editor.model.ModelElement;
-import org.eclipse.osee.ats.workflow.editor.parts.DiagramEditPart;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.swt.events.MouseEvent;
-
-/**
- * @author Donald G. Dunne
- */
-public class ValidateDiagramTool extends SelectionTool {
-
- public ValidateDiagramTool() {
- setDefaultCursor(SharedCursors.ARROW);
- }
-
- @Override
- public void mouseDown(MouseEvent e, EditPartViewer viewer) {
- super.mouseDown(e, viewer);
- try {
- EditPart editPart = getTargetEditPart();
- Object model = editPart.getModel();
- if (editPart instanceof ScalableFreeformRootEditPart) {
- EditPart ePart = ((ScalableFreeformRootEditPart) editPart).getContents();
- if (ePart instanceof DiagramEditPart) {
- model = ((DiagramEditPart) ePart).getModel();
- }
- }
- if (model instanceof ModelElement) {
- Result result = ((ModelElement) model).validForSave();
- if (result.isFalse()) {
- AWorkbench.popup("Validate Error", model + "\n\n" + "Error: " + result.getText());
- } else {
- AWorkbench.popup("Validate Success", model + "\n\n" + "Valid");
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.actions;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.SharedCursors;
+import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
+import org.eclipse.gef.tools.SelectionTool;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.workflow.editor.model.ModelElement;
+import org.eclipse.osee.ats.workflow.editor.parts.DiagramEditPart;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.swt.events.MouseEvent;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ValidateDiagramTool extends SelectionTool {
+
+ public ValidateDiagramTool() {
+ setDefaultCursor(SharedCursors.ARROW);
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e, EditPartViewer viewer) {
+ super.mouseDown(e, viewer);
+ try {
+ EditPart editPart = getTargetEditPart();
+ Object model = editPart.getModel();
+ if (editPart instanceof ScalableFreeformRootEditPart) {
+ EditPart ePart = ((ScalableFreeformRootEditPart) editPart).getContents();
+ if (ePart instanceof DiagramEditPart) {
+ model = ((DiagramEditPart) ePart).getModel();
+ }
+ }
+ if (model instanceof ModelElement) {
+ Result result = ((ModelElement) model).validForSave();
+ if (result.isFalse()) {
+ AWorkbench.popup("Validate Error", model + "\n\n" + "Error: " + result.getText());
+ } else {
+ AWorkbench.popup("Validate Success", model + "\n\n" + "Valid");
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramToolEntry.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramToolEntry.java
index 470f148c604..50091e6ad7a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramToolEntry.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/actions/ValidateDiagramToolEntry.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * 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.ats.workflow.editor.actions;
-
-import org.eclipse.gef.palette.ToolEntry;
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class ValidateDiagramToolEntry extends ToolEntry {
-
- /**
- * @param label
- * @param shortDesc
- * @param iconSmall
- * @param iconLarge
- */
- public ValidateDiagramToolEntry() {
- super("Validate Diagram", "Validate", ImageManager.getImageDescriptor(AtsImage.CHECK_BLUE),
- ImageManager.getImageDescriptor(AtsImage.CHECK_BLUE), ValidateDiagramTool.class);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.actions;
+
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ValidateDiagramToolEntry extends ToolEntry {
+
+ /**
+ * @param label
+ * @param shortDesc
+ * @param iconSmall
+ * @param iconLarge
+ */
+ public ValidateDiagramToolEntry() {
+ super("Validate Diagram", "Validate", ImageManager.getImageDescriptor(AtsImage.CHECK_BLUE),
+ ImageManager.getImageDescriptor(AtsImage.CHECK_BLUE), ValidateDiagramTool.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CancelledWorkPageShape.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CancelledWorkPageShape.java
index 346873c7f0c..65b45b100c3 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CancelledWorkPageShape.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CancelledWorkPageShape.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * 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.ats.workflow.editor.model;
-
-import java.util.logging.Level;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class CancelledWorkPageShape extends WorkPageShape {
-
- /**
- * @param workPageDefinition
- */
- public CancelledWorkPageShape(WorkPageDefinition workPageDefinition) {
- super(workPageDefinition);
- }
-
- public CancelledWorkPageShape() {
- super(new WorkPageDefinition("Cancelled", "NEW", AtsCancelledWorkPageDefinition.ID));
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof WorkPageShape) {
- try {
- return ((WorkPageShape) obj).isCancelledState();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- return super.equals(obj);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.model;
+
+import java.util.logging.Level;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CancelledWorkPageShape extends WorkPageShape {
+
+ /**
+ * @param workPageDefinition
+ */
+ public CancelledWorkPageShape(WorkPageDefinition workPageDefinition) {
+ super(workPageDefinition);
+ }
+
+ public CancelledWorkPageShape() {
+ super(new WorkPageDefinition("Cancelled", "NEW", AtsCancelledWorkPageDefinition.ID));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof WorkPageShape) {
+ try {
+ return ((WorkPageShape) obj).isCancelledState();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return super.equals(obj);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CompletedWorkPageShape.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CompletedWorkPageShape.java
index 04fdb782fe1..2cc6e3c089c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CompletedWorkPageShape.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/CompletedWorkPageShape.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * 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.ats.workflow.editor.model;
-
-import java.util.logging.Level;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class CompletedWorkPageShape extends WorkPageShape {
-
- public CompletedWorkPageShape() {
- super(new WorkPageDefinition("Completed", "NEW", AtsCompletedWorkPageDefinition.ID));
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof WorkPageShape) {
- try {
- return ((WorkPageShape) obj).isCompletedState();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- return super.equals(obj);
- }
-
- /**
- * @param workPageDefinition
- */
- public CompletedWorkPageShape(WorkPageDefinition workPageDefinition) {
- super(workPageDefinition);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.model;
+
+import java.util.logging.Level;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CompletedWorkPageShape extends WorkPageShape {
+
+ public CompletedWorkPageShape() {
+ super(new WorkPageDefinition("Completed", "NEW", AtsCompletedWorkPageDefinition.ID));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof WorkPageShape) {
+ try {
+ return ((WorkPageShape) obj).isCompletedState();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @param workPageDefinition
+ */
+ public CompletedWorkPageShape(WorkPageDefinition workPageDefinition) {
+ super(workPageDefinition);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/DefaultTransitionConnection.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/DefaultTransitionConnection.java
index 81f36666783..85f4c659ab7 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/DefaultTransitionConnection.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/DefaultTransitionConnection.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * 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.ats.workflow.editor.model;
-
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @author Donald G. Dunne
- */
-public class DefaultTransitionConnection extends TransitionConnection {
-
- /**
- * @param source
- * @param target
- */
- public DefaultTransitionConnection(Shape source, Shape target) {
- super(source, target);
- }
-
- @Override
- public Color getForegroundColor() {
- return Displays.getSystemColor(SWT.COLOR_DARK_GREEN);
- }
-
- @Override
- public int getLineWidth() {
- return 3;
- }
-
- @Override
- public String getLabel() {
- return "Default Transition";
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.model;
+
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DefaultTransitionConnection extends TransitionConnection {
+
+ /**
+ * @param source
+ * @param target
+ */
+ public DefaultTransitionConnection(Shape source, Shape target) {
+ super(source, target);
+ }
+
+ @Override
+ public Color getForegroundColor() {
+ return Displays.getSystemColor(SWT.COLOR_DARK_GREEN);
+ }
+
+ @Override
+ public int getLineWidth() {
+ return 3;
+ }
+
+ @Override
+ public String getLabel() {
+ return "Default Transition";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/ReturnTransitionConnection.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/ReturnTransitionConnection.java
index e5347b6f9e6..26e4279f547 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/ReturnTransitionConnection.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/model/ReturnTransitionConnection.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * 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.ats.workflow.editor.model;
-
-import org.eclipse.draw2d.Graphics;
-
-/**
- * @author Donald G. Dunne
- */
-public class ReturnTransitionConnection extends TransitionConnection {
-
- /**
- * @param source
- * @param target
- */
- public ReturnTransitionConnection(Shape source, Shape target) {
- super(source, target);
- }
-
- @Override
- public int getLineStyle() {
- return Graphics.LINE_DASH;
- }
-
- @Override
- public String getLabel() {
- return "Return Transition";
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.model;
+
+import org.eclipse.draw2d.Graphics;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ReturnTransitionConnection extends TransitionConnection {
+
+ /**
+ * @param source
+ * @param target
+ */
+ public ReturnTransitionConnection(Shape source, Shape target) {
+ super(source, target);
+ }
+
+ @Override
+ public int getLineStyle() {
+ return Graphics.LINE_DASH;
+ }
+
+ @Override
+ public String getLabel() {
+ return "Return Transition";
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/LeftAnchor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/LeftAnchor.java
index 00a6a10c8e5..3c11f50179e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/LeftAnchor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/LeftAnchor.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.workflow.editor.parts;
-
-import org.eclipse.draw2d.ChopboxAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-/**
- * @author Donald G. Dunne
- */
-class LeftAnchor extends ChopboxAnchor {
-
- LeftAnchor(IFigure source) {
- super(source);
- }
-
- @Override
- public Point getLocation(Point reference) {
- Rectangle r = getOwner().getBounds().getCopy();
- getOwner().translateToAbsolute(r);
- return r.getLeft();
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.parts;
+
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author Donald G. Dunne
+ */
+class LeftAnchor extends ChopboxAnchor {
+
+ LeftAnchor(IFigure source) {
+ super(source);
+ }
+
+ @Override
+ public Point getLocation(Point reference) {
+ Rectangle r = getOwner().getBounds().getCopy();
+ getOwner().translateToAbsolute(r);
+ return r.getLeft();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/RightAnchor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/RightAnchor.java
index 27672bcc3cd..d9ad5597109 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/RightAnchor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/RightAnchor.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.workflow.editor.parts;
-
-import org.eclipse.draw2d.ChopboxAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-/**
- * @author Donald G. Dunne
- */
-class RightAnchor extends ChopboxAnchor {
-
- RightAnchor(IFigure source) {
- super(source);
- }
-
- @Override
- public Point getLocation(Point reference) {
- Rectangle r = getOwner().getBounds().getCopy();
- getOwner().translateToAbsolute(r);
- return r.getRight();
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.parts;
+
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author Donald G. Dunne
+ */
+class RightAnchor extends ChopboxAnchor {
+
+ RightAnchor(IFigure source) {
+ super(source);
+ }
+
+ @Override
+ public Point getLocation(Point reference) {
+ Rectangle r = getOwner().getBounds().getCopy();
+ getOwner().translateToAbsolute(r);
+ return r.getRight();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/WorkPageEditPart.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/WorkPageEditPart.java
index cf76a80bf46..85ce8d6d235 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/WorkPageEditPart.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/parts/WorkPageEditPart.java
@@ -1,130 +1,130 @@
-/*******************************************************************************
- * 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.ats.workflow.editor.parts;
-
-import java.beans.PropertyChangeEvent;
-import java.util.logging.Level;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.GridLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.SelectionRequest;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.workflow.editor.actions.EditAction;
-import org.eclipse.osee.ats.workflow.editor.model.ReturnTransitionConnection;
-import org.eclipse.osee.ats.workflow.editor.model.WorkPageShape;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemAttributes;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkPageEditPart extends ShapeEditPart {
-
- private final WorkPageShape workPageShape;
- private RightAnchor returnAnchor;
- private Label label;
-
- public WorkPageEditPart(WorkPageShape workPageShape) {
- this.workPageShape = workPageShape;
- }
-
- @Override
- protected IFigure createFigure() {
- IFigure f = super.createFigure();
- f.setLayoutManager(new GridLayout());
- try {
- if (workPageShape.isCompletedState()) {
- f.setBackgroundColor(ColorConstants.darkGreen);
- } else if (workPageShape.isCancelledState()) {
- f.setBackgroundColor(ColorConstants.lightGray);
- } else if (workPageShape.isStartPage()) {
- f.setBackgroundColor(ColorConstants.yellow);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- label = new Label(workPageShape.getName());
- f.add(label);
- f.setToolTip(new Label(workPageShape.getToolTip()));
- return f;
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- label.setText(workPageShape.getName());
- }
-
- @Override
- public void performRequest(Request req) {
- super.performRequest(req);
- System.out.println(req);
- if (req instanceof SelectionRequest) {
- (new EditAction()).run();
- }
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- super.propertyChange(evt);
- String prop = evt.getPropertyName();
- if (WorkPageShape.START_PAGE.equals(prop)) {
- if (workPageShape.isStartPage()) {
- getFigure().setBackgroundColor(ColorConstants.yellow);
- } else {
- getFigure().setBackgroundColor(ColorConstants.green);
- }
- }
- if (WorkItemAttributes.WORK_PAGE_NAME.getAttributeTypeName().equals(prop)) {
- refreshVisuals();
- }
- }
-
- @Override
- public ConnectionAnchor getTargetConnectionAnchor(Request request) {
- // TODO implement sending back returnAnchor if appropriate
- return super.getTargetConnectionAnchor(request);
- }
-
- @Override
- public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
- if (connection.getModel() instanceof ReturnTransitionConnection) {
- if (returnAnchor == null) {
- returnAnchor = new RightAnchor(getFigure());
- }
- return returnAnchor;
- }
- return super.getTargetConnectionAnchor(connection);
- }
-
- @Override
- public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
- if (connection.getModel() instanceof ReturnTransitionConnection) {
- if (returnAnchor == null) {
- returnAnchor = new RightAnchor(getFigure());
- }
- return returnAnchor;
- }
- return super.getTargetConnectionAnchor(connection);
- }
-
- @Override
- public ConnectionAnchor getSourceConnectionAnchor(Request request) {
- // TODO implement sending back returnAnchor if appropriate
- return super.getSourceConnectionAnchor(request);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.editor.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.util.logging.Level;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.GridLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.workflow.editor.actions.EditAction;
+import org.eclipse.osee.ats.workflow.editor.model.ReturnTransitionConnection;
+import org.eclipse.osee.ats.workflow.editor.model.WorkPageShape;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemAttributes;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkPageEditPart extends ShapeEditPart {
+
+ private final WorkPageShape workPageShape;
+ private RightAnchor returnAnchor;
+ private Label label;
+
+ public WorkPageEditPart(WorkPageShape workPageShape) {
+ this.workPageShape = workPageShape;
+ }
+
+ @Override
+ protected IFigure createFigure() {
+ IFigure f = super.createFigure();
+ f.setLayoutManager(new GridLayout());
+ try {
+ if (workPageShape.isCompletedState()) {
+ f.setBackgroundColor(ColorConstants.darkGreen);
+ } else if (workPageShape.isCancelledState()) {
+ f.setBackgroundColor(ColorConstants.lightGray);
+ } else if (workPageShape.isStartPage()) {
+ f.setBackgroundColor(ColorConstants.yellow);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ label = new Label(workPageShape.getName());
+ f.add(label);
+ f.setToolTip(new Label(workPageShape.getToolTip()));
+ return f;
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ label.setText(workPageShape.getName());
+ }
+
+ @Override
+ public void performRequest(Request req) {
+ super.performRequest(req);
+ System.out.println(req);
+ if (req instanceof SelectionRequest) {
+ (new EditAction()).run();
+ }
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ super.propertyChange(evt);
+ String prop = evt.getPropertyName();
+ if (WorkPageShape.START_PAGE.equals(prop)) {
+ if (workPageShape.isStartPage()) {
+ getFigure().setBackgroundColor(ColorConstants.yellow);
+ } else {
+ getFigure().setBackgroundColor(ColorConstants.green);
+ }
+ }
+ if (WorkItemAttributes.WORK_PAGE_NAME.getAttributeTypeName().equals(prop)) {
+ refreshVisuals();
+ }
+ }
+
+ @Override
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ // TODO implement sending back returnAnchor if appropriate
+ return super.getTargetConnectionAnchor(request);
+ }
+
+ @Override
+ public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
+ if (connection.getModel() instanceof ReturnTransitionConnection) {
+ if (returnAnchor == null) {
+ returnAnchor = new RightAnchor(getFigure());
+ }
+ return returnAnchor;
+ }
+ return super.getTargetConnectionAnchor(connection);
+ }
+
+ @Override
+ public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
+ if (connection.getModel() instanceof ReturnTransitionConnection) {
+ if (returnAnchor == null) {
+ returnAnchor = new RightAnchor(getFigure());
+ }
+ return returnAnchor;
+ }
+ return super.getTargetConnectionAnchor(connection);
+ }
+
+ @Override
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ // TODO implement sending back returnAnchor if appropriate
+ return super.getSourceConnectionAnchor(request);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/DecisionWorkflowDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/DecisionWorkflowDefinition.java
index e44814efcbd..98504622c78 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/DecisionWorkflowDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/DecisionWorkflowDefinition.java
@@ -1,108 +1,108 @@
-/*******************************************************************************
- * 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.ats.workflow.flow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.item.AtsStatePercentCompleteWeightDecisionReviewRule;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsDecisionCompletedWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsDecisionDecisionWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsDecisionFollowupWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsDecisionPrepareWorkPageDefinition;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class DecisionWorkflowDefinition extends WorkFlowDefinition {
-
- public static String ID = "osee.ats.decisionReview";
- public static String DECISION_CANCELLED_STATE_ID = ID + "." + DefaultTeamState.Cancelled.name();
-
- public DecisionWorkflowDefinition() {
- super(ID, ID, null);
- addTransitions();
- startPageId = AtsDecisionPrepareWorkPageDefinition.ID;
- addWorkItem(AtsStatePercentCompleteWeightDecisionReviewRule.ID);
- }
-
- public DecisionWorkflowDefinition(Artifact artifact) throws OseeCoreException {
- super(artifact);
- throw new OseeStateException("This constructor should never be used.");
- }
-
- public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
- AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
- }
-
- public static List<WorkItemDefinition> getAtsWorkDefinitions() {
- List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
-
- // Add Decision Pages and Workflow Definition
- workItems.add(new AtsDecisionPrepareWorkPageDefinition());
- workItems.add(new AtsDecisionDecisionWorkPageDefinition());
- workItems.add(new AtsDecisionFollowupWorkPageDefinition());
- workItems.add(new AtsDecisionCompletedWorkPageDefinition());
- workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(),
- DecisionWorkflowDefinition.DECISION_CANCELLED_STATE_ID, AtsCancelledWorkPageDefinition.ID));
- workItems.add(new DecisionWorkflowDefinition());
-
- return workItems;
- }
-
- private void addTransitions() {
- // Add Prepare Transitions
- addPageTransition(AtsDecisionPrepareWorkPageDefinition.ID, AtsDecisionDecisionWorkPageDefinition.ID,
- TransitionType.ToPageAsDefault);
- addPageTransitionToPageAndReturn(AtsDecisionPrepareWorkPageDefinition.ID, DECISION_CANCELLED_STATE_ID);
-
- // Add Decision Transitions
- addPageTransition(AtsDecisionDecisionWorkPageDefinition.ID, AtsDecisionCompletedWorkPageDefinition.ID,
- TransitionType.ToPageAsDefault);
- addPageTransition(AtsDecisionDecisionWorkPageDefinition.ID, AtsDecisionFollowupWorkPageDefinition.ID,
- TransitionType.ToPage);
- addPageTransition(AtsDecisionDecisionWorkPageDefinition.ID, AtsDecisionPrepareWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
- addPageTransitionToPageAndReturn(AtsDecisionDecisionWorkPageDefinition.ID, DECISION_CANCELLED_STATE_ID);
-
- // Add Followup Transitions
- addPageTransition(AtsDecisionFollowupWorkPageDefinition.ID, AtsDecisionDecisionWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
- addPageTransition(AtsDecisionFollowupWorkPageDefinition.ID, AtsDecisionCompletedWorkPageDefinition.ID,
- TransitionType.ToPageAsDefault);
- addPageTransitionToPageAndReturn(AtsDecisionFollowupWorkPageDefinition.ID, DECISION_CANCELLED_STATE_ID);
-
- // Add Completed Transitions
- addPageTransition(AtsDecisionCompletedWorkPageDefinition.ID, AtsDecisionDecisionWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
- addPageTransition(AtsDecisionCompletedWorkPageDefinition.ID, AtsDecisionFollowupWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
-
- // Add Cancelled Transitions
- addPageTransition(DECISION_CANCELLED_STATE_ID, AtsDecisionPrepareWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
- addPageTransition(DECISION_CANCELLED_STATE_ID, AtsDecisionDecisionWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
- addPageTransition(DECISION_CANCELLED_STATE_ID, AtsDecisionFollowupWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
-
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.flow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.item.AtsStatePercentCompleteWeightDecisionReviewRule;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsDecisionCompletedWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsDecisionDecisionWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsDecisionFollowupWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsDecisionPrepareWorkPageDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DecisionWorkflowDefinition extends WorkFlowDefinition {
+
+ public static String ID = "osee.ats.decisionReview";
+ public static String DECISION_CANCELLED_STATE_ID = ID + "." + DefaultTeamState.Cancelled.name();
+
+ public DecisionWorkflowDefinition() {
+ super(ID, ID, null);
+ addTransitions();
+ startPageId = AtsDecisionPrepareWorkPageDefinition.ID;
+ addWorkItem(AtsStatePercentCompleteWeightDecisionReviewRule.ID);
+ }
+
+ public DecisionWorkflowDefinition(Artifact artifact) throws OseeCoreException {
+ super(artifact);
+ throw new OseeStateException("This constructor should never be used.");
+ }
+
+ public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
+ AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
+ }
+
+ public static List<WorkItemDefinition> getAtsWorkDefinitions() {
+ List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
+
+ // Add Decision Pages and Workflow Definition
+ workItems.add(new AtsDecisionPrepareWorkPageDefinition());
+ workItems.add(new AtsDecisionDecisionWorkPageDefinition());
+ workItems.add(new AtsDecisionFollowupWorkPageDefinition());
+ workItems.add(new AtsDecisionCompletedWorkPageDefinition());
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(),
+ DecisionWorkflowDefinition.DECISION_CANCELLED_STATE_ID, AtsCancelledWorkPageDefinition.ID));
+ workItems.add(new DecisionWorkflowDefinition());
+
+ return workItems;
+ }
+
+ private void addTransitions() {
+ // Add Prepare Transitions
+ addPageTransition(AtsDecisionPrepareWorkPageDefinition.ID, AtsDecisionDecisionWorkPageDefinition.ID,
+ TransitionType.ToPageAsDefault);
+ addPageTransitionToPageAndReturn(AtsDecisionPrepareWorkPageDefinition.ID, DECISION_CANCELLED_STATE_ID);
+
+ // Add Decision Transitions
+ addPageTransition(AtsDecisionDecisionWorkPageDefinition.ID, AtsDecisionCompletedWorkPageDefinition.ID,
+ TransitionType.ToPageAsDefault);
+ addPageTransition(AtsDecisionDecisionWorkPageDefinition.ID, AtsDecisionFollowupWorkPageDefinition.ID,
+ TransitionType.ToPage);
+ addPageTransition(AtsDecisionDecisionWorkPageDefinition.ID, AtsDecisionPrepareWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+ addPageTransitionToPageAndReturn(AtsDecisionDecisionWorkPageDefinition.ID, DECISION_CANCELLED_STATE_ID);
+
+ // Add Followup Transitions
+ addPageTransition(AtsDecisionFollowupWorkPageDefinition.ID, AtsDecisionDecisionWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+ addPageTransition(AtsDecisionFollowupWorkPageDefinition.ID, AtsDecisionCompletedWorkPageDefinition.ID,
+ TransitionType.ToPageAsDefault);
+ addPageTransitionToPageAndReturn(AtsDecisionFollowupWorkPageDefinition.ID, DECISION_CANCELLED_STATE_ID);
+
+ // Add Completed Transitions
+ addPageTransition(AtsDecisionCompletedWorkPageDefinition.ID, AtsDecisionDecisionWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+ addPageTransition(AtsDecisionCompletedWorkPageDefinition.ID, AtsDecisionFollowupWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+
+ // Add Cancelled Transitions
+ addPageTransition(DECISION_CANCELLED_STATE_ID, AtsDecisionPrepareWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+ addPageTransition(DECISION_CANCELLED_STATE_ID, AtsDecisionDecisionWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+ addPageTransition(DECISION_CANCELLED_STATE_ID, AtsDecisionFollowupWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/GoalWorkflowDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/GoalWorkflowDefinition.java
index db829067771..1cfb6f4cbd0 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/GoalWorkflowDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/GoalWorkflowDefinition.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * 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.ats.workflow.flow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.GoalArtifact.GoalState;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsGoalInWorkPageDefinition;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-public class GoalWorkflowDefinition extends WorkFlowDefinition {
-
- public static String ID = "osee.ats.goalWorkflow";
-
- public GoalWorkflowDefinition() {
- this(ID, ID);
- startPageId = GoalState.InWork.name();
- }
-
- public GoalWorkflowDefinition(Artifact artifact) throws OseeCoreException {
- super(artifact);
- throw new OseeStateException("This constructor should never be used.");
- }
-
- public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
- AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
- }
-
- public static List<WorkItemDefinition> getAtsWorkDefinitions() {
- List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
-
- // Add Task Page and Workflow Definition
- workItems.add(new AtsGoalInWorkPageDefinition());
- workItems.add(new WorkPageDefinition(GoalState.Completed.name(), ID + "." + GoalState.Completed.name(),
- AtsCompletedWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(GoalState.Cancelled.name(), ID + "." + GoalState.Cancelled.name(),
- AtsCancelledWorkPageDefinition.ID));
- workItems.add(new GoalWorkflowDefinition());
-
- return workItems;
- }
-
- /**
- * @param name
- * @param id
- * @param parentId
- */
- public GoalWorkflowDefinition(String name, String id) {
- super(name, id, null);
- addPageTransition(GoalState.InWork.name(), GoalState.Completed.name(), TransitionType.ToPageAsDefault);
-
- // Add return transitions
- addPageTransition(GoalState.Completed.name(), GoalState.InWork.name(), TransitionType.ToPageAsReturn);
-
- // Add cancelled transitions
- addPageTransitionToPageAndReturn(GoalState.InWork.name(), GoalState.Cancelled.name());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.flow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.GoalArtifact.GoalState;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsGoalInWorkPageDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+public class GoalWorkflowDefinition extends WorkFlowDefinition {
+
+ public static String ID = "osee.ats.goalWorkflow";
+
+ public GoalWorkflowDefinition() {
+ this(ID, ID);
+ startPageId = GoalState.InWork.name();
+ }
+
+ public GoalWorkflowDefinition(Artifact artifact) throws OseeCoreException {
+ super(artifact);
+ throw new OseeStateException("This constructor should never be used.");
+ }
+
+ public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
+ AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
+ }
+
+ public static List<WorkItemDefinition> getAtsWorkDefinitions() {
+ List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
+
+ // Add Task Page and Workflow Definition
+ workItems.add(new AtsGoalInWorkPageDefinition());
+ workItems.add(new WorkPageDefinition(GoalState.Completed.name(), ID + "." + GoalState.Completed.name(),
+ AtsCompletedWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(GoalState.Cancelled.name(), ID + "." + GoalState.Cancelled.name(),
+ AtsCancelledWorkPageDefinition.ID));
+ workItems.add(new GoalWorkflowDefinition());
+
+ return workItems;
+ }
+
+ /**
+ * @param name
+ * @param id
+ * @param parentId
+ */
+ public GoalWorkflowDefinition(String name, String id) {
+ super(name, id, null);
+ addPageTransition(GoalState.InWork.name(), GoalState.Completed.name(), TransitionType.ToPageAsDefault);
+
+ // Add return transitions
+ addPageTransition(GoalState.Completed.name(), GoalState.InWork.name(), TransitionType.ToPageAsReturn);
+
+ // Add cancelled transitions
+ addPageTransitionToPageAndReturn(GoalState.InWork.name(), GoalState.Cancelled.name());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/PeerToPeerWorkflowDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/PeerToPeerWorkflowDefinition.java
index f895e49da10..b6e01dbad47 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/PeerToPeerWorkflowDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/PeerToPeerWorkflowDefinition.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * 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.ats.workflow.flow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.item.AtsStatePercentCompleteWeightPeerToPeerReviewRule;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsPeerPrepareWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsPeerReviewWorkPageDefinition;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class PeerToPeerWorkflowDefinition extends WorkFlowDefinition {
-
- public static String ID = "osee.ats.peerToPeerReview";
- public static String PEER_REVIEW_COMPLETED_STATE_ID = ID + "." + DefaultTeamState.Completed.name();
- public static String PEER_REVIEW_CANCELLED_STATE_ID = ID + "." + DefaultTeamState.Cancelled.name();
-
- public PeerToPeerWorkflowDefinition() {
- super(ID, ID, null);
- addTransitions();
- startPageId = AtsPeerPrepareWorkPageDefinition.ID;
- addWorkItem(AtsStatePercentCompleteWeightPeerToPeerReviewRule.ID);
- }
-
- public PeerToPeerWorkflowDefinition(Artifact artifact) throws OseeCoreException {
- super(artifact);
- throw new OseeStateException("This constructor should never be used.");
- }
-
- public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
- AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
- }
-
- public static List<WorkItemDefinition> getAtsWorkDefinitions() {
- List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
-
- // Add PeerToPeer Pages and Workflow Definition
- workItems.add(new AtsPeerPrepareWorkPageDefinition());
- workItems.add(new AtsPeerReviewWorkPageDefinition());
- workItems.add(new WorkPageDefinition(DefaultTeamState.Completed.name(),
- PeerToPeerWorkflowDefinition.PEER_REVIEW_COMPLETED_STATE_ID, AtsCompletedWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(),
- PeerToPeerWorkflowDefinition.PEER_REVIEW_CANCELLED_STATE_ID, AtsCancelledWorkPageDefinition.ID));
- workItems.add(new PeerToPeerWorkflowDefinition());
-
- return workItems;
- }
-
- private void addTransitions() {
- // Add default transitions
- addPageTransition(AtsPeerPrepareWorkPageDefinition.ID, AtsPeerReviewWorkPageDefinition.ID,
- TransitionType.ToPageAsDefault);
- addPageTransition(AtsPeerReviewWorkPageDefinition.ID, PEER_REVIEW_COMPLETED_STATE_ID,
- TransitionType.ToPageAsDefault);
-
- // Add return transitions
- addPageTransition(PEER_REVIEW_COMPLETED_STATE_ID, AtsPeerReviewWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
- addPageTransition(AtsPeerReviewWorkPageDefinition.ID, AtsPeerPrepareWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
- addPageTransition(PEER_REVIEW_CANCELLED_STATE_ID, AtsPeerReviewWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
- addPageTransition(PEER_REVIEW_CANCELLED_STATE_ID, AtsPeerPrepareWorkPageDefinition.ID,
- TransitionType.ToPageAsReturn);
-
- // Add cancelled transitions
- addPageTransitionToPageAndReturn(AtsPeerPrepareWorkPageDefinition.ID, PEER_REVIEW_CANCELLED_STATE_ID);
- addPageTransitionToPageAndReturn(AtsPeerReviewWorkPageDefinition.ID, PEER_REVIEW_CANCELLED_STATE_ID);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.workflow.flow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.item.AtsStatePercentCompleteWeightPeerToPeerReviewRule;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsPeerPrepareWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsPeerReviewWorkPageDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class PeerToPeerWorkflowDefinition extends WorkFlowDefinition {
+
+ public static String ID = "osee.ats.peerToPeerReview";
+ public static String PEER_REVIEW_COMPLETED_STATE_ID = ID + "." + DefaultTeamState.Completed.name();
+ public static String PEER_REVIEW_CANCELLED_STATE_ID = ID + "." + DefaultTeamState.Cancelled.name();
+
+ public PeerToPeerWorkflowDefinition() {
+ super(ID, ID, null);
+ addTransitions();
+ startPageId = AtsPeerPrepareWorkPageDefinition.ID;
+ addWorkItem(AtsStatePercentCompleteWeightPeerToPeerReviewRule.ID);
+ }
+
+ public PeerToPeerWorkflowDefinition(Artifact artifact) throws OseeCoreException {
+ super(artifact);
+ throw new OseeStateException("This constructor should never be used.");
+ }
+
+ public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
+ AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
+ }
+
+ public static List<WorkItemDefinition> getAtsWorkDefinitions() {
+ List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
+
+ // Add PeerToPeer Pages and Workflow Definition
+ workItems.add(new AtsPeerPrepareWorkPageDefinition());
+ workItems.add(new AtsPeerReviewWorkPageDefinition());
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Completed.name(),
+ PeerToPeerWorkflowDefinition.PEER_REVIEW_COMPLETED_STATE_ID, AtsCompletedWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(),
+ PeerToPeerWorkflowDefinition.PEER_REVIEW_CANCELLED_STATE_ID, AtsCancelledWorkPageDefinition.ID));
+ workItems.add(new PeerToPeerWorkflowDefinition());
+
+ return workItems;
+ }
+
+ private void addTransitions() {
+ // Add default transitions
+ addPageTransition(AtsPeerPrepareWorkPageDefinition.ID, AtsPeerReviewWorkPageDefinition.ID,
+ TransitionType.ToPageAsDefault);
+ addPageTransition(AtsPeerReviewWorkPageDefinition.ID, PEER_REVIEW_COMPLETED_STATE_ID,
+ TransitionType.ToPageAsDefault);
+
+ // Add return transitions
+ addPageTransition(PEER_REVIEW_COMPLETED_STATE_ID, AtsPeerReviewWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+ addPageTransition(AtsPeerReviewWorkPageDefinition.ID, AtsPeerPrepareWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+ addPageTransition(PEER_REVIEW_CANCELLED_STATE_ID, AtsPeerReviewWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+ addPageTransition(PEER_REVIEW_CANCELLED_STATE_ID, AtsPeerPrepareWorkPageDefinition.ID,
+ TransitionType.ToPageAsReturn);
+
+ // Add cancelled transitions
+ addPageTransitionToPageAndReturn(AtsPeerPrepareWorkPageDefinition.ID, PEER_REVIEW_CANCELLED_STATE_ID);
+ addPageTransitionToPageAndReturn(AtsPeerReviewWorkPageDefinition.ID, PEER_REVIEW_CANCELLED_STATE_ID);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/SimpleWorkflowDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/SimpleWorkflowDefinition.java
index 5e533e7c1a0..02b2c725cf5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/SimpleWorkflowDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/SimpleWorkflowDefinition.java
@@ -1,100 +1,100 @@
-/*******************************************************************************
- * 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.ats.workflow.flow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.item.AtsStatePercentCompleteWeightSimpleWorkflowRule;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsEndorseWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsSimpleInWorkWorkPageDefinition;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class SimpleWorkflowDefinition extends WorkFlowDefinition {
-
- public static String ID = "osee.ats.simpleTeamWorkflow";
- public static enum SimpleState {
- Endorse, InWork, Completed, Cancelled
- };
- public static String ENDORSE_STATE_ID = ID + "." + SimpleState.Endorse.name();
- public static String INWORK_STATE_ID = ID + "." + SimpleState.InWork.name();
- public static String COMPLETED_STATE_ID = ID + "." + SimpleState.Completed.name();
- public static String CANCELLED_STATE_ID = ID + "." + SimpleState.Cancelled.name();
-
- public SimpleWorkflowDefinition(Artifact artifact) throws OseeCoreException {
- super(artifact);
- throw new OseeStateException("This constructor should never be used.");
- }
-
- public SimpleWorkflowDefinition() {
- this(ID, ID);
- addWorkItem(AtsStatePercentCompleteWeightSimpleWorkflowRule.ID);
- }
-
- /**
- * @param name
- * @param id
- * @param parentId
- */
- public SimpleWorkflowDefinition(String name, String workflowId) {
- super(name, workflowId, null);
- addDefaultTransitions(this, workflowId);
- startPageId = SimpleState.Endorse.name();
- }
-
- public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
- AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
- }
-
- public static void addDefaultTransitions(WorkFlowDefinition teamWorkflowDefinition, String workflowId) {
- teamWorkflowDefinition.addPageTransition(SimpleState.Endorse.name(), SimpleState.InWork.name(),
- TransitionType.ToPageAsDefault);
- teamWorkflowDefinition.addPageTransition(SimpleState.InWork.name(), SimpleState.Completed.name(),
- TransitionType.ToPageAsDefault);
-
- // Add return transitions
- teamWorkflowDefinition.addPageTransition(SimpleState.InWork.name(), SimpleState.Endorse.name(),
- TransitionType.ToPageAsReturn);
- teamWorkflowDefinition.addPageTransition(SimpleState.Completed.name(), SimpleState.InWork.name(),
- TransitionType.ToPageAsReturn);
-
- // Add cancelled transitions
- teamWorkflowDefinition.addPageTransitionToPageAndReturn(SimpleState.Endorse.name(), SimpleState.Cancelled.name());
- teamWorkflowDefinition.addPageTransitionToPageAndReturn(SimpleState.InWork.name(), SimpleState.Cancelled.name());
- }
-
- public static List<WorkItemDefinition> getAtsWorkDefinitions() {
- List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
-
- workItems.add(new WorkPageDefinition(SimpleState.Endorse.name(), SimpleWorkflowDefinition.ENDORSE_STATE_ID,
- AtsEndorseWorkPageDefinition.ID));
- workItems.add(new AtsSimpleInWorkWorkPageDefinition());
- workItems.add(new WorkPageDefinition(DefaultTeamState.Completed.name(),
- SimpleWorkflowDefinition.COMPLETED_STATE_ID, AtsCompletedWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(),
- SimpleWorkflowDefinition.CANCELLED_STATE_ID, AtsCancelledWorkPageDefinition.ID));
- workItems.add(new SimpleWorkflowDefinition());
-
- return workItems;
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.flow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.item.AtsStatePercentCompleteWeightSimpleWorkflowRule;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsEndorseWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsSimpleInWorkWorkPageDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SimpleWorkflowDefinition extends WorkFlowDefinition {
+
+ public static String ID = "osee.ats.simpleTeamWorkflow";
+ public static enum SimpleState {
+ Endorse, InWork, Completed, Cancelled
+ };
+ public static String ENDORSE_STATE_ID = ID + "." + SimpleState.Endorse.name();
+ public static String INWORK_STATE_ID = ID + "." + SimpleState.InWork.name();
+ public static String COMPLETED_STATE_ID = ID + "." + SimpleState.Completed.name();
+ public static String CANCELLED_STATE_ID = ID + "." + SimpleState.Cancelled.name();
+
+ public SimpleWorkflowDefinition(Artifact artifact) throws OseeCoreException {
+ super(artifact);
+ throw new OseeStateException("This constructor should never be used.");
+ }
+
+ public SimpleWorkflowDefinition() {
+ this(ID, ID);
+ addWorkItem(AtsStatePercentCompleteWeightSimpleWorkflowRule.ID);
+ }
+
+ /**
+ * @param name
+ * @param id
+ * @param parentId
+ */
+ public SimpleWorkflowDefinition(String name, String workflowId) {
+ super(name, workflowId, null);
+ addDefaultTransitions(this, workflowId);
+ startPageId = SimpleState.Endorse.name();
+ }
+
+ public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
+ AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
+ }
+
+ public static void addDefaultTransitions(WorkFlowDefinition teamWorkflowDefinition, String workflowId) {
+ teamWorkflowDefinition.addPageTransition(SimpleState.Endorse.name(), SimpleState.InWork.name(),
+ TransitionType.ToPageAsDefault);
+ teamWorkflowDefinition.addPageTransition(SimpleState.InWork.name(), SimpleState.Completed.name(),
+ TransitionType.ToPageAsDefault);
+
+ // Add return transitions
+ teamWorkflowDefinition.addPageTransition(SimpleState.InWork.name(), SimpleState.Endorse.name(),
+ TransitionType.ToPageAsReturn);
+ teamWorkflowDefinition.addPageTransition(SimpleState.Completed.name(), SimpleState.InWork.name(),
+ TransitionType.ToPageAsReturn);
+
+ // Add cancelled transitions
+ teamWorkflowDefinition.addPageTransitionToPageAndReturn(SimpleState.Endorse.name(), SimpleState.Cancelled.name());
+ teamWorkflowDefinition.addPageTransitionToPageAndReturn(SimpleState.InWork.name(), SimpleState.Cancelled.name());
+ }
+
+ public static List<WorkItemDefinition> getAtsWorkDefinitions() {
+ List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
+
+ workItems.add(new WorkPageDefinition(SimpleState.Endorse.name(), SimpleWorkflowDefinition.ENDORSE_STATE_ID,
+ AtsEndorseWorkPageDefinition.ID));
+ workItems.add(new AtsSimpleInWorkWorkPageDefinition());
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Completed.name(),
+ SimpleWorkflowDefinition.COMPLETED_STATE_ID, AtsCompletedWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(),
+ SimpleWorkflowDefinition.CANCELLED_STATE_ID, AtsCancelledWorkPageDefinition.ID));
+ workItems.add(new SimpleWorkflowDefinition());
+
+ return workItems;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TaskWorkflowDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TaskWorkflowDefinition.java
index 9b986915b4d..b383151b563 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TaskWorkflowDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TaskWorkflowDefinition.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * 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.ats.workflow.flow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.TaskArtifact.TaskStates;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsTaskInWorkPageDefinition;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskWorkflowDefinition extends WorkFlowDefinition {
-
- public static String ID = "osee.ats.taskWorkflow";
-
- public TaskWorkflowDefinition() {
- this(ID, ID);
- startPageId = TaskStates.InWork.name();
- }
-
- public TaskWorkflowDefinition(Artifact artifact) throws OseeCoreException {
- super(artifact);
- throw new OseeStateException("This constructor should never be used.");
- }
-
- public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
- AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
- }
-
- public static List<WorkItemDefinition> getAtsWorkDefinitions() {
- List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
-
- // Add Task Page and Workflow Definition
- workItems.add(new AtsTaskInWorkPageDefinition());
- workItems.add(new WorkPageDefinition(DefaultTeamState.Completed.name(), ID + "." + TaskStates.Completed.name(),
- AtsCompletedWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(), ID + "." + TaskStates.Cancelled.name(),
- AtsCancelledWorkPageDefinition.ID));
- workItems.add(new TaskWorkflowDefinition());
-
- return workItems;
- }
-
- /**
- * @param name
- * @param id
- * @param parentId
- */
- public TaskWorkflowDefinition(String name, String id) {
- super(name, id, null);
- addPageTransition(TaskStates.InWork.name(), TaskStates.Completed.name(), TransitionType.ToPageAsDefault);
-
- // Add return transitions
- addPageTransition(TaskStates.Completed.name(), TaskStates.InWork.name(), TransitionType.ToPageAsReturn);
-
- // Add cancelled transitions
- addPageTransitionToPageAndReturn(TaskStates.InWork.name(), TaskStates.Cancelled.name());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.flow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.TaskArtifact.TaskStates;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsTaskInWorkPageDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskWorkflowDefinition extends WorkFlowDefinition {
+
+ public static String ID = "osee.ats.taskWorkflow";
+
+ public TaskWorkflowDefinition() {
+ this(ID, ID);
+ startPageId = TaskStates.InWork.name();
+ }
+
+ public TaskWorkflowDefinition(Artifact artifact) throws OseeCoreException {
+ super(artifact);
+ throw new OseeStateException("This constructor should never be used.");
+ }
+
+ public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
+ AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
+ }
+
+ public static List<WorkItemDefinition> getAtsWorkDefinitions() {
+ List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
+
+ // Add Task Page and Workflow Definition
+ workItems.add(new AtsTaskInWorkPageDefinition());
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Completed.name(), ID + "." + TaskStates.Completed.name(),
+ AtsCompletedWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(), ID + "." + TaskStates.Cancelled.name(),
+ AtsCancelledWorkPageDefinition.ID));
+ workItems.add(new TaskWorkflowDefinition());
+
+ return workItems;
+ }
+
+ /**
+ * @param name
+ * @param id
+ * @param parentId
+ */
+ public TaskWorkflowDefinition(String name, String id) {
+ super(name, id, null);
+ addPageTransition(TaskStates.InWork.name(), TaskStates.Completed.name(), TransitionType.ToPageAsDefault);
+
+ // Add return transitions
+ addPageTransition(TaskStates.Completed.name(), TaskStates.InWork.name(), TransitionType.ToPageAsReturn);
+
+ // Add cancelled transitions
+ addPageTransitionToPageAndReturn(TaskStates.InWork.name(), TaskStates.Cancelled.name());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TeamWorkflowDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TeamWorkflowDefinition.java
index 16e3cc2d032..5b5969785ed 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TeamWorkflowDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/flow/TeamWorkflowDefinition.java
@@ -1,143 +1,143 @@
-/*******************************************************************************
- * 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.ats.workflow.flow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.item.AtsStatePercentCompleteWeightDefaultWorkflowRule;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.ats.workflow.page.AtsAnalyzeWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsAuthorizeWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsEndorseWorkPageDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsImplementWorkPageDefinition;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class TeamWorkflowDefinition extends WorkFlowDefinition {
-
- public static String ID = "osee.ats.teamWorkflow";
-
- public TeamWorkflowDefinition() {
- this(ID, ID);
- addWorkItem(AtsStatePercentCompleteWeightDefaultWorkflowRule.ID);
- }
-
- public TeamWorkflowDefinition(Artifact artifact) throws OseeCoreException {
- super(artifact);
- throw new OseeStateException("This constructor should never be used.");
- }
-
- /**
- * Instantiate workflow as inherited from parentWorkflowId. Default transitions and startPageId are not set as they
- * will most likely come from parent.
- *
- * @param name
- * @param workflowId
- * @param parentWorkflowId
- */
- public TeamWorkflowDefinition(String name, String workflowId, String parentWorkflowId) {
- super(name, workflowId, parentWorkflowId);
- }
-
- public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
- AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
- }
-
- /**
- * Instantiate workflow as a TeamWorkflowDefinition with default transitions and startPageId set.
- *
- * @param name
- * @param id
- * @param parentId
- */
- public TeamWorkflowDefinition(String name, String workflowId) {
- super(name, workflowId, null);
- addDefaultTransitions(this, workflowId);
- startPageId = DefaultTeamState.Endorse.name();
- }
-
- public static List<WorkItemDefinition> getAtsWorkDefinitions() {
- List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
-
- // Add Team Page and Workflow Definition
- workItems.add(new AtsEndorseWorkPageDefinition());
- workItems.add(new AtsAnalyzeWorkPageDefinition());
- workItems.add(new AtsAuthorizeWorkPageDefinition());
- workItems.add(new AtsImplementWorkPageDefinition());
- workItems.add(new AtsCompletedWorkPageDefinition());
- workItems.add(new AtsCancelledWorkPageDefinition());
- workItems.add(new TeamWorkflowDefinition());
-
- return workItems;
- }
-
- public static List<WorkItemDefinition> getWorkPageDefinitionsForId(String workflowId) {
- List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
- // Add Team Page and Workflow Definition
- workItems.add(new WorkPageDefinition(DefaultTeamState.Endorse.name(),
- workflowId + "." + DefaultTeamState.Endorse.name(), AtsEndorseWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(DefaultTeamState.Analyze.name(),
- workflowId + "." + DefaultTeamState.Analyze.name(), AtsAnalyzeWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(DefaultTeamState.Authorize.name(),
- workflowId + "." + DefaultTeamState.Authorize.name(), AtsAuthorizeWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(DefaultTeamState.Implement.name(),
- workflowId + "." + DefaultTeamState.Implement.name(), AtsImplementWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(DefaultTeamState.Completed.name(),
- workflowId + "." + DefaultTeamState.Completed.name(), AtsCompletedWorkPageDefinition.ID));
- workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(),
- workflowId + "." + DefaultTeamState.Cancelled.name(), AtsCancelledWorkPageDefinition.ID));
- return workItems;
- }
-
- public static void addDefaultTransitions(WorkFlowDefinition teamWorkflowDefinition, String workflowId) {
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Endorse.name(), DefaultTeamState.Analyze.name(),
- TransitionType.ToPageAsDefault);
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Analyze.name(), DefaultTeamState.Authorize.name(),
- TransitionType.ToPageAsDefault);
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Authorize.name(), DefaultTeamState.Implement.name(),
- TransitionType.ToPageAsDefault);
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Implement.name(), DefaultTeamState.Completed.name(),
- TransitionType.ToPageAsDefault);
-
- // Add return transitions
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Analyze.name(), DefaultTeamState.Endorse.name(),
- TransitionType.ToPageAsReturn);
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Authorize.name(), DefaultTeamState.Analyze.name(),
- TransitionType.ToPageAsReturn);
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Implement.name(), DefaultTeamState.Analyze.name(),
- TransitionType.ToPageAsReturn);
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Implement.name(), DefaultTeamState.Authorize.name(),
- TransitionType.ToPageAsReturn);
- teamWorkflowDefinition.addPageTransition(DefaultTeamState.Completed.name(), DefaultTeamState.Implement.name(),
- TransitionType.ToPageAsReturn);
-
- // Add cancelled transitions
- teamWorkflowDefinition.addPageTransitionToPageAndReturn(DefaultTeamState.Endorse.name(),
- DefaultTeamState.Cancelled.name());
- teamWorkflowDefinition.addPageTransitionToPageAndReturn(DefaultTeamState.Analyze.name(),
- DefaultTeamState.Cancelled.name());
- teamWorkflowDefinition.addPageTransitionToPageAndReturn(DefaultTeamState.Authorize.name(),
- DefaultTeamState.Cancelled.name());
- teamWorkflowDefinition.addPageTransitionToPageAndReturn(DefaultTeamState.Implement.name(),
- DefaultTeamState.Cancelled.name());
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.flow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.item.AtsStatePercentCompleteWeightDefaultWorkflowRule;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.ats.workflow.page.AtsAnalyzeWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsAuthorizeWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsCancelledWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsCompletedWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsEndorseWorkPageDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsImplementWorkPageDefinition;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TeamWorkflowDefinition extends WorkFlowDefinition {
+
+ public static String ID = "osee.ats.teamWorkflow";
+
+ public TeamWorkflowDefinition() {
+ this(ID, ID);
+ addWorkItem(AtsStatePercentCompleteWeightDefaultWorkflowRule.ID);
+ }
+
+ public TeamWorkflowDefinition(Artifact artifact) throws OseeCoreException {
+ super(artifact);
+ throw new OseeStateException("This constructor should never be used.");
+ }
+
+ /**
+ * Instantiate workflow as inherited from parentWorkflowId. Default transitions and startPageId are not set as they
+ * will most likely come from parent.
+ *
+ * @param name
+ * @param workflowId
+ * @param parentWorkflowId
+ */
+ public TeamWorkflowDefinition(String name, String workflowId, String parentWorkflowId) {
+ super(name, workflowId, parentWorkflowId);
+ }
+
+ public void config(WriteType writeType, XResultData xResultData) throws OseeCoreException {
+ AtsWorkDefinitions.importWorkItemDefinitionsIntoDb(writeType, xResultData, getAtsWorkDefinitions());
+ }
+
+ /**
+ * Instantiate workflow as a TeamWorkflowDefinition with default transitions and startPageId set.
+ *
+ * @param name
+ * @param id
+ * @param parentId
+ */
+ public TeamWorkflowDefinition(String name, String workflowId) {
+ super(name, workflowId, null);
+ addDefaultTransitions(this, workflowId);
+ startPageId = DefaultTeamState.Endorse.name();
+ }
+
+ public static List<WorkItemDefinition> getAtsWorkDefinitions() {
+ List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
+
+ // Add Team Page and Workflow Definition
+ workItems.add(new AtsEndorseWorkPageDefinition());
+ workItems.add(new AtsAnalyzeWorkPageDefinition());
+ workItems.add(new AtsAuthorizeWorkPageDefinition());
+ workItems.add(new AtsImplementWorkPageDefinition());
+ workItems.add(new AtsCompletedWorkPageDefinition());
+ workItems.add(new AtsCancelledWorkPageDefinition());
+ workItems.add(new TeamWorkflowDefinition());
+
+ return workItems;
+ }
+
+ public static List<WorkItemDefinition> getWorkPageDefinitionsForId(String workflowId) {
+ List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
+ // Add Team Page and Workflow Definition
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Endorse.name(),
+ workflowId + "." + DefaultTeamState.Endorse.name(), AtsEndorseWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Analyze.name(),
+ workflowId + "." + DefaultTeamState.Analyze.name(), AtsAnalyzeWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Authorize.name(),
+ workflowId + "." + DefaultTeamState.Authorize.name(), AtsAuthorizeWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Implement.name(),
+ workflowId + "." + DefaultTeamState.Implement.name(), AtsImplementWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Completed.name(),
+ workflowId + "." + DefaultTeamState.Completed.name(), AtsCompletedWorkPageDefinition.ID));
+ workItems.add(new WorkPageDefinition(DefaultTeamState.Cancelled.name(),
+ workflowId + "." + DefaultTeamState.Cancelled.name(), AtsCancelledWorkPageDefinition.ID));
+ return workItems;
+ }
+
+ public static void addDefaultTransitions(WorkFlowDefinition teamWorkflowDefinition, String workflowId) {
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Endorse.name(), DefaultTeamState.Analyze.name(),
+ TransitionType.ToPageAsDefault);
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Analyze.name(), DefaultTeamState.Authorize.name(),
+ TransitionType.ToPageAsDefault);
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Authorize.name(), DefaultTeamState.Implement.name(),
+ TransitionType.ToPageAsDefault);
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Implement.name(), DefaultTeamState.Completed.name(),
+ TransitionType.ToPageAsDefault);
+
+ // Add return transitions
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Analyze.name(), DefaultTeamState.Endorse.name(),
+ TransitionType.ToPageAsReturn);
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Authorize.name(), DefaultTeamState.Analyze.name(),
+ TransitionType.ToPageAsReturn);
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Implement.name(), DefaultTeamState.Analyze.name(),
+ TransitionType.ToPageAsReturn);
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Implement.name(), DefaultTeamState.Authorize.name(),
+ TransitionType.ToPageAsReturn);
+ teamWorkflowDefinition.addPageTransition(DefaultTeamState.Completed.name(), DefaultTeamState.Implement.name(),
+ TransitionType.ToPageAsReturn);
+
+ // Add cancelled transitions
+ teamWorkflowDefinition.addPageTransitionToPageAndReturn(DefaultTeamState.Endorse.name(),
+ DefaultTeamState.Cancelled.name());
+ teamWorkflowDefinition.addPageTransitionToPageAndReturn(DefaultTeamState.Analyze.name(),
+ DefaultTeamState.Cancelled.name());
+ teamWorkflowDefinition.addPageTransitionToPageAndReturn(DefaultTeamState.Authorize.name(),
+ DefaultTeamState.Cancelled.name());
+ teamWorkflowDefinition.addPageTransitionToPageAndReturn(DefaultTeamState.Implement.name(),
+ DefaultTeamState.Cancelled.name());
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddDecisionReviewRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddDecisionReviewRule.java
index e5f87276516..976e39df622 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddDecisionReviewRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddDecisionReviewRule.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.ats.workflow.item;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact.ReviewBlockType;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.ReviewManager;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.skynet.core.utility.UsersByIds;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkRuleDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsAddDecisionReviewRule extends WorkRuleDefinition {
-
- public static String ID = "atsAddDecisionReview";
- public static enum DecisionParameter {
- title, forState, forEvent, reviewBlockingType, assignees, options, description
- };
-
- public static enum DecisionRuleOption {
- None, TransitionToDecision
- }
-
- public AtsAddDecisionReviewRule() {
- this(ID, ID);
- }
-
- public AtsAddDecisionReviewRule(String name, String id) {
- super(name, id);
- setDescription("Work Page and Team Definition Option: Decision Review will be auto-created based on WorkData attribute values.");
- setDecisionParameterValue(this, DecisionParameter.title, "Enter Title Here");
- setDecisionParameterValue(this, DecisionParameter.reviewBlockingType, "Transition");
- setDecisionParameterValue(this, DecisionParameter.forState, "Implement");
- setDecisionParameterValue(this, DecisionParameter.forEvent, StateEventType.TransitionTo.name());
- try {
- setDecisionParameterValue(this, DecisionParameter.assignees, "<99999997>");
- setDecisionParameterValue(this, DecisionParameter.options, "Completed;Completed;");
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public static void setDecisionParameterValue(WorkRuleDefinition workRuleDefinition, DecisionParameter decisionParameter, String value) {
- workRuleDefinition.addWorkDataKeyValue(decisionParameter.name(), value);
- }
-
- public static String getDecisionParameterValue(WorkRuleDefinition workRuleDefinition, DecisionParameter decisionParameter) {
- return workRuleDefinition.getWorkDataValue(decisionParameter.name());
- }
-
- /**
- * Creates decision review if one of same name doesn't already exist
- *
- * @param atsAddDecisionReviewRule
- * @param sma
- * @return DecisionReviewArtifact
- * @throws OseeCoreException
- */
- public static DecisionReviewArtifact createNewDecisionReview(WorkRuleDefinition atsAddDecisionReviewRule, SkynetTransaction transaction, TeamWorkFlowArtifact teamArt, DecisionRuleOption... decisionRuleOption) throws OseeCoreException {
- if (!atsAddDecisionReviewRule.getId().startsWith(AtsAddDecisionReviewRule.ID)) {
- throw new OseeArgumentException("WorkRuleDefinition must be AtsAddDecisionReviewRule.ID");
- }
- String title = getValueOrDefault(teamArt, atsAddDecisionReviewRule, DecisionParameter.title);
- if (Artifacts.artNames(ReviewManager.getReviews(teamArt)).contains(title)) {
- // Already created this review
- return null;
- }
- DecisionReviewArtifact decArt = null;
- if (Collections.getAggregate(decisionRuleOption).contains(DecisionRuleOption.TransitionToDecision)) {
- decArt =
- ReviewManager.createNewDecisionReviewAndTransitionToDecision(teamArt, title, getValueOrDefault(teamArt,
- atsAddDecisionReviewRule, DecisionParameter.description), getValueOrDefault(teamArt,
- atsAddDecisionReviewRule, DecisionParameter.forState), getReviewBlockTypeOrDefault(teamArt,
- atsAddDecisionReviewRule), getValueOrDefault(teamArt, atsAddDecisionReviewRule,
- DecisionParameter.options), getAssigneesOrDefault(teamArt, atsAddDecisionReviewRule), transaction);
- } else {
- decArt =
- ReviewManager.createNewDecisionReview(teamArt, title, getValueOrDefault(teamArt,
- atsAddDecisionReviewRule, DecisionParameter.description), getValueOrDefault(teamArt,
- atsAddDecisionReviewRule, DecisionParameter.forState), getReviewBlockTypeOrDefault(teamArt,
- atsAddDecisionReviewRule), getValueOrDefault(teamArt, atsAddDecisionReviewRule,
- DecisionParameter.options), getAssigneesOrDefault(teamArt, atsAddDecisionReviewRule), transaction);
- }
-
- decArt.getLog().addLog(LogType.Note, null,
- "Review auto-generated off rule " + atsAddDecisionReviewRule.getId());
- return decArt;
- }
-
- public static ReviewBlockType getReviewBlockTypeOrDefault(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition) {
- String value = getDecisionParameterValue(workRuleDefinition, DecisionParameter.reviewBlockingType);
- if (value == null || value.equals("")) {
- return null;
- }
- return ReviewBlockType.valueOf(value);
- }
-
- public static StateEventType getStateEventType(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition) {
- String value = getDecisionParameterValue(workRuleDefinition, DecisionParameter.forEvent);
- if (value == null || value.equals("")) {
- return null;
- }
- return StateEventType.valueOf(value);
- }
-
- private static String getValueOrDefault(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition, DecisionParameter decisionParameter) throws OseeCoreException {
- String value = getDecisionParameterValue(workRuleDefinition, decisionParameter);
- if (value == null || value.equals("")) {
- if (decisionParameter == DecisionParameter.title) {
- return "Decide on \"" + teamArt.getName() + "\"";
- } else if (decisionParameter == DecisionParameter.options) {
- return "Yes;Followup;<" + UserManager.getUser().getUserId() + ">\n" + "No;Completed;";
- } else if (decisionParameter == DecisionParameter.description) {
- return null;
- } else if (decisionParameter == DecisionParameter.forState) {
- return teamArt.getStateMgr().getCurrentStateName();
- }
- }
- return value;
- }
-
- public static Collection<User> getAssigneesOrDefault(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition) throws OseeCoreException {
- String value = getDecisionParameterValue(workRuleDefinition, DecisionParameter.assignees);
- if (value == null || value.equals("")) {
- return Arrays.asList(new User[] {UserManager.getUser()});
- }
- Collection<User> users = UsersByIds.getUsers(value);
- if (users.isEmpty()) {
- users.add(UserManager.getUser());
- }
- return users;
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact.ReviewBlockType;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.ReviewManager;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.skynet.core.utility.UsersByIds;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkRuleDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsAddDecisionReviewRule extends WorkRuleDefinition {
+
+ public static String ID = "atsAddDecisionReview";
+ public static enum DecisionParameter {
+ title, forState, forEvent, reviewBlockingType, assignees, options, description
+ };
+
+ public static enum DecisionRuleOption {
+ None, TransitionToDecision
+ }
+
+ public AtsAddDecisionReviewRule() {
+ this(ID, ID);
+ }
+
+ public AtsAddDecisionReviewRule(String name, String id) {
+ super(name, id);
+ setDescription("Work Page and Team Definition Option: Decision Review will be auto-created based on WorkData attribute values.");
+ setDecisionParameterValue(this, DecisionParameter.title, "Enter Title Here");
+ setDecisionParameterValue(this, DecisionParameter.reviewBlockingType, "Transition");
+ setDecisionParameterValue(this, DecisionParameter.forState, "Implement");
+ setDecisionParameterValue(this, DecisionParameter.forEvent, StateEventType.TransitionTo.name());
+ try {
+ setDecisionParameterValue(this, DecisionParameter.assignees, "<99999997>");
+ setDecisionParameterValue(this, DecisionParameter.options, "Completed;Completed;");
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public static void setDecisionParameterValue(WorkRuleDefinition workRuleDefinition, DecisionParameter decisionParameter, String value) {
+ workRuleDefinition.addWorkDataKeyValue(decisionParameter.name(), value);
+ }
+
+ public static String getDecisionParameterValue(WorkRuleDefinition workRuleDefinition, DecisionParameter decisionParameter) {
+ return workRuleDefinition.getWorkDataValue(decisionParameter.name());
+ }
+
+ /**
+ * Creates decision review if one of same name doesn't already exist
+ *
+ * @param atsAddDecisionReviewRule
+ * @param sma
+ * @return DecisionReviewArtifact
+ * @throws OseeCoreException
+ */
+ public static DecisionReviewArtifact createNewDecisionReview(WorkRuleDefinition atsAddDecisionReviewRule, SkynetTransaction transaction, TeamWorkFlowArtifact teamArt, DecisionRuleOption... decisionRuleOption) throws OseeCoreException {
+ if (!atsAddDecisionReviewRule.getId().startsWith(AtsAddDecisionReviewRule.ID)) {
+ throw new OseeArgumentException("WorkRuleDefinition must be AtsAddDecisionReviewRule.ID");
+ }
+ String title = getValueOrDefault(teamArt, atsAddDecisionReviewRule, DecisionParameter.title);
+ if (Artifacts.artNames(ReviewManager.getReviews(teamArt)).contains(title)) {
+ // Already created this review
+ return null;
+ }
+ DecisionReviewArtifact decArt = null;
+ if (Collections.getAggregate(decisionRuleOption).contains(DecisionRuleOption.TransitionToDecision)) {
+ decArt =
+ ReviewManager.createNewDecisionReviewAndTransitionToDecision(teamArt, title, getValueOrDefault(teamArt,
+ atsAddDecisionReviewRule, DecisionParameter.description), getValueOrDefault(teamArt,
+ atsAddDecisionReviewRule, DecisionParameter.forState), getReviewBlockTypeOrDefault(teamArt,
+ atsAddDecisionReviewRule), getValueOrDefault(teamArt, atsAddDecisionReviewRule,
+ DecisionParameter.options), getAssigneesOrDefault(teamArt, atsAddDecisionReviewRule), transaction);
+ } else {
+ decArt =
+ ReviewManager.createNewDecisionReview(teamArt, title, getValueOrDefault(teamArt,
+ atsAddDecisionReviewRule, DecisionParameter.description), getValueOrDefault(teamArt,
+ atsAddDecisionReviewRule, DecisionParameter.forState), getReviewBlockTypeOrDefault(teamArt,
+ atsAddDecisionReviewRule), getValueOrDefault(teamArt, atsAddDecisionReviewRule,
+ DecisionParameter.options), getAssigneesOrDefault(teamArt, atsAddDecisionReviewRule), transaction);
+ }
+
+ decArt.getLog().addLog(LogType.Note, null,
+ "Review auto-generated off rule " + atsAddDecisionReviewRule.getId());
+ return decArt;
+ }
+
+ public static ReviewBlockType getReviewBlockTypeOrDefault(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition) {
+ String value = getDecisionParameterValue(workRuleDefinition, DecisionParameter.reviewBlockingType);
+ if (value == null || value.equals("")) {
+ return null;
+ }
+ return ReviewBlockType.valueOf(value);
+ }
+
+ public static StateEventType getStateEventType(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition) {
+ String value = getDecisionParameterValue(workRuleDefinition, DecisionParameter.forEvent);
+ if (value == null || value.equals("")) {
+ return null;
+ }
+ return StateEventType.valueOf(value);
+ }
+
+ private static String getValueOrDefault(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition, DecisionParameter decisionParameter) throws OseeCoreException {
+ String value = getDecisionParameterValue(workRuleDefinition, decisionParameter);
+ if (value == null || value.equals("")) {
+ if (decisionParameter == DecisionParameter.title) {
+ return "Decide on \"" + teamArt.getName() + "\"";
+ } else if (decisionParameter == DecisionParameter.options) {
+ return "Yes;Followup;<" + UserManager.getUser().getUserId() + ">\n" + "No;Completed;";
+ } else if (decisionParameter == DecisionParameter.description) {
+ return null;
+ } else if (decisionParameter == DecisionParameter.forState) {
+ return teamArt.getStateMgr().getCurrentStateName();
+ }
+ }
+ return value;
+ }
+
+ public static Collection<User> getAssigneesOrDefault(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition) throws OseeCoreException {
+ String value = getDecisionParameterValue(workRuleDefinition, DecisionParameter.assignees);
+ if (value == null || value.equals("")) {
+ return Arrays.asList(new User[] {UserManager.getUser()});
+ }
+ Collection<User> users = UsersByIds.getUsers(value);
+ if (users.isEmpty()) {
+ users.add(UserManager.getUser());
+ }
+ return users;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddPeerToPeerReviewRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddPeerToPeerReviewRule.java
index 6d7dd534755..6d8573b129c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddPeerToPeerReviewRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAddPeerToPeerReviewRule.java
@@ -1,126 +1,126 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact.ReviewBlockType;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.ReviewManager;
-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.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkRuleDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsAddPeerToPeerReviewRule extends WorkRuleDefinition {
-
- public static String ID = "atsAddPeerToPeerReview";
- public static enum PeerToPeerParameter {
- title, forState, forEvent, reviewBlockingType, assignees, location, description
- };
-
- public AtsAddPeerToPeerReviewRule() {
- this(ID, ID);
- }
-
- public AtsAddPeerToPeerReviewRule(String name, String id) {
- super(name, id);
- setDescription("Work Page and Team Definition Option: PeerToPeer Review will be auto-created based on WorkData attribute values.");
- setPeerToPeerParameterValue(this, PeerToPeerParameter.reviewBlockingType, "Commit");
- setPeerToPeerParameterValue(this, PeerToPeerParameter.forState, "Implement");
- setPeerToPeerParameterValue(this, PeerToPeerParameter.forEvent, StateEventType.CreateBranch.name());
- try {
- setPeerToPeerParameterValue(this, PeerToPeerParameter.assignees, "<99999997>");
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public static void setPeerToPeerParameterValue(WorkRuleDefinition workRuleDefinition, PeerToPeerParameter decisionParameter, String value) {
- workRuleDefinition.addWorkDataKeyValue(decisionParameter.name(), value);
- }
-
- public static String getPeerToPeerParameterValue(WorkRuleDefinition workRuleDefinition, PeerToPeerParameter decisionParameter) {
- return workRuleDefinition.getWorkDataValue(decisionParameter.name());
- }
-
- /**
- * Creates PeerToPeer review if one of same name doesn't already exist
- *
- * @param atsAddPeerToPeerReviewRule
- * @param sma
- * @param transaction
- * @return review
- * @throws OseeCoreException
- */
- public static PeerToPeerReviewArtifact createNewPeerToPeerReview(WorkRuleDefinition atsAddPeerToPeerReviewRule, TeamWorkFlowArtifact teamArt, SkynetTransaction transaction) throws OseeCoreException {
- if (!atsAddPeerToPeerReviewRule.getId().startsWith(AtsAddPeerToPeerReviewRule.ID)) {
- throw new OseeArgumentException("WorkRuleDefinition must be AtsAddPeerToPeerReviewRule.ID");
- }
- String title = getValueOrDefault(teamArt, atsAddPeerToPeerReviewRule, PeerToPeerParameter.title);
- if (Artifacts.artNames(ReviewManager.getReviews(teamArt)).contains(title)) {
- // Already created this review
- return null;
- }
- PeerToPeerReviewArtifact peerArt =
- ReviewManager.createNewPeerToPeerReview(teamArt, title, getValueOrDefault(teamArt,
- atsAddPeerToPeerReviewRule, PeerToPeerParameter.forState), UserManager.getUser(), new Date(),
- transaction);
- String desc = getValueOrDefault(teamArt, atsAddPeerToPeerReviewRule, PeerToPeerParameter.description);
- if (desc != null && !desc.equals("")) {
- peerArt.setSoleAttributeFromString(ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName(), desc);
- }
- ReviewBlockType reviewBlockType =
- AtsAddDecisionReviewRule.getReviewBlockTypeOrDefault(teamArt, atsAddPeerToPeerReviewRule);
- if (reviewBlockType != null) {
- peerArt.setSoleAttributeFromString(ATSAttributes.REVIEW_BLOCKS_ATTRIBUTE.getStoreName(),
- reviewBlockType.name());
- }
- String location = getValueOrDefault(teamArt, atsAddPeerToPeerReviewRule, PeerToPeerParameter.location);
- if (location != null && location.equals("")) {
- peerArt.setSoleAttributeFromString(ATSAttributes.LOCATION_ATTRIBUTE.getStoreName(), location);
- }
- Collection<User> assignees = AtsAddDecisionReviewRule.getAssigneesOrDefault(teamArt, atsAddPeerToPeerReviewRule);
- if (assignees.size() > 0) {
- peerArt.getStateMgr().setAssignees(assignees);
- }
- peerArt.getLog().addLog(LogType.Note, null,
- "Review auto-generated off rule " + atsAddPeerToPeerReviewRule.getId());
- return peerArt;
- }
-
- private static String getValueOrDefault(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition, PeerToPeerParameter peerToPeerParameter) throws OseeCoreException {
- String value = getPeerToPeerParameterValue(workRuleDefinition, peerToPeerParameter);
- if (value == null || value.equals("")) {
- if (peerToPeerParameter == PeerToPeerParameter.title) {
- return PeerToPeerReviewArtifact.getDefaultReviewTitle(teamArt);
- } else if (peerToPeerParameter == PeerToPeerParameter.forState) {
- return teamArt.getStateMgr().getCurrentStateName();
- } else if (peerToPeerParameter == PeerToPeerParameter.location) {
- return null;
- }
- }
- return value;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact.ReviewBlockType;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.ReviewManager;
+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.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkRuleDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsAddPeerToPeerReviewRule extends WorkRuleDefinition {
+
+ public static String ID = "atsAddPeerToPeerReview";
+ public static enum PeerToPeerParameter {
+ title, forState, forEvent, reviewBlockingType, assignees, location, description
+ };
+
+ public AtsAddPeerToPeerReviewRule() {
+ this(ID, ID);
+ }
+
+ public AtsAddPeerToPeerReviewRule(String name, String id) {
+ super(name, id);
+ setDescription("Work Page and Team Definition Option: PeerToPeer Review will be auto-created based on WorkData attribute values.");
+ setPeerToPeerParameterValue(this, PeerToPeerParameter.reviewBlockingType, "Commit");
+ setPeerToPeerParameterValue(this, PeerToPeerParameter.forState, "Implement");
+ setPeerToPeerParameterValue(this, PeerToPeerParameter.forEvent, StateEventType.CreateBranch.name());
+ try {
+ setPeerToPeerParameterValue(this, PeerToPeerParameter.assignees, "<99999997>");
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public static void setPeerToPeerParameterValue(WorkRuleDefinition workRuleDefinition, PeerToPeerParameter decisionParameter, String value) {
+ workRuleDefinition.addWorkDataKeyValue(decisionParameter.name(), value);
+ }
+
+ public static String getPeerToPeerParameterValue(WorkRuleDefinition workRuleDefinition, PeerToPeerParameter decisionParameter) {
+ return workRuleDefinition.getWorkDataValue(decisionParameter.name());
+ }
+
+ /**
+ * Creates PeerToPeer review if one of same name doesn't already exist
+ *
+ * @param atsAddPeerToPeerReviewRule
+ * @param sma
+ * @param transaction
+ * @return review
+ * @throws OseeCoreException
+ */
+ public static PeerToPeerReviewArtifact createNewPeerToPeerReview(WorkRuleDefinition atsAddPeerToPeerReviewRule, TeamWorkFlowArtifact teamArt, SkynetTransaction transaction) throws OseeCoreException {
+ if (!atsAddPeerToPeerReviewRule.getId().startsWith(AtsAddPeerToPeerReviewRule.ID)) {
+ throw new OseeArgumentException("WorkRuleDefinition must be AtsAddPeerToPeerReviewRule.ID");
+ }
+ String title = getValueOrDefault(teamArt, atsAddPeerToPeerReviewRule, PeerToPeerParameter.title);
+ if (Artifacts.artNames(ReviewManager.getReviews(teamArt)).contains(title)) {
+ // Already created this review
+ return null;
+ }
+ PeerToPeerReviewArtifact peerArt =
+ ReviewManager.createNewPeerToPeerReview(teamArt, title, getValueOrDefault(teamArt,
+ atsAddPeerToPeerReviewRule, PeerToPeerParameter.forState), UserManager.getUser(), new Date(),
+ transaction);
+ String desc = getValueOrDefault(teamArt, atsAddPeerToPeerReviewRule, PeerToPeerParameter.description);
+ if (desc != null && !desc.equals("")) {
+ peerArt.setSoleAttributeFromString(ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName(), desc);
+ }
+ ReviewBlockType reviewBlockType =
+ AtsAddDecisionReviewRule.getReviewBlockTypeOrDefault(teamArt, atsAddPeerToPeerReviewRule);
+ if (reviewBlockType != null) {
+ peerArt.setSoleAttributeFromString(ATSAttributes.REVIEW_BLOCKS_ATTRIBUTE.getStoreName(),
+ reviewBlockType.name());
+ }
+ String location = getValueOrDefault(teamArt, atsAddPeerToPeerReviewRule, PeerToPeerParameter.location);
+ if (location != null && location.equals("")) {
+ peerArt.setSoleAttributeFromString(ATSAttributes.LOCATION_ATTRIBUTE.getStoreName(), location);
+ }
+ Collection<User> assignees = AtsAddDecisionReviewRule.getAssigneesOrDefault(teamArt, atsAddPeerToPeerReviewRule);
+ if (assignees.size() > 0) {
+ peerArt.getStateMgr().setAssignees(assignees);
+ }
+ peerArt.getLog().addLog(LogType.Note, null,
+ "Review auto-generated off rule " + atsAddPeerToPeerReviewRule.getId());
+ return peerArt;
+ }
+
+ private static String getValueOrDefault(TeamWorkFlowArtifact teamArt, WorkRuleDefinition workRuleDefinition, PeerToPeerParameter peerToPeerParameter) throws OseeCoreException {
+ String value = getPeerToPeerParameterValue(workRuleDefinition, peerToPeerParameter);
+ if (value == null || value.equals("")) {
+ if (peerToPeerParameter == PeerToPeerParameter.title) {
+ return PeerToPeerReviewArtifact.getDefaultReviewTitle(teamArt);
+ } else if (peerToPeerParameter == PeerToPeerParameter.forState) {
+ return teamArt.getStateMgr().getCurrentStateName();
+ } else if (peerToPeerParameter == PeerToPeerParameter.location) {
+ return null;
+ }
+ }
+ return value;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewDefectXWidgetWorkItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewDefectXWidgetWorkItem.java
index 93ef98c999f..378751360bb 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewDefectXWidgetWorkItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewDefectXWidgetWorkItem.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsAttributeReviewDefectXWidgetWorkItem extends WorkWidgetDefinition {
-
- protected AtsAttributeReviewDefectXWidgetWorkItem(ATSAttributes atsAttribute) {
- super(atsAttribute.getDisplayName() + " - " + atsAttribute.getStoreName(), atsAttribute.getStoreName());
- DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
- data.setName(getName());
- data.setStorageName(getId());
- data.setXWidgetName("XDefectViewer");
- set(data);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsAttributeReviewDefectXWidgetWorkItem extends WorkWidgetDefinition {
+
+ protected AtsAttributeReviewDefectXWidgetWorkItem(ATSAttributes atsAttribute) {
+ super(atsAttribute.getDisplayName() + " - " + atsAttribute.getStoreName(), atsAttribute.getStoreName());
+ DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
+ data.setName(getName());
+ data.setStorageName(getId());
+ data.setXWidgetName("XDefectViewer");
+ set(data);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewRolesXWidgetWorkItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewRolesXWidgetWorkItem.java
index 0185c303c98..9adf7892e02 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewRolesXWidgetWorkItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeReviewRolesXWidgetWorkItem.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsAttributeReviewRolesXWidgetWorkItem extends WorkWidgetDefinition {
-
- protected AtsAttributeReviewRolesXWidgetWorkItem(ATSAttributes atsAttribute) {
- super(atsAttribute.getDisplayName() + " - " + atsAttribute.getStoreName(), atsAttribute.getStoreName());
- DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
- data.setName(getName());
- data.setStorageName(getId());
- data.getXOptionHandler().add(XOption.REQUIRED);
- data.setXWidgetName("XUserRoleViewer");
- set(data);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsAttributeReviewRolesXWidgetWorkItem extends WorkWidgetDefinition {
+
+ protected AtsAttributeReviewRolesXWidgetWorkItem(ATSAttributes atsAttribute) {
+ super(atsAttribute.getDisplayName() + " - " + atsAttribute.getStoreName(), atsAttribute.getStoreName());
+ DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
+ data.setName(getName());
+ data.setStorageName(getId());
+ data.getXOptionHandler().add(XOption.REQUIRED);
+ data.setXWidgetName("XUserRoleViewer");
+ set(data);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeSoleComboXWidgetWorkItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeSoleComboXWidgetWorkItem.java
index 0ba4b2e2a86..8617d291ba4 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeSoleComboXWidgetWorkItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeSoleComboXWidgetWorkItem.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsAttributeSoleComboXWidgetWorkItem extends WorkWidgetDefinition {
-
- public AtsAttributeSoleComboXWidgetWorkItem(ATSAttributes atsAttribute, String commaOptions, XOption... xOption) {
- super(atsAttribute.getDisplayName() + " - " + atsAttribute.getStoreName(), atsAttribute.getStoreName());
- DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
- data.setName(getName());
- data.setStorageName(getId());
- data.setXWidgetName("XComboDam(" + commaOptions + ")");
- data.getXOptionHandler().add(xOption);
- set(data);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsAttributeSoleComboXWidgetWorkItem extends WorkWidgetDefinition {
+
+ public AtsAttributeSoleComboXWidgetWorkItem(ATSAttributes atsAttribute, String commaOptions, XOption... xOption) {
+ super(atsAttribute.getDisplayName() + " - " + atsAttribute.getStoreName(), atsAttribute.getStoreName());
+ DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
+ data.setName(getName());
+ data.setStorageName(getId());
+ data.setXWidgetName("XComboDam(" + commaOptions + ")");
+ data.getXOptionHandler().add(xOption);
+ set(data);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeXWidgetWorkItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeXWidgetWorkItem.java
index e9e0939cabb..05e147c3d65 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeXWidgetWorkItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsAttributeXWidgetWorkItem.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsAttributeXWidgetWorkItem extends WorkWidgetDefinition {
-
- public AtsAttributeXWidgetWorkItem(String name, String id, String attributeTypeName, String xWidgetName, XOption... xOption) {
- super(name + " - " + id, id);
- DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
- data.setName(name);
- data.setId(id);
- data.setStorageName(attributeTypeName);
- data.setXWidgetName(xWidgetName);
- data.getXOptionHandler().add(xOption);
- set(data);
- }
-
- public AtsAttributeXWidgetWorkItem(ATSAttributes atsAttribute, String xWidgetName, XOption... xOption) {
- this(atsAttribute.getDisplayName(), atsAttribute.getStoreName(), atsAttribute.getStoreName(), xWidgetName,
- xOption);
- }
-
- public void setDefaultValue(String defaultValue) {
- DynamicXWidgetLayoutData data = get();
- data.setDefaultValue(defaultValue);
- set(data);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsAttributeXWidgetWorkItem extends WorkWidgetDefinition {
+
+ public AtsAttributeXWidgetWorkItem(String name, String id, String attributeTypeName, String xWidgetName, XOption... xOption) {
+ super(name + " - " + id, id);
+ DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
+ data.setName(name);
+ data.setId(id);
+ data.setStorageName(attributeTypeName);
+ data.setXWidgetName(xWidgetName);
+ data.getXOptionHandler().add(xOption);
+ set(data);
+ }
+
+ public AtsAttributeXWidgetWorkItem(ATSAttributes atsAttribute, String xWidgetName, XOption... xOption) {
+ this(atsAttribute.getDisplayName(), atsAttribute.getStoreName(), atsAttribute.getStoreName(), xWidgetName,
+ xOption);
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ DynamicXWidgetLayoutData data = get();
+ data.setDefaultValue(defaultValue);
+ set(data);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancellationReasonStateWorkItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancellationReasonStateWorkItem.java
index 122a9bbd9a7..a3d15e48594 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancellationReasonStateWorkItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancellationReasonStateWorkItem.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.LogItem;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsCancellationReasonStateWorkItem extends WorkWidgetDefinition {
-
- public static String ID = "ats.CancellationReason";
-
- protected AtsCancellationReasonStateWorkItem(StateMachineArtifact sma) throws OseeCoreException {
- super("Cancellation Reason", ID);
- DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
- data.setName(getName());
- LogItem item = sma.getLog().getStateEvent(LogType.StateCancelled);
- data.setDefaultValue(item.getMsg());
- data.setStorageName(getId());
- data.setXWidgetName("XText");
- data.getXOptionHandler().add(XOption.NOT_EDITABLE);
- data.getXOptionHandler().add(XOption.FILL_HORIZONTALLY);
- setXWidgetLayoutData(data);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.LogItem;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsCancellationReasonStateWorkItem extends WorkWidgetDefinition {
+
+ public static String ID = "ats.CancellationReason";
+
+ protected AtsCancellationReasonStateWorkItem(StateMachineArtifact sma) throws OseeCoreException {
+ super("Cancellation Reason", ID);
+ DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
+ data.setName(getName());
+ LogItem item = sma.getLog().getStateEvent(LogType.StateCancelled);
+ data.setDefaultValue(item.getMsg());
+ data.setStorageName(getId());
+ data.setXWidgetName("XText");
+ data.getXOptionHandler().add(XOption.NOT_EDITABLE);
+ data.getXOptionHandler().add(XOption.FILL_HORIZONTALLY);
+ setXWidgetLayoutData(data);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancelledFromStateWorkItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancelledFromStateWorkItem.java
index 58bb09cf7b1..86390721472 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancelledFromStateWorkItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCancelledFromStateWorkItem.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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.LogItem;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsCancelledFromStateWorkItem extends WorkWidgetDefinition {
-
- protected AtsCancelledFromStateWorkItem(StateMachineArtifact sma) throws OseeCoreException {
- super("Cancelled from State", "ats.CancelledFromState");
- DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
- data.setName(getName());
- LogItem item = sma.getLog().getStateEvent(LogType.StateCancelled);
- data.setDefaultValue(item.getState());
- data.setStorageName(getId());
- data.setXWidgetName("XText");
- data.getXOptionHandler().add(XOption.NOT_EDITABLE);
- data.getXOptionHandler().add(XOption.FILL_HORIZONTALLY);
- setXWidgetLayoutData(data);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.LogItem;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsCancelledFromStateWorkItem extends WorkWidgetDefinition {
+
+ protected AtsCancelledFromStateWorkItem(StateMachineArtifact sma) throws OseeCoreException {
+ super("Cancelled from State", "ats.CancelledFromState");
+ DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
+ data.setName(getName());
+ LogItem item = sma.getLog().getStateEvent(LogType.StateCancelled);
+ data.setDefaultValue(item.getState());
+ data.setStorageName(getId());
+ data.setXWidgetName("XText");
+ data.getXOptionHandler().add(XOption.NOT_EDITABLE);
+ data.getXOptionHandler().add(XOption.FILL_HORIZONTALLY);
+ setXWidgetLayoutData(data);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCompletedFromStateWorkItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCompletedFromStateWorkItem.java
index 713aae13f13..266ee335b22 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCompletedFromStateWorkItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsCompletedFromStateWorkItem.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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.LogItem;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsCompletedFromStateWorkItem extends WorkWidgetDefinition {
-
- protected AtsCompletedFromStateWorkItem(StateMachineArtifact sma) throws OseeCoreException {
- super("Completed from State", "ats.CompletedFromState");
- DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
- data.setName(getName());
- LogItem item = sma.getLog().getStateEvent(LogType.StateComplete);
- data.setDefaultValue(item.getState());
- data.setStorageName(getId());
- data.setXWidgetName("XText");
- data.getXOptionHandler().add(XOption.NOT_EDITABLE);
- data.getXOptionHandler().add(XOption.FILL_HORIZONTALLY);
- setXWidgetLayoutData(data);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.LogItem;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsCompletedFromStateWorkItem extends WorkWidgetDefinition {
+
+ protected AtsCompletedFromStateWorkItem(StateMachineArtifact sma) throws OseeCoreException {
+ super("Completed from State", "ats.CompletedFromState");
+ DynamicXWidgetLayoutData data = new DynamicXWidgetLayoutData(null);
+ data.setName(getName());
+ LogItem item = sma.getLog().getStateEvent(LogType.StateComplete);
+ data.setDefaultValue(item.getState());
+ data.setStorageName(getId());
+ data.setXWidgetName("XText");
+ data.getXOptionHandler().add(XOption.NOT_EDITABLE);
+ data.getXOptionHandler().add(XOption.FILL_HORIZONTALLY);
+ setXWidgetLayoutData(data);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDecisionReviewRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDecisionReviewRule.java
index 2261791b314..6c0077b7c09 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDecisionReviewRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDecisionReviewRule.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact.DecisionReviewState;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsStatePercentCompleteWeightDecisionReviewRule extends AtsStatePercentCompleteWeightRule {
-
- public static String ID = "atsStatePercentCompleteWeight.DecisionReview";
-
- public AtsStatePercentCompleteWeightDecisionReviewRule() {
- super(ID, ID);
- setDescription("State Percent Complete rule for Decision Review.");
- addWorkDataKeyValue(DecisionReviewState.Prepare.name(), ".20");
- addWorkDataKeyValue(DecisionReviewState.Decision.name(), ".69");
- addWorkDataKeyValue(DecisionReviewState.Followup.name(), ".09");
- addWorkDataKeyValue(DecisionReviewState.Completed.name(), ".01");
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact.DecisionReviewState;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsStatePercentCompleteWeightDecisionReviewRule extends AtsStatePercentCompleteWeightRule {
+
+ public static String ID = "atsStatePercentCompleteWeight.DecisionReview";
+
+ public AtsStatePercentCompleteWeightDecisionReviewRule() {
+ super(ID, ID);
+ setDescription("State Percent Complete rule for Decision Review.");
+ addWorkDataKeyValue(DecisionReviewState.Prepare.name(), ".20");
+ addWorkDataKeyValue(DecisionReviewState.Decision.name(), ".69");
+ addWorkDataKeyValue(DecisionReviewState.Followup.name(), ".09");
+ addWorkDataKeyValue(DecisionReviewState.Completed.name(), ".01");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDefaultWorkflowRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDefaultWorkflowRule.java
index 8d70459524e..ebfaa999977 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDefaultWorkflowRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightDefaultWorkflowRule.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsStatePercentCompleteWeightDefaultWorkflowRule extends AtsStatePercentCompleteWeightRule {
-
- public static String ID = "atsStatePercentCompleteWeight.DefaultWorkflow";
-
- public AtsStatePercentCompleteWeightDefaultWorkflowRule() {
- super(ID, ID);
- setDescription("State Percent Complete rule where Analyze and Implement states are where work is performed.");
- addWorkDataKeyValue(DefaultTeamState.Endorse.name(), ".05");
- addWorkDataKeyValue(DefaultTeamState.Analyze.name(), ".1");
- addWorkDataKeyValue(DefaultTeamState.Authorize.name(), ".05");
- addWorkDataKeyValue(DefaultTeamState.Implement.name(), ".79");
- addWorkDataKeyValue(DefaultTeamState.Completed.name(), ".01");
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsStatePercentCompleteWeightDefaultWorkflowRule extends AtsStatePercentCompleteWeightRule {
+
+ public static String ID = "atsStatePercentCompleteWeight.DefaultWorkflow";
+
+ public AtsStatePercentCompleteWeightDefaultWorkflowRule() {
+ super(ID, ID);
+ setDescription("State Percent Complete rule where Analyze and Implement states are where work is performed.");
+ addWorkDataKeyValue(DefaultTeamState.Endorse.name(), ".05");
+ addWorkDataKeyValue(DefaultTeamState.Analyze.name(), ".1");
+ addWorkDataKeyValue(DefaultTeamState.Authorize.name(), ".05");
+ addWorkDataKeyValue(DefaultTeamState.Implement.name(), ".79");
+ addWorkDataKeyValue(DefaultTeamState.Completed.name(), ".01");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightPeerToPeerReviewRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightPeerToPeerReviewRule.java
index 23ebb1d4e25..31bc7771987 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightPeerToPeerReviewRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightPeerToPeerReviewRule.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact.PeerToPeerReviewState;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsStatePercentCompleteWeightPeerToPeerReviewRule extends AtsStatePercentCompleteWeightRule {
-
- public static String ID = "atsStatePercentCompleteWeight.PeerToPeerReview";
-
- public AtsStatePercentCompleteWeightPeerToPeerReviewRule() {
- super(ID, ID);
- setDescription("State Percent Complete rule for PeerToPeer Review.");
- addWorkDataKeyValue(PeerToPeerReviewState.Prepare.name(), ".20");
- addWorkDataKeyValue(PeerToPeerReviewState.Review.name(), ".79");
- addWorkDataKeyValue(PeerToPeerReviewState.Completed.name(), ".01");
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact.PeerToPeerReviewState;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsStatePercentCompleteWeightPeerToPeerReviewRule extends AtsStatePercentCompleteWeightRule {
+
+ public static String ID = "atsStatePercentCompleteWeight.PeerToPeerReview";
+
+ public AtsStatePercentCompleteWeightPeerToPeerReviewRule() {
+ super(ID, ID);
+ setDescription("State Percent Complete rule for PeerToPeer Review.");
+ addWorkDataKeyValue(PeerToPeerReviewState.Prepare.name(), ".20");
+ addWorkDataKeyValue(PeerToPeerReviewState.Review.name(), ".79");
+ addWorkDataKeyValue(PeerToPeerReviewState.Completed.name(), ".01");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightRule.java
index c8aabe9f219..5e060274425 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightRule.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-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.ui.skynet.widgets.workflow.WorkRuleDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsStatePercentCompleteWeightRule extends WorkRuleDefinition {
-
- public static String ID = "atsStatePercentCompleteWeight";
-
- public AtsStatePercentCompleteWeightRule() {
- this(ID, ID);
- }
-
- public AtsStatePercentCompleteWeightRule(String name, String id) {
- super(name, id);
- setDescription("Work Flow Option: <state>=<percent> Work Data attributes specify weighting given to each state in percent complete calculations. <state> is either state name (not id) and <percent> is number from 0..1");
- }
-
- public static Map<String, Double> getStateWeightMap(WorkRuleDefinition workRuleDefinition) throws OseeCoreException {
- Map<String, Double> stateToWeight = new HashMap<String, Double>();
- for (String stateName : workRuleDefinition.getWorkDataKeyValueMap().keySet()) {
- String value = workRuleDefinition.getWorkDataValue(stateName);
- try {
- double percent = new Double(value).doubleValue();
- if (percent < 0.0 || percent > 1) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE,
- "Invalid percent value \"" + value + "\" (must be 0..1) for rule " + workRuleDefinition.getId(),
- new OseeArgumentException("state map exception"));
- } else {
- stateToWeight.put(stateName, percent);
- }
- } catch (Exception ex) {
- OseeLog.log(
- AtsPlugin.class,
- Level.SEVERE,
- "Invalid percent value \"" + value + "\" (must be float 0..1) for rule " + workRuleDefinition.getId(),
- new OseeArgumentException("state map exception"));
- }
- }
- return stateToWeight;
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+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.ui.skynet.widgets.workflow.WorkRuleDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsStatePercentCompleteWeightRule extends WorkRuleDefinition {
+
+ public static String ID = "atsStatePercentCompleteWeight";
+
+ public AtsStatePercentCompleteWeightRule() {
+ this(ID, ID);
+ }
+
+ public AtsStatePercentCompleteWeightRule(String name, String id) {
+ super(name, id);
+ setDescription("Work Flow Option: <state>=<percent> Work Data attributes specify weighting given to each state in percent complete calculations. <state> is either state name (not id) and <percent> is number from 0..1");
+ }
+
+ public static Map<String, Double> getStateWeightMap(WorkRuleDefinition workRuleDefinition) throws OseeCoreException {
+ Map<String, Double> stateToWeight = new HashMap<String, Double>();
+ for (String stateName : workRuleDefinition.getWorkDataKeyValueMap().keySet()) {
+ String value = workRuleDefinition.getWorkDataValue(stateName);
+ try {
+ double percent = new Double(value).doubleValue();
+ if (percent < 0.0 || percent > 1) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE,
+ "Invalid percent value \"" + value + "\" (must be 0..1) for rule " + workRuleDefinition.getId(),
+ new OseeArgumentException("state map exception"));
+ } else {
+ stateToWeight.put(stateName, percent);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(
+ AtsPlugin.class,
+ Level.SEVERE,
+ "Invalid percent value \"" + value + "\" (must be float 0..1) for rule " + workRuleDefinition.getId(),
+ new OseeArgumentException("state map exception"));
+ }
+ }
+ return stateToWeight;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightSimpleWorkflowRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightSimpleWorkflowRule.java
index 55e8fbdc42c..4191401a421 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightSimpleWorkflowRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsStatePercentCompleteWeightSimpleWorkflowRule.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-import org.eclipse.osee.ats.workflow.flow.SimpleWorkflowDefinition.SimpleState;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsStatePercentCompleteWeightSimpleWorkflowRule extends AtsStatePercentCompleteWeightRule {
-
- public static String ID = "atsStatePercentCompleteWeight.SimpleWorkflow";
-
- public AtsStatePercentCompleteWeightSimpleWorkflowRule() {
- super(ID, ID);
- setDescription("State Percent Complete rule where InWork work is performed.");
- addWorkDataKeyValue(SimpleState.Endorse.name(), ".10");
- addWorkDataKeyValue(SimpleState.InWork.name(), ".89");
- addWorkDataKeyValue(SimpleState.Completed.name(), ".01");
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import org.eclipse.osee.ats.workflow.flow.SimpleWorkflowDefinition.SimpleState;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsStatePercentCompleteWeightSimpleWorkflowRule extends AtsStatePercentCompleteWeightRule {
+
+ public static String ID = "atsStatePercentCompleteWeight.SimpleWorkflow";
+
+ public AtsStatePercentCompleteWeightSimpleWorkflowRule() {
+ super(ID, ID);
+ setDescription("State Percent Complete rule where InWork work is performed.");
+ addWorkDataKeyValue(SimpleState.Endorse.name(), ".10");
+ addWorkDataKeyValue(SimpleState.InWork.name(), ".89");
+ addWorkDataKeyValue(SimpleState.Completed.name(), ".01");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsWorkDefinitions.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsWorkDefinitions.java
index 1762bc190d2..bd7c39ed4c8 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsWorkDefinitions.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/AtsWorkDefinitions.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.ats.workflow.item;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
-import org.eclipse.osee.ats.artifact.GoalArtifact;
-import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.util.AtsFolderUtil;
-import org.eclipse.osee.ats.util.AtsFolderUtil.AtsFolder;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.widgets.XWorkingBranch;
-import org.eclipse.osee.ats.util.widgets.commit.XCommitManager;
-import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.flow.GoalWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.flow.PeerToPeerWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.flow.TaskWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.page.AtsDecisionDecisionWorkPageDefinition;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IWorkDefinitionProvider;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition.WriteType;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkRuleDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.XWidgetFactory;
-
-/**
- * Create all the default ATS work items. This keeps from having to create a class for each of these. Also implement
- * WorkDefinitionProvider which registers all definitions with the definitions factory
- *
- * @author Donald G. Dunne
- */
-public class AtsWorkDefinitions implements IWorkDefinitionProvider {
-
- public static String ATS_TITLE_ID = "ats.Title";
- public static String ATS_DESCRIPTION_NOT_REQUIRED_ID =
- ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName() + ".notRequired";
- public static String ATS_ESTIMATED_HOURS_NOT_REQUIRED_ID = ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE + ".notRequired";
- public static enum RuleWorkItemId {
- atsRequireStateHourSpentPrompt("Work Page Option: Will popup a dialog to prompt user for time spent in this state."),
- atsAddDecisionValidateBlockingReview("Work Page Option: Will auto-create a blocking decision review for this state requesting validation for this workflow."),
- atsAddDecisionValidateNonBlockingReview("Work Page Option: Will auto-create a non blocking decision review requesting validation of workflow changes."),
- atsAllowTransitionWithWorkingBranch("Work Page Option: Will allow transition to next state without committing current working branch."),
- atsForceAssigneesToTeamLeads("Work Page Option: Will force this state to be assigned back to the configured team leads. Useful for authorization state."),
- atsRequireTargetedVersion("Work Page and Team Definition Option: Requires workflow to be targeted for version before transition is allowed."),
- atsAllowPriviledgedEditToTeamMember("Work Page and Team Definition Option: Allow team member to priviledged edit workflow assigned to team."),
- atsAllowPriviledgedEditToTeamMemberAndOriginator("Work Page and Team Definition Option: Allow team member to priviledged edit workflow assigned to team if user is originator."),
- atsAllowPriviledgedEditToAll("Work Page and Team Definition Option: Allow anyone to priviledged edit workflow assigned to team."),
- atsAllowEditToAll("Work Page and Team Definition Option: Allow anyone to edit workflow without being assignee."),
- atsAllowAssigneeToAll("Work Page and Team Definition Option: Allow anyone to change workflow assignee without being assignee.");
-
- public final String description;
-
- public String getDescription() {
- return description;
- }
-
- private RuleWorkItemId(String description) {
- this.description = description;
- }
- }
-
- public static void relatePageToBranchCommitRules(String pageId) throws OseeCoreException {
- WorkItemDefinitionFactory.relateWorkItemDefinitions(pageId, XWorkingBranch.WIDGET_ID);
- WorkItemDefinitionFactory.relateWorkItemDefinitions(pageId, XCommitManager.WIDGET_ID);
- }
-
- public static List<WorkItemDefinition> getAtsWorkDefinitions() {
- List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
-
- // Create rule work items
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsRequireStateHourSpentPrompt.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAddDecisionValidateBlockingReview.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAddDecisionValidateNonBlockingReview.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowTransitionWithWorkingBranch.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsForceAssigneesToTeamLeads.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsRequireTargetedVersion.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowPriviledgedEditToTeamMember.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowPriviledgedEditToTeamMemberAndOriginator.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowPriviledgedEditToAll.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowEditToAll.name()));
- workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowAssigneeToAll.name()));
- workItems.add(new AtsAddDecisionReviewRule());
- workItems.add(new AtsAddPeerToPeerReviewRule());
- workItems.add(new AtsStatePercentCompleteWeightRule());
- workItems.add(new AtsStatePercentCompleteWeightDefaultWorkflowRule());
- workItems.add(new AtsStatePercentCompleteWeightSimpleWorkflowRule());
- workItems.add(new AtsStatePercentCompleteWeightDecisionReviewRule());
- workItems.add(new AtsStatePercentCompleteWeightPeerToPeerReviewRule());
-
- // Create XWidget work items
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.LOCATION_ATTRIBUTE, "XTextDam", XOption.REQUIRED,
- XOption.FILL_VERTICALLY));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE, "XTextDam"));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE, "XTextDam"));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.CATEGORY_ATTRIBUTE, "XTextDam"));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE, "XTextDam"));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.SMA_NOTE_ATTRIBUTE, "XTextDam",
- XOption.FILL_VERTICALLY));
- workItems.add(new AtsAttributeXWidgetWorkItem("Title", "ats.Title", "Name", "XTextDam", XOption.REQUIRED));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE, "XTextDam",
- XOption.FILL_VERTICALLY));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.DECISION_REVIEW_OPTIONS_ATTRIBUTE, "XTextDam",
- XOption.FILL_VERTICALLY));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.PROBLEM_ATTRIBUTE, "XTextDam",
- XOption.FILL_VERTICALLY));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE, "XTextDam",
- XOption.HORIZONTAL_LABEL));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.WORKING_BRANCH_WIDGET, "XWorkingBranch", XOption.NONE));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.VALIDATE_REQ_CHANGES_WIDGET,
- "XValidateReqChangesButton", XOption.NONE));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.CREATE_CODE_TEST_TASKS_OFF_REQUIREMENTS,
- "XCreateCodeTestTasksButton", XOption.NONE));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.CHECK_SIGNALS_VIA_CDB_WIDGET,
- "XCheckSiganlsViaCDBButton", XOption.NONE));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.SHOW_CDB_DIFF_REPORT_WIDGET,
- "XShowCdbDiffReportButton", XOption.NONE));
- workItems.add(new AtsAttributeXWidgetWorkItem("Question",
- AtsDecisionDecisionWorkPageDefinition.DECISION_QUESTION_LABEL, "Name", "XLabelDam"));
- workItems.add(new AtsAttributeXWidgetWorkItem("Decision",
- AtsDecisionDecisionWorkPageDefinition.DECISION_ANSWER_LABEL,
- ATSAttributes.DECISION_ATTRIBUTE.getStoreName(), "XLabelDam"));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.PROPOSED_RESOLUTION_ATTRIBUTE, "XTextDam",
- XOption.FILL_VERTICALLY));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.DESCRIPTION_ATTRIBUTE, "XTextDam", XOption.REQUIRED,
- XOption.FILL_VERTICALLY));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.DESCRIPTION_ATTRIBUTE.getDisplayName(),
- ATS_DESCRIPTION_NOT_REQUIRED_ID, ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName(), "XTextDam",
- XOption.NOT_REQUIRED, XOption.FILL_VERTICALLY));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.BLOCKING_REVIEW_ATTRIBUTE, "XComboBooleanDam",
- XOption.REQUIRED, XOption.HORIZONTAL_LABEL));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.REVIEW_BLOCKS_ATTRIBUTE,
- "XComboDam(OPTIONS_FROM_ATTRIBUTE_VALIDITY)", XOption.REQUIRED, XOption.HORIZONTAL_LABEL));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.DECISION_ATTRIBUTE, "XComboDam(1,2,3)",
- XOption.REQUIRED, XOption.HORIZONTAL_LABEL));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE, "XFloatDam",
- XOption.REQUIRED));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getDisplayName(),
- ATS_ESTIMATED_HOURS_NOT_REQUIRED_ID, ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName(), "XFloatDam",
- XOption.NOT_REQUIRED));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE, "XDateDam",
- XOption.HORIZONTAL_LABEL));
- workItems.add(new AtsAttributeSoleComboXWidgetWorkItem(ATSAttributes.CHANGE_TYPE_ATTRIBUTE,
- "OPTIONS_FROM_ATTRIBUTE_VALIDITY", XOption.REQUIRED, XOption.BEGIN_COMPOSITE_6));
- workItems.add(new AtsAttributeSoleComboXWidgetWorkItem(ATSAttributes.PRIORITY_TYPE_ATTRIBUTE,
- "OPTIONS_FROM_ATTRIBUTE_VALIDITY", XOption.REQUIRED));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE, "XDateDam",
- XOption.HORIZONTAL_LABEL, XOption.END_COMPOSITE));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.VALIDATION_REQUIRED_ATTRIBUTE, "XCheckBoxDam",
- XOption.HORIZONTAL_LABEL, XOption.LABEL_BEFORE));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.USER_COMMUNITY_ATTRIBUTE,
- "XListDam(OPTIONS_FROM_ATTRIBUTE_VALIDITY)", XOption.HORIZONTAL_LABEL));
- workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.COMMIT_MANAGER_WIDGET, "XCommitManager"));
- workItems.add(new AtsAttributeReviewDefectXWidgetWorkItem(ATSAttributes.REVIEW_DEFECT_ATTRIBUTE));
- workItems.add(new AtsAttributeReviewRolesXWidgetWorkItem(ATSAttributes.ROLE_ATTRIBUTE));
-
- return workItems;
- }
-
- @Override
- public Collection<WorkItemDefinition> getProgramaticWorkItemDefinitions() throws OseeCoreException {
- return new ArrayList<WorkItemDefinition>();
- }
-
- @Override
- public WorkFlowDefinition getWorkFlowDefinition(Artifact artifact) throws OseeCoreException {
- if (artifact instanceof TeamWorkFlowArtifact) {
- // return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(TeamWorkflowDefinition.ID);
- return ((TeamWorkFlowArtifact) artifact).getTeamDefinition().getWorkFlowDefinition();
- }
- if (artifact instanceof TaskArtifact) {
- return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(TaskWorkflowDefinition.ID);
- }
- if (artifact instanceof GoalArtifact) {
- return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(GoalWorkflowDefinition.ID);
- }
- if (artifact instanceof PeerToPeerReviewArtifact) {
- return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(PeerToPeerWorkflowDefinition.ID);
- }
- if (artifact instanceof DecisionReviewArtifact) {
- return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(DecisionWorkflowDefinition.ID);
- }
- return null;
- }
-
- public static boolean isValidatePage(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- if (workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsAddDecisionValidateBlockingReview.name()) != null) {
- return true;
- }
- if (workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsAddDecisionValidateNonBlockingReview.name()) != null) {
- return true;
- }
- return false;
- }
-
- public static boolean isValidateReviewBlocking(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- return workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsAddDecisionValidateBlockingReview.name()) != null;
- }
-
- public static boolean isForceAssigneesToTeamLeads(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- return workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsForceAssigneesToTeamLeads.name()) != null;
- }
-
- public static boolean isAllowTransitionWithWorkingBranch(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- return workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsAllowTransitionWithWorkingBranch.name()) != null;
- }
-
- public static boolean isRequireStateHoursSpentPrompt(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- return workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsRequireStateHourSpentPrompt.name()) != null;
- }
-
- public static boolean isAllowCreateBranch(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- return workPageDefinition.getWorkItemDefinition(ATSAttributes.WORKING_BRANCH_WIDGET.getStoreName()) != null;
- }
-
- public static boolean isAllowCommitBranch(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- return workPageDefinition.getWorkItemDefinition(ATSAttributes.COMMIT_MANAGER_WIDGET.getStoreName()) != null;
- }
-
- public static void importWorkItemDefinitionsIntoDb(WriteType writeType, XResultData resultData, WorkItemDefinition workItemDefinition) throws OseeCoreException {
- importWorkItemDefinitionsIntoDb(writeType, resultData,
- Arrays.asList(new WorkItemDefinition[] {workItemDefinition}));
- }
-
- public static void importWorkItemDefinitionsIntoDb(final WriteType writeType, final XResultData resultData, final Collection<? extends WorkItemDefinition> workItemDefinitions) throws OseeCoreException {
-
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Import ATS Work Item Definitions");
- // Items must be imported in order due to the relations that are created between items
- for (Class<?> clazz : new Class[] {WorkRuleDefinition.class, WorkWidgetDefinition.class,
- WorkPageDefinition.class, WorkFlowDefinition.class}) {
- for (WorkItemDefinition wid : workItemDefinitions) {
- if (clazz.isInstance(wid)) {
- // System.out.println("Adding " + wid.getId() + " as class " + clazz);
- Artifact art = wid.toArtifact(writeType);
- addUpdateWorkItemToDefaultHeirarchy(art, transaction);
- if (art.isDirty() && resultData != null) {
- resultData.log("Updated [" + art.getArtifactTypeName() + "][" + art + "]");
- }
- art.persist(transaction);
- }
- }
- }
- transaction.execute();
- }
-
- public static void addUpdateWorkItemToDefaultHeirarchy(Artifact art, SkynetTransaction transaction) throws OseeCoreException {
- // Relate if not already related
- if (art.getRelatedArtifacts(CoreRelationTypes.WorkItem__Parent, Artifact.class).isEmpty()) {
- if (art.isOfType(CoreArtifactTypes.WorkPageDefinition)) {
- relateIfNotRelated(AtsFolderUtil.getFolder(AtsFolder.WorkPages), art, transaction);
- }
- if (art.isOfType(CoreArtifactTypes.WorkRuleDefinition)) {
- relateIfNotRelated(AtsFolderUtil.getFolder(AtsFolder.WorkRules), art, transaction);
- }
- if (art.isOfType(CoreArtifactTypes.WorkWidgetDefinition)) {
- relateIfNotRelated(AtsFolderUtil.getFolder(AtsFolder.WorkWidgets), art, transaction);
- }
- if (art.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
- relateIfNotRelated(AtsFolderUtil.getFolder(AtsFolder.WorkFlow), art, transaction);
- }
- }
- }
-
- private static void relateIfNotRelated(Artifact parent, Artifact child, SkynetTransaction transaction) throws OseeCoreException {
- if (!parent.getChildren().contains(child) && !child.hasParent()) {
- parent.addChild(child);
- parent.persist(transaction);
- }
- }
-
- public static Result validateWorkItemDefinition(WorkItemDefinition workItemDefinition) {
- try {
- if (workItemDefinition instanceof WorkPageDefinition) {
- WorkPageDefinition workPageDefinition = (WorkPageDefinition) workItemDefinition;
- workPageDefinition.getWorkItems(true);
- }
- if (workItemDefinition instanceof WorkWidgetDefinition) {
- WorkWidgetDefinition workWidgetDefinition = (WorkWidgetDefinition) workItemDefinition;
- DynamicXWidgetLayoutData dynamicXWidgetLayoutData = workWidgetDefinition.get();
- XWidget xWidget = XWidgetFactory.getInstance().createXWidget(dynamicXWidgetLayoutData);
- if (xWidget == null) {
- throw new OseeStateException("XWidget.createXWidget came back null");
- }
- }
- if (workItemDefinition instanceof WorkFlowDefinition) {
- WorkFlowDefinition workFlowDefinition = (WorkFlowDefinition) workItemDefinition;
- if (workFlowDefinition.getPagesOrdered().isEmpty()) {
- throw new OseeStateException("Work Flow must have at least one state.");
- }
- if (workFlowDefinition.getStartPage() == null) {
- throw new OseeStateException("Work Flow must have a single start page");
- }
- }
- } catch (Exception ex) {
- return new Result(ex.getLocalizedMessage());
- }
- return Result.TrueResult;
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
+import org.eclipse.osee.ats.artifact.GoalArtifact;
+import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.util.AtsFolderUtil;
+import org.eclipse.osee.ats.util.AtsFolderUtil.AtsFolder;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.widgets.XWorkingBranch;
+import org.eclipse.osee.ats.util.widgets.commit.XCommitManager;
+import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.flow.GoalWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.flow.PeerToPeerWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.flow.TaskWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.page.AtsDecisionDecisionWorkPageDefinition;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IWorkDefinitionProvider;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition.WriteType;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkRuleDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.XWidgetFactory;
+
+/**
+ * Create all the default ATS work items. This keeps from having to create a class for each of these. Also implement
+ * WorkDefinitionProvider which registers all definitions with the definitions factory
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsWorkDefinitions implements IWorkDefinitionProvider {
+
+ public static String ATS_TITLE_ID = "ats.Title";
+ public static String ATS_DESCRIPTION_NOT_REQUIRED_ID =
+ ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName() + ".notRequired";
+ public static String ATS_ESTIMATED_HOURS_NOT_REQUIRED_ID = ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE + ".notRequired";
+ public static enum RuleWorkItemId {
+ atsRequireStateHourSpentPrompt("Work Page Option: Will popup a dialog to prompt user for time spent in this state."),
+ atsAddDecisionValidateBlockingReview("Work Page Option: Will auto-create a blocking decision review for this state requesting validation for this workflow."),
+ atsAddDecisionValidateNonBlockingReview("Work Page Option: Will auto-create a non blocking decision review requesting validation of workflow changes."),
+ atsAllowTransitionWithWorkingBranch("Work Page Option: Will allow transition to next state without committing current working branch."),
+ atsForceAssigneesToTeamLeads("Work Page Option: Will force this state to be assigned back to the configured team leads. Useful for authorization state."),
+ atsRequireTargetedVersion("Work Page and Team Definition Option: Requires workflow to be targeted for version before transition is allowed."),
+ atsAllowPriviledgedEditToTeamMember("Work Page and Team Definition Option: Allow team member to priviledged edit workflow assigned to team."),
+ atsAllowPriviledgedEditToTeamMemberAndOriginator("Work Page and Team Definition Option: Allow team member to priviledged edit workflow assigned to team if user is originator."),
+ atsAllowPriviledgedEditToAll("Work Page and Team Definition Option: Allow anyone to priviledged edit workflow assigned to team."),
+ atsAllowEditToAll("Work Page and Team Definition Option: Allow anyone to edit workflow without being assignee."),
+ atsAllowAssigneeToAll("Work Page and Team Definition Option: Allow anyone to change workflow assignee without being assignee.");
+
+ public final String description;
+
+ public String getDescription() {
+ return description;
+ }
+
+ private RuleWorkItemId(String description) {
+ this.description = description;
+ }
+ }
+
+ public static void relatePageToBranchCommitRules(String pageId) throws OseeCoreException {
+ WorkItemDefinitionFactory.relateWorkItemDefinitions(pageId, XWorkingBranch.WIDGET_ID);
+ WorkItemDefinitionFactory.relateWorkItemDefinitions(pageId, XCommitManager.WIDGET_ID);
+ }
+
+ public static List<WorkItemDefinition> getAtsWorkDefinitions() {
+ List<WorkItemDefinition> workItems = new ArrayList<WorkItemDefinition>();
+
+ // Create rule work items
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsRequireStateHourSpentPrompt.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAddDecisionValidateBlockingReview.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAddDecisionValidateNonBlockingReview.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowTransitionWithWorkingBranch.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsForceAssigneesToTeamLeads.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsRequireTargetedVersion.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowPriviledgedEditToTeamMember.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowPriviledgedEditToTeamMemberAndOriginator.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowPriviledgedEditToAll.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowEditToAll.name()));
+ workItems.add(new WorkRuleDefinition(RuleWorkItemId.atsAllowAssigneeToAll.name()));
+ workItems.add(new AtsAddDecisionReviewRule());
+ workItems.add(new AtsAddPeerToPeerReviewRule());
+ workItems.add(new AtsStatePercentCompleteWeightRule());
+ workItems.add(new AtsStatePercentCompleteWeightDefaultWorkflowRule());
+ workItems.add(new AtsStatePercentCompleteWeightSimpleWorkflowRule());
+ workItems.add(new AtsStatePercentCompleteWeightDecisionReviewRule());
+ workItems.add(new AtsStatePercentCompleteWeightPeerToPeerReviewRule());
+
+ // Create XWidget work items
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.LOCATION_ATTRIBUTE, "XTextDam", XOption.REQUIRED,
+ XOption.FILL_VERTICALLY));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE, "XTextDam"));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE, "XTextDam"));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.CATEGORY_ATTRIBUTE, "XTextDam"));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE, "XTextDam"));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.SMA_NOTE_ATTRIBUTE, "XTextDam",
+ XOption.FILL_VERTICALLY));
+ workItems.add(new AtsAttributeXWidgetWorkItem("Title", "ats.Title", "Name", "XTextDam", XOption.REQUIRED));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE, "XTextDam",
+ XOption.FILL_VERTICALLY));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.DECISION_REVIEW_OPTIONS_ATTRIBUTE, "XTextDam",
+ XOption.FILL_VERTICALLY));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.PROBLEM_ATTRIBUTE, "XTextDam",
+ XOption.FILL_VERTICALLY));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE, "XTextDam",
+ XOption.HORIZONTAL_LABEL));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.WORKING_BRANCH_WIDGET, "XWorkingBranch", XOption.NONE));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.VALIDATE_REQ_CHANGES_WIDGET,
+ "XValidateReqChangesButton", XOption.NONE));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.CREATE_CODE_TEST_TASKS_OFF_REQUIREMENTS,
+ "XCreateCodeTestTasksButton", XOption.NONE));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.CHECK_SIGNALS_VIA_CDB_WIDGET,
+ "XCheckSiganlsViaCDBButton", XOption.NONE));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.SHOW_CDB_DIFF_REPORT_WIDGET,
+ "XShowCdbDiffReportButton", XOption.NONE));
+ workItems.add(new AtsAttributeXWidgetWorkItem("Question",
+ AtsDecisionDecisionWorkPageDefinition.DECISION_QUESTION_LABEL, "Name", "XLabelDam"));
+ workItems.add(new AtsAttributeXWidgetWorkItem("Decision",
+ AtsDecisionDecisionWorkPageDefinition.DECISION_ANSWER_LABEL,
+ ATSAttributes.DECISION_ATTRIBUTE.getStoreName(), "XLabelDam"));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.PROPOSED_RESOLUTION_ATTRIBUTE, "XTextDam",
+ XOption.FILL_VERTICALLY));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.DESCRIPTION_ATTRIBUTE, "XTextDam", XOption.REQUIRED,
+ XOption.FILL_VERTICALLY));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.DESCRIPTION_ATTRIBUTE.getDisplayName(),
+ ATS_DESCRIPTION_NOT_REQUIRED_ID, ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName(), "XTextDam",
+ XOption.NOT_REQUIRED, XOption.FILL_VERTICALLY));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.BLOCKING_REVIEW_ATTRIBUTE, "XComboBooleanDam",
+ XOption.REQUIRED, XOption.HORIZONTAL_LABEL));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.REVIEW_BLOCKS_ATTRIBUTE,
+ "XComboDam(OPTIONS_FROM_ATTRIBUTE_VALIDITY)", XOption.REQUIRED, XOption.HORIZONTAL_LABEL));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.DECISION_ATTRIBUTE, "XComboDam(1,2,3)",
+ XOption.REQUIRED, XOption.HORIZONTAL_LABEL));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE, "XFloatDam",
+ XOption.REQUIRED));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getDisplayName(),
+ ATS_ESTIMATED_HOURS_NOT_REQUIRED_ID, ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName(), "XFloatDam",
+ XOption.NOT_REQUIRED));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE, "XDateDam",
+ XOption.HORIZONTAL_LABEL));
+ workItems.add(new AtsAttributeSoleComboXWidgetWorkItem(ATSAttributes.CHANGE_TYPE_ATTRIBUTE,
+ "OPTIONS_FROM_ATTRIBUTE_VALIDITY", XOption.REQUIRED, XOption.BEGIN_COMPOSITE_6));
+ workItems.add(new AtsAttributeSoleComboXWidgetWorkItem(ATSAttributes.PRIORITY_TYPE_ATTRIBUTE,
+ "OPTIONS_FROM_ATTRIBUTE_VALIDITY", XOption.REQUIRED));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE, "XDateDam",
+ XOption.HORIZONTAL_LABEL, XOption.END_COMPOSITE));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.VALIDATION_REQUIRED_ATTRIBUTE, "XCheckBoxDam",
+ XOption.HORIZONTAL_LABEL, XOption.LABEL_BEFORE));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.USER_COMMUNITY_ATTRIBUTE,
+ "XListDam(OPTIONS_FROM_ATTRIBUTE_VALIDITY)", XOption.HORIZONTAL_LABEL));
+ workItems.add(new AtsAttributeXWidgetWorkItem(ATSAttributes.COMMIT_MANAGER_WIDGET, "XCommitManager"));
+ workItems.add(new AtsAttributeReviewDefectXWidgetWorkItem(ATSAttributes.REVIEW_DEFECT_ATTRIBUTE));
+ workItems.add(new AtsAttributeReviewRolesXWidgetWorkItem(ATSAttributes.ROLE_ATTRIBUTE));
+
+ return workItems;
+ }
+
+ @Override
+ public Collection<WorkItemDefinition> getProgramaticWorkItemDefinitions() throws OseeCoreException {
+ return new ArrayList<WorkItemDefinition>();
+ }
+
+ @Override
+ public WorkFlowDefinition getWorkFlowDefinition(Artifact artifact) throws OseeCoreException {
+ if (artifact instanceof TeamWorkFlowArtifact) {
+ // return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(TeamWorkflowDefinition.ID);
+ return ((TeamWorkFlowArtifact) artifact).getTeamDefinition().getWorkFlowDefinition();
+ }
+ if (artifact instanceof TaskArtifact) {
+ return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(TaskWorkflowDefinition.ID);
+ }
+ if (artifact instanceof GoalArtifact) {
+ return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(GoalWorkflowDefinition.ID);
+ }
+ if (artifact instanceof PeerToPeerReviewArtifact) {
+ return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(PeerToPeerWorkflowDefinition.ID);
+ }
+ if (artifact instanceof DecisionReviewArtifact) {
+ return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(DecisionWorkflowDefinition.ID);
+ }
+ return null;
+ }
+
+ public static boolean isValidatePage(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ if (workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsAddDecisionValidateBlockingReview.name()) != null) {
+ return true;
+ }
+ if (workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsAddDecisionValidateNonBlockingReview.name()) != null) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isValidateReviewBlocking(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ return workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsAddDecisionValidateBlockingReview.name()) != null;
+ }
+
+ public static boolean isForceAssigneesToTeamLeads(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ return workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsForceAssigneesToTeamLeads.name()) != null;
+ }
+
+ public static boolean isAllowTransitionWithWorkingBranch(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ return workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsAllowTransitionWithWorkingBranch.name()) != null;
+ }
+
+ public static boolean isRequireStateHoursSpentPrompt(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ return workPageDefinition.getWorkItemDefinition(AtsWorkDefinitions.RuleWorkItemId.atsRequireStateHourSpentPrompt.name()) != null;
+ }
+
+ public static boolean isAllowCreateBranch(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ return workPageDefinition.getWorkItemDefinition(ATSAttributes.WORKING_BRANCH_WIDGET.getStoreName()) != null;
+ }
+
+ public static boolean isAllowCommitBranch(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ return workPageDefinition.getWorkItemDefinition(ATSAttributes.COMMIT_MANAGER_WIDGET.getStoreName()) != null;
+ }
+
+ public static void importWorkItemDefinitionsIntoDb(WriteType writeType, XResultData resultData, WorkItemDefinition workItemDefinition) throws OseeCoreException {
+ importWorkItemDefinitionsIntoDb(writeType, resultData,
+ Arrays.asList(new WorkItemDefinition[] {workItemDefinition}));
+ }
+
+ public static void importWorkItemDefinitionsIntoDb(final WriteType writeType, final XResultData resultData, final Collection<? extends WorkItemDefinition> workItemDefinitions) throws OseeCoreException {
+
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Import ATS Work Item Definitions");
+ // Items must be imported in order due to the relations that are created between items
+ for (Class<?> clazz : new Class[] {WorkRuleDefinition.class, WorkWidgetDefinition.class,
+ WorkPageDefinition.class, WorkFlowDefinition.class}) {
+ for (WorkItemDefinition wid : workItemDefinitions) {
+ if (clazz.isInstance(wid)) {
+ // System.out.println("Adding " + wid.getId() + " as class " + clazz);
+ Artifact art = wid.toArtifact(writeType);
+ addUpdateWorkItemToDefaultHeirarchy(art, transaction);
+ if (art.isDirty() && resultData != null) {
+ resultData.log("Updated [" + art.getArtifactTypeName() + "][" + art + "]");
+ }
+ art.persist(transaction);
+ }
+ }
+ }
+ transaction.execute();
+ }
+
+ public static void addUpdateWorkItemToDefaultHeirarchy(Artifact art, SkynetTransaction transaction) throws OseeCoreException {
+ // Relate if not already related
+ if (art.getRelatedArtifacts(CoreRelationTypes.WorkItem__Parent, Artifact.class).isEmpty()) {
+ if (art.isOfType(CoreArtifactTypes.WorkPageDefinition)) {
+ relateIfNotRelated(AtsFolderUtil.getFolder(AtsFolder.WorkPages), art, transaction);
+ }
+ if (art.isOfType(CoreArtifactTypes.WorkRuleDefinition)) {
+ relateIfNotRelated(AtsFolderUtil.getFolder(AtsFolder.WorkRules), art, transaction);
+ }
+ if (art.isOfType(CoreArtifactTypes.WorkWidgetDefinition)) {
+ relateIfNotRelated(AtsFolderUtil.getFolder(AtsFolder.WorkWidgets), art, transaction);
+ }
+ if (art.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
+ relateIfNotRelated(AtsFolderUtil.getFolder(AtsFolder.WorkFlow), art, transaction);
+ }
+ }
+ }
+
+ private static void relateIfNotRelated(Artifact parent, Artifact child, SkynetTransaction transaction) throws OseeCoreException {
+ if (!parent.getChildren().contains(child) && !child.hasParent()) {
+ parent.addChild(child);
+ parent.persist(transaction);
+ }
+ }
+
+ public static Result validateWorkItemDefinition(WorkItemDefinition workItemDefinition) {
+ try {
+ if (workItemDefinition instanceof WorkPageDefinition) {
+ WorkPageDefinition workPageDefinition = (WorkPageDefinition) workItemDefinition;
+ workPageDefinition.getWorkItems(true);
+ }
+ if (workItemDefinition instanceof WorkWidgetDefinition) {
+ WorkWidgetDefinition workWidgetDefinition = (WorkWidgetDefinition) workItemDefinition;
+ DynamicXWidgetLayoutData dynamicXWidgetLayoutData = workWidgetDefinition.get();
+ XWidget xWidget = XWidgetFactory.getInstance().createXWidget(dynamicXWidgetLayoutData);
+ if (xWidget == null) {
+ throw new OseeStateException("XWidget.createXWidget came back null");
+ }
+ }
+ if (workItemDefinition instanceof WorkFlowDefinition) {
+ WorkFlowDefinition workFlowDefinition = (WorkFlowDefinition) workItemDefinition;
+ if (workFlowDefinition.getPagesOrdered().isEmpty()) {
+ throw new OseeStateException("Work Flow must have at least one state.");
+ }
+ if (workFlowDefinition.getStartPage() == null) {
+ throw new OseeStateException("Work Flow must have a single start page");
+ }
+ }
+ } catch (Exception ex) {
+ return new Result(ex.getLocalizedMessage());
+ }
+ return Result.TrueResult;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/StateEventType.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/StateEventType.java
index fde34782aad..f067c4da9cf 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/StateEventType.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/item/StateEventType.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * 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.ats.workflow.item;
-
-/**
- * @author Donald G. Dunne
- */
-public enum StateEventType {
- TransitionTo, CreateBranch, CommitBranch;
-}
+/*******************************************************************************
+ * 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.ats.workflow.item;
+
+/**
+ * @author Donald G. Dunne
+ */
+public enum StateEventType {
+ TransitionTo, CreateBranch, CommitBranch;
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAnalyzeWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAnalyzeWorkPageDefinition.java
index b1f9b3779f1..aac134c89ee 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAnalyzeWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAnalyzeWorkPageDefinition.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * 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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsAnalyzeWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Analyze.name();
-
- public AtsAnalyzeWorkPageDefinition() {
- this(DefaultTeamState.Analyze.name(), ID, null);
- }
-
- public AtsAnalyzeWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
- addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.PROBLEM_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.PROPOSED_RESOLUTION_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.CHANGE_TYPE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.PRIORITY_TYPE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsAnalyzeWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Analyze.name();
+
+ public AtsAnalyzeWorkPageDefinition() {
+ this(DefaultTeamState.Analyze.name(), ID, null);
+ }
+
+ public AtsAnalyzeWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
+ addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.PROBLEM_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.PROPOSED_RESOLUTION_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.CHANGE_TYPE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.PRIORITY_TYPE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAuthorizeWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAuthorizeWorkPageDefinition.java
index 0f084b65d87..3147778024f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAuthorizeWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsAuthorizeWorkPageDefinition.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * 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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsAuthorizeWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Authorize.name();
-
- public AtsAuthorizeWorkPageDefinition() {
- this(DefaultTeamState.Authorize.name(), ID, null);
- }
-
- public AtsAuthorizeWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsAuthorizeWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Authorize.name();
+
+ public AtsAuthorizeWorkPageDefinition() {
+ this(DefaultTeamState.Authorize.name(), ID, null);
+ }
+
+ public AtsAuthorizeWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCancelledWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCancelledWorkPageDefinition.java
index 79300b2edb1..e7d626e1d62 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCancelledWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCancelledWorkPageDefinition.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * 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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsCancelledWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Cancelled.name();
-
- public AtsCancelledWorkPageDefinition() {
- this(DefaultTeamState.Cancelled.name(), ID, null);
- }
-
- public AtsCancelledWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsCancelledWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Cancelled.name();
+
+ public AtsCancelledWorkPageDefinition() {
+ this(DefaultTeamState.Cancelled.name(), ID, null);
+ }
+
+ public AtsCancelledWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCompletedWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCompletedWorkPageDefinition.java
index 3db5268bc8a..79f77bd2f8a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCompletedWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsCompletedWorkPageDefinition.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsCompletedWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Completed.name();
-
- public AtsCompletedWorkPageDefinition() {
- this(DefaultTeamState.Completed.name(), ID, null);
- }
-
- public AtsCompletedWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(RuleWorkItemId.atsAddDecisionValidateBlockingReview.name());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsCompletedWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Completed.name();
+
+ public AtsCompletedWorkPageDefinition() {
+ this(DefaultTeamState.Completed.name(), ID, null);
+ }
+
+ public AtsCompletedWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(RuleWorkItemId.atsAddDecisionValidateBlockingReview.name());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionCompletedWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionCompletedWorkPageDefinition.java
index 4d44e530bbc..9b79e8a4d70 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionCompletedWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionCompletedWorkPageDefinition.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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsDecisionCompletedWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = DecisionWorkflowDefinition.ID + "." + DefaultTeamState.Completed.name();
-
- public AtsDecisionCompletedWorkPageDefinition() {
- this(DefaultTeamState.Completed.name(), ID, null);
- }
-
- public AtsDecisionCompletedWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(RuleWorkItemId.atsAddDecisionValidateBlockingReview.name());
- addWorkItem(AtsDecisionDecisionWorkPageDefinition.DECISION_QUESTION_LABEL);
- addWorkItem(AtsDecisionDecisionWorkPageDefinition.DECISION_ANSWER_LABEL);
- addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsDecisionCompletedWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = DecisionWorkflowDefinition.ID + "." + DefaultTeamState.Completed.name();
+
+ public AtsDecisionCompletedWorkPageDefinition() {
+ this(DefaultTeamState.Completed.name(), ID, null);
+ }
+
+ public AtsDecisionCompletedWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(RuleWorkItemId.atsAddDecisionValidateBlockingReview.name());
+ addWorkItem(AtsDecisionDecisionWorkPageDefinition.DECISION_QUESTION_LABEL);
+ addWorkItem(AtsDecisionDecisionWorkPageDefinition.DECISION_ANSWER_LABEL);
+ addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionDecisionWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionDecisionWorkPageDefinition.java
index 6652359662e..626662bb3e1 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionDecisionWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionDecisionWorkPageDefinition.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * 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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
-import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsDecisionDecisionWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID =
- DecisionWorkflowDefinition.ID + "." + DecisionReviewArtifact.DecisionReviewState.Decision.name();
- public static String DECISION_QUESTION_LABEL = "ats.Decision Question";
- public static String DECISION_ANSWER_LABEL = "ats.Decision Answer";
-
- public AtsDecisionDecisionWorkPageDefinition() {
- this(DecisionReviewArtifact.DecisionReviewState.Decision.name(), ID, null);
- }
-
- public AtsDecisionDecisionWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(AtsDecisionDecisionWorkPageDefinition.DECISION_QUESTION_LABEL);
- addWorkItem(ATSAttributes.DECISION_ATTRIBUTE.getStoreName());
- addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
- addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
+import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsDecisionDecisionWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID =
+ DecisionWorkflowDefinition.ID + "." + DecisionReviewArtifact.DecisionReviewState.Decision.name();
+ public static String DECISION_QUESTION_LABEL = "ats.Decision Question";
+ public static String DECISION_ANSWER_LABEL = "ats.Decision Answer";
+
+ public AtsDecisionDecisionWorkPageDefinition() {
+ this(DecisionReviewArtifact.DecisionReviewState.Decision.name(), ID, null);
+ }
+
+ public AtsDecisionDecisionWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(AtsDecisionDecisionWorkPageDefinition.DECISION_QUESTION_LABEL);
+ addWorkItem(ATSAttributes.DECISION_ATTRIBUTE.getStoreName());
+ addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
+ addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionFollowupWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionFollowupWorkPageDefinition.java
index 0f0b60169cf..2aef67992bb 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionFollowupWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionFollowupWorkPageDefinition.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
-import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsDecisionFollowupWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = DecisionWorkflowDefinition.ID + "." + DecisionReviewArtifact.DecisionReviewState.Followup.name();
-
- public AtsDecisionFollowupWorkPageDefinition() {
- this(DecisionReviewArtifact.DecisionReviewState.Followup.name(), ID, null);
- }
-
- public AtsDecisionFollowupWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
+import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsDecisionFollowupWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = DecisionWorkflowDefinition.ID + "." + DecisionReviewArtifact.DecisionReviewState.Followup.name();
+
+ public AtsDecisionFollowupWorkPageDefinition() {
+ this(DecisionReviewArtifact.DecisionReviewState.Followup.name(), ID, null);
+ }
+
+ public AtsDecisionFollowupWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionPrepareWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionPrepareWorkPageDefinition.java
index 157ad5355b1..043d4a3529f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionPrepareWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsDecisionPrepareWorkPageDefinition.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * 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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
-import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsDecisionPrepareWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = DecisionWorkflowDefinition.ID + "." + DecisionReviewArtifact.DecisionReviewState.Prepare.name();
-
- public AtsDecisionPrepareWorkPageDefinition() {
- this(DecisionReviewArtifact.DecisionReviewState.Prepare.name(), ID, null);
- }
-
- public AtsDecisionPrepareWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem("ats.Title");
- addWorkItem(ATSAttributes.DECISION_REVIEW_OPTIONS_ATTRIBUTE.getStoreName());
- addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
- addWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.REVIEW_BLOCKS_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
+import org.eclipse.osee.ats.workflow.flow.DecisionWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsDecisionPrepareWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = DecisionWorkflowDefinition.ID + "." + DecisionReviewArtifact.DecisionReviewState.Prepare.name();
+
+ public AtsDecisionPrepareWorkPageDefinition() {
+ this(DecisionReviewArtifact.DecisionReviewState.Prepare.name(), ID, null);
+ }
+
+ public AtsDecisionPrepareWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem("ats.Title");
+ addWorkItem(ATSAttributes.DECISION_REVIEW_OPTIONS_ATTRIBUTE.getStoreName());
+ addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
+ addWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.REVIEW_BLOCKS_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsEndorseWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsEndorseWorkPageDefinition.java
index 4b2bb99aca1..0dfc86a41a5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsEndorseWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsEndorseWorkPageDefinition.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsEndorseWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Endorse.name();
-
- public AtsEndorseWorkPageDefinition() {
- this(DefaultTeamState.Endorse.name(), ID, null);
- }
-
- public AtsEndorseWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
- addWorkItem("ats.Title");
- addWorkItem(ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.PROPOSED_RESOLUTION_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.CHANGE_TYPE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.PRIORITY_TYPE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.VALIDATION_REQUIRED_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.USER_COMMUNITY_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsEndorseWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Endorse.name();
+
+ public AtsEndorseWorkPageDefinition() {
+ this(DefaultTeamState.Endorse.name(), ID, null);
+ }
+
+ public AtsEndorseWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
+ addWorkItem("ats.Title");
+ addWorkItem(ATSAttributes.DESCRIPTION_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.PROPOSED_RESOLUTION_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.CHANGE_TYPE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.PRIORITY_TYPE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.VALIDATION_REQUIRED_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.USER_COMMUNITY_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsGoalInWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsGoalInWorkPageDefinition.java
index b70aa2d7f18..d5e74913da6 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsGoalInWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsGoalInWorkPageDefinition.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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.GoalArtifact.GoalState;
-import org.eclipse.osee.ats.workflow.flow.GoalWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsGoalInWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = GoalWorkflowDefinition.ID + "." + GoalState.InWork.name();
-
- public AtsGoalInWorkPageDefinition() {
- this(GoalState.InWork.name(), ID, null);
- }
-
- public AtsGoalInWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem("ats.Title");
- addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
- addWorkItem(AtsWorkDefinitions.ATS_ESTIMATED_HOURS_NOT_REQUIRED_ID);
- addWorkItem(ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.GoalArtifact.GoalState;
+import org.eclipse.osee.ats.workflow.flow.GoalWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsGoalInWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = GoalWorkflowDefinition.ID + "." + GoalState.InWork.name();
+
+ public AtsGoalInWorkPageDefinition() {
+ this(GoalState.InWork.name(), ID, null);
+ }
+
+ public AtsGoalInWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem("ats.Title");
+ addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
+ addWorkItem(AtsWorkDefinitions.ATS_ESTIMATED_HOURS_NOT_REQUIRED_ID);
+ addWorkItem(ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsImplementWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsImplementWorkPageDefinition.java
index 66703238abd..274ebb3b3fa 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsImplementWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsImplementWorkPageDefinition.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * 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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsImplementWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Implement.name();
-
- public AtsImplementWorkPageDefinition() {
- this(DefaultTeamState.Implement.name(), ID, null);
- }
-
- public AtsImplementWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
- addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.workflow.flow.TeamWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsImplementWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = TeamWorkflowDefinition.ID + "." + DefaultTeamState.Implement.name();
+
+ public AtsImplementWorkPageDefinition() {
+ this(DefaultTeamState.Implement.name(), ID, null);
+ }
+
+ public AtsImplementWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
+ addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerPrepareWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerPrepareWorkPageDefinition.java
index 1a541778c88..2f7e0b5a3c1 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerPrepareWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerPrepareWorkPageDefinition.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * 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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
-import org.eclipse.osee.ats.workflow.flow.PeerToPeerWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsPeerPrepareWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = PeerToPeerWorkflowDefinition.ID + "." + PeerToPeerReviewArtifact.PeerToPeerReviewState.Prepare.name();
-
- public AtsPeerPrepareWorkPageDefinition() {
- this(PeerToPeerReviewArtifact.PeerToPeerReviewState.Prepare.name(), ID, null);
- }
-
- public AtsPeerPrepareWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem("ats.Title");
- addWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.ROLE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.LOCATION_ATTRIBUTE.getStoreName());
- addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
- addWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.REVIEW_BLOCKS_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
+import org.eclipse.osee.ats.workflow.flow.PeerToPeerWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsPeerPrepareWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = PeerToPeerWorkflowDefinition.ID + "." + PeerToPeerReviewArtifact.PeerToPeerReviewState.Prepare.name();
+
+ public AtsPeerPrepareWorkPageDefinition() {
+ this(PeerToPeerReviewArtifact.PeerToPeerReviewState.Prepare.name(), ID, null);
+ }
+
+ public AtsPeerPrepareWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem("ats.Title");
+ addWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.ROLE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.LOCATION_ATTRIBUTE.getStoreName());
+ addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
+ addWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.REVIEW_BLOCKS_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.NEED_BY_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerReviewWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerReviewWorkPageDefinition.java
index 9611922a4d4..da1639a65b2 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerReviewWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsPeerReviewWorkPageDefinition.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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
-import org.eclipse.osee.ats.workflow.flow.PeerToPeerWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsPeerReviewWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = PeerToPeerWorkflowDefinition.ID + "." + PeerToPeerReviewArtifact.PeerToPeerReviewState.Review.name();
-
- public AtsPeerReviewWorkPageDefinition() {
- this(PeerToPeerReviewArtifact.PeerToPeerReviewState.Review.name(), ID, null);
- }
-
- public AtsPeerReviewWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(ATSAttributes.ROLE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.REVIEW_DEFECT_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
- addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
+import org.eclipse.osee.ats.workflow.flow.PeerToPeerWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsPeerReviewWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = PeerToPeerWorkflowDefinition.ID + "." + PeerToPeerReviewArtifact.PeerToPeerReviewState.Review.name();
+
+ public AtsPeerReviewWorkPageDefinition() {
+ this(PeerToPeerReviewArtifact.PeerToPeerReviewState.Review.name(), ID, null);
+ }
+
+ public AtsPeerReviewWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(ATSAttributes.ROLE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.REVIEW_DEFECT_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+ addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsSimpleInWorkWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsSimpleInWorkWorkPageDefinition.java
index 480c6708eda..973eda373b5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsSimpleInWorkWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsSimpleInWorkWorkPageDefinition.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * 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.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.workflow.flow.SimpleWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.flow.SimpleWorkflowDefinition.SimpleState;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsSimpleInWorkWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = SimpleWorkflowDefinition.ID + "." + SimpleState.InWork.name();
-
- public AtsSimpleInWorkWorkPageDefinition() {
- this(SimpleState.InWork.name(), ID, null);
- }
-
- public AtsSimpleInWorkWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
- addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.workflow.flow.SimpleWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.flow.SimpleWorkflowDefinition.SimpleState;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsSimpleInWorkWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = SimpleWorkflowDefinition.ID + "." + SimpleState.InWork.name();
+
+ public AtsSimpleInWorkWorkPageDefinition() {
+ this(SimpleState.InWork.name(), ID, null);
+ }
+
+ public AtsSimpleInWorkWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
+ addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsTaskInWorkPageDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsTaskInWorkPageDefinition.java
index dd8d0949a14..5cb58a2605b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsTaskInWorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/page/AtsTaskInWorkPageDefinition.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.workflow.page;
-
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.TaskArtifact.TaskStates;
-import org.eclipse.osee.ats.workflow.flow.TaskWorkflowDefinition;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsTaskInWorkPageDefinition extends WorkPageDefinition {
-
- public static String ID = TaskWorkflowDefinition.ID + "." + TaskStates.InWork.name();
-
- public AtsTaskInWorkPageDefinition() {
- this(TaskStates.InWork.name(), ID, null);
- }
-
- public AtsTaskInWorkPageDefinition(String name, String pageId, String parentId) {
- super(name, pageId, parentId);
- addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
- addWorkItem("ats.Title");
- addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
- addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.SMA_NOTE_ATTRIBUTE.getStoreName());
- addWorkItem(ATSAttributes.CATEGORY_ATTRIBUTE.getStoreName());
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.page;
+
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TaskArtifact.TaskStates;
+import org.eclipse.osee.ats.workflow.flow.TaskWorkflowDefinition;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPageDefinition;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsTaskInWorkPageDefinition extends WorkPageDefinition {
+
+ public static String ID = TaskWorkflowDefinition.ID + "." + TaskStates.InWork.name();
+
+ public AtsTaskInWorkPageDefinition() {
+ this(TaskStates.InWork.name(), ID, null);
+ }
+
+ public AtsTaskInWorkPageDefinition(String name, String pageId, String parentId) {
+ super(name, pageId, parentId);
+ addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
+ addWorkItem("ats.Title");
+ addWorkItem(AtsWorkDefinitions.ATS_DESCRIPTION_NOT_REQUIRED_ID);
+ addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.RELATED_TO_STATE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.SMA_NOTE_ATTRIBUTE.getStoreName());
+ addWorkItem(ATSAttributes.CATEGORY_ATTRIBUTE.getStoreName());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/AtsDbConfig.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/AtsDbConfig.java
index f29e1d898b0..31299a32194 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/AtsDbConfig.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/AtsDbConfig.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * 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.ats.workflow.vue;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AtsDbConfig {
-
- protected void executeLoadAIsAndTeamsAction(String bundleId) throws OseeCoreException {
- LoadAIsAndTeamsAction.executeForDbConfig(bundleId);
- }
-}
+/*******************************************************************************
+ * 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.ats.workflow.vue;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AtsDbConfig {
+
+ protected void executeLoadAIsAndTeamsAction(String bundleId) throws OseeCoreException {
+ LoadAIsAndTeamsAction.executeForDbConfig(bundleId);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/Diagram.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/Diagram.java
index 22314792310..7c10d4161a7 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/Diagram.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/Diagram.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * 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.ats.workflow.vue;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Donald G. Dunne
- */
-public class Diagram {
-
- protected List<DiagramNode> nodes = new ArrayList<DiagramNode>();
- private Set<String> nodeNames = new HashSet<String>();
- private String id;
- private String inheritData;
-
- public Diagram(String id) {
- super();
- this.id = id;
- }
-
- public Set<String> getPageNames() {
- if (nodeNames.isEmpty()) {
- for (DiagramNode page : nodes)
- nodeNames.add(page.getName());
- }
- return nodeNames;
- }
-
- public void addPage(DiagramNode page) {
- nodes.add(page);
- }
-
- public DiagramNode getPage(String pageName) throws OseeCoreException {
- List<DiagramNode> pages = getPages(pageName);
- if (pages.size() > 1) throw new OseeArgumentException(
- "Multiple node of same name found in workflow => " + getId() + " Use getPages.");
- return pages.iterator().next();
- }
-
- public List<DiagramNode> getPages(String pageName) throws OseeCoreException {
- List<DiagramNode> foundPages = new ArrayList<DiagramNode>();
- for (DiagramNode page : nodes)
- if (page.getName().equals(pageName)) foundPages.add(page);
- if (foundPages.isEmpty()) throw new OseeArgumentException(
- "Invalid node Name \"" + pageName + "\" from workflow => " + getId());
- return foundPages;
- }
-
- public DiagramNode getPageFromId(String id) {
- for (DiagramNode page : nodes)
- if (page.getId().equals(id)) return page;
- return null;
- }
-
- public Collection<DiagramNode> getPages() {
- return nodes;
- }
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return the inheritData
- */
- public String getInheritData() {
- return inheritData;
- }
-
- /**
- * @param inheritData the inheritData to set
- */
- public void setInheritData(String inheritData) {
- this.inheritData = inheritData;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.vue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class Diagram {
+
+ protected List<DiagramNode> nodes = new ArrayList<DiagramNode>();
+ private Set<String> nodeNames = new HashSet<String>();
+ private String id;
+ private String inheritData;
+
+ public Diagram(String id) {
+ super();
+ this.id = id;
+ }
+
+ public Set<String> getPageNames() {
+ if (nodeNames.isEmpty()) {
+ for (DiagramNode page : nodes)
+ nodeNames.add(page.getName());
+ }
+ return nodeNames;
+ }
+
+ public void addPage(DiagramNode page) {
+ nodes.add(page);
+ }
+
+ public DiagramNode getPage(String pageName) throws OseeCoreException {
+ List<DiagramNode> pages = getPages(pageName);
+ if (pages.size() > 1) throw new OseeArgumentException(
+ "Multiple node of same name found in workflow => " + getId() + " Use getPages.");
+ return pages.iterator().next();
+ }
+
+ public List<DiagramNode> getPages(String pageName) throws OseeCoreException {
+ List<DiagramNode> foundPages = new ArrayList<DiagramNode>();
+ for (DiagramNode page : nodes)
+ if (page.getName().equals(pageName)) foundPages.add(page);
+ if (foundPages.isEmpty()) throw new OseeArgumentException(
+ "Invalid node Name \"" + pageName + "\" from workflow => " + getId());
+ return foundPages;
+ }
+
+ public DiagramNode getPageFromId(String id) {
+ for (DiagramNode page : nodes)
+ if (page.getId().equals(id)) return page;
+ return null;
+ }
+
+ public Collection<DiagramNode> getPages() {
+ return nodes;
+ }
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the inheritData
+ */
+ public String getInheritData() {
+ return inheritData;
+ }
+
+ /**
+ * @param inheritData the inheritData to set
+ */
+ public void setInheritData(String inheritData) {
+ this.inheritData = inheritData;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramFactory.java
index d05d7e5323c..eb25709dd74 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramFactory.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramFactory.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * 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.ats.workflow.vue;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AFile;
-
-/**
- * @author Donald G. Dunne
- */
-public class DiagramFactory {
-
- private static DiagramFactory instance = new DiagramFactory();
- public static String GENERAL_DOCUMENT_ARTIFACT_NAME = "General Document";
- private static Map<Object, String> objToAtsWorkFlowXml = new HashMap<Object, String>();
-
- private DiagramFactory() {
- super();
- }
-
- public static DiagramFactory getInstance() {
- return instance;
- }
-
- public Diagram getWorkFlowFromFilename(String workFlowFilename) throws OseeCoreException {
- if (!objToAtsWorkFlowXml.containsKey(workFlowFilename)) {
- String vueXml = AFile.readFile(new File(workFlowFilename));
- objToAtsWorkFlowXml.put(workFlowFilename, vueXml);
- }
- return (Diagram) (new VueDiagram(workFlowFilename, objToAtsWorkFlowXml.get(workFlowFilename))).getWorkflow();
- }
-
- public Diagram getWorkFlowFromFileContents(String name, String vueXml) throws OseeCoreException {
- if (!objToAtsWorkFlowXml.containsKey(name)) {
- objToAtsWorkFlowXml.put(name, vueXml);
- }
- return (Diagram) (new VueDiagram(name, objToAtsWorkFlowXml.get(name))).getWorkflow();
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.vue;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AFile;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DiagramFactory {
+
+ private static DiagramFactory instance = new DiagramFactory();
+ public static String GENERAL_DOCUMENT_ARTIFACT_NAME = "General Document";
+ private static Map<Object, String> objToAtsWorkFlowXml = new HashMap<Object, String>();
+
+ private DiagramFactory() {
+ super();
+ }
+
+ public static DiagramFactory getInstance() {
+ return instance;
+ }
+
+ public Diagram getWorkFlowFromFilename(String workFlowFilename) throws OseeCoreException {
+ if (!objToAtsWorkFlowXml.containsKey(workFlowFilename)) {
+ String vueXml = AFile.readFile(new File(workFlowFilename));
+ objToAtsWorkFlowXml.put(workFlowFilename, vueXml);
+ }
+ return (Diagram) (new VueDiagram(workFlowFilename, objToAtsWorkFlowXml.get(workFlowFilename))).getWorkflow();
+ }
+
+ public Diagram getWorkFlowFromFileContents(String name, String vueXml) throws OseeCoreException {
+ if (!objToAtsWorkFlowXml.containsKey(name)) {
+ objToAtsWorkFlowXml.put(name, vueXml);
+ }
+ return (Diagram) (new VueDiagram(name, objToAtsWorkFlowXml.get(name))).getWorkflow();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramNode.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramNode.java
index 5053b1d5544..c8e41072276 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramNode.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/vue/DiagramNode.java
@@ -1,178 +1,178 @@
-/*******************************************************************************
- * 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.ats.workflow.vue;
-
-import java.util.ArrayList;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetOptionResolver;
-
-/**
- * @author Donald G. Dunne
- */
-public class DiagramNode {
-
- private String id = GUID.create();
- private String name;
- private ArrayList<DiagramNode> fromPages = new ArrayList<DiagramNode>();
- private ArrayList<DiagramNode> toPages = new ArrayList<DiagramNode>();
- private ArrayList<DiagramNode> returnPages = new ArrayList<DiagramNode>();
- private DiagramNode defaultToPage;
- private String instructionStr;
-
- @Override
- public int hashCode() {
- int result = 17;
- result = 31 * result + id.hashCode();
-
- return result;
- }
-
- public static enum PageType {
- Team, ActionableItem
- };
- private PageType pageType;
-
- /**
- * @param instructionLines input lines of WorkAttribute declarations
- */
- public DiagramNode(String name, String id, String xWidgetsXml, IXWidgetOptionResolver optionResolver) {
- super();
- this.name = name;
- if (id != null && !id.equals(""))
- this.id = id;
- }
-
- public DiagramNode(String xWidgetsXml, IXWidgetOptionResolver optionResolver) {
- this("", "", xWidgetsXml, optionResolver);
- }
-
- public DiagramNode(IXWidgetOptionResolver optionResolver) {
- this("", "", null, optionResolver);
- }
-
- /**
- * @return the instructionStr
- */
- public String getInstructionStr() {
- return instructionStr;
- }
-
- /**
- * @param instructionStr the instructionStr to set
- */
- public void setInstructionStr(String instructionStr) {
- this.instructionStr = instructionStr;
- }
-
- /**
- * @return Returns the pageType.
- */
- public PageType getPageType() {
- return pageType;
- }
-
- /**
- * @param pageType The pageType to set.
- */
- public void setPageType(PageType pageType) {
- this.pageType = pageType;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof DiagramNode)
- return getId().equals(((DiagramNode) obj).getId());
- return false;
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer(name + (id != null ? " (" + id + ") " : "") + "\n");
- for (DiagramNode page : toPages) {
- sb.append("-> ");
- sb.append(page.name);
- sb.append((returnPages.contains(page) ? " (return)" : ""));
- sb.append("\n");
- }
- return sb.toString();
- }
-
- public void addFromPage(DiagramNode page) {
- fromPages.add(page);
- }
-
- public void addToPage(DiagramNode page, boolean returnPage) {
- toPages.add(page);
- if (returnPage)
- returnPages.add(page);
- }
-
- public String getName() {
- return name;
- }
-
- public String getId() {
- return id;
- }
-
- /**
- * @return Returns the fromPages.
- */
- public ArrayList<DiagramNode> getFromPages() {
- return fromPages;
- }
-
- /**
- * @return Returns the toPages.
- */
- public ArrayList<DiagramNode> getToPages() {
- return toPages;
- }
-
- public boolean isReturnPage(DiagramNode page) {
- return returnPages.contains(page);
- }
-
- /**
- * @return Returns the defaultToPage.
- */
- public DiagramNode getDefaultToPage() {
- return defaultToPage;
- }
-
- /**
- * @param defaultToPage The defaultToPage to set.
- */
- public void setDefaultToPage(DiagramNode defaultToPage) {
- this.defaultToPage = defaultToPage;
- }
-
- /**
- * @param id The id to set.
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @param name The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the returnPages
- */
- public ArrayList<DiagramNode> getReturnPages() {
- return returnPages;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.workflow.vue;
+
+import java.util.ArrayList;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetOptionResolver;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DiagramNode {
+
+ private String id = GUID.create();
+ private String name;
+ private ArrayList<DiagramNode> fromPages = new ArrayList<DiagramNode>();
+ private ArrayList<DiagramNode> toPages = new ArrayList<DiagramNode>();
+ private ArrayList<DiagramNode> returnPages = new ArrayList<DiagramNode>();
+ private DiagramNode defaultToPage;
+ private String instructionStr;
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + id.hashCode();
+
+ return result;
+ }
+
+ public static enum PageType {
+ Team, ActionableItem
+ };
+ private PageType pageType;
+
+ /**
+ * @param instructionLines input lines of WorkAttribute declarations
+ */
+ public DiagramNode(String name, String id, String xWidgetsXml, IXWidgetOptionResolver optionResolver) {
+ super();
+ this.name = name;
+ if (id != null && !id.equals(""))
+ this.id = id;
+ }
+
+ public DiagramNode(String xWidgetsXml, IXWidgetOptionResolver optionResolver) {
+ this("", "", xWidgetsXml, optionResolver);
+ }
+
+ public DiagramNode(IXWidgetOptionResolver optionResolver) {
+ this("", "", null, optionResolver);
+ }
+
+ /**
+ * @return the instructionStr
+ */
+ public String getInstructionStr() {
+ return instructionStr;
+ }
+
+ /**
+ * @param instructionStr the instructionStr to set
+ */
+ public void setInstructionStr(String instructionStr) {
+ this.instructionStr = instructionStr;
+ }
+
+ /**
+ * @return Returns the pageType.
+ */
+ public PageType getPageType() {
+ return pageType;
+ }
+
+ /**
+ * @param pageType The pageType to set.
+ */
+ public void setPageType(PageType pageType) {
+ this.pageType = pageType;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof DiagramNode)
+ return getId().equals(((DiagramNode) obj).getId());
+ return false;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer(name + (id != null ? " (" + id + ") " : "") + "\n");
+ for (DiagramNode page : toPages) {
+ sb.append("-> ");
+ sb.append(page.name);
+ sb.append((returnPages.contains(page) ? " (return)" : ""));
+ sb.append("\n");
+ }
+ return sb.toString();
+ }
+
+ public void addFromPage(DiagramNode page) {
+ fromPages.add(page);
+ }
+
+ public void addToPage(DiagramNode page, boolean returnPage) {
+ toPages.add(page);
+ if (returnPage)
+ returnPages.add(page);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return Returns the fromPages.
+ */
+ public ArrayList<DiagramNode> getFromPages() {
+ return fromPages;
+ }
+
+ /**
+ * @return Returns the toPages.
+ */
+ public ArrayList<DiagramNode> getToPages() {
+ return toPages;
+ }
+
+ public boolean isReturnPage(DiagramNode page) {
+ return returnPages.contains(page);
+ }
+
+ /**
+ * @return Returns the defaultToPage.
+ */
+ public DiagramNode getDefaultToPage() {
+ return defaultToPage;
+ }
+
+ /**
+ * @param defaultToPage The defaultToPage to set.
+ */
+ public void setDefaultToPage(DiagramNode defaultToPage) {
+ this.defaultToPage = defaultToPage;
+ }
+
+ /**
+ * @param id The id to set.
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the returnPages
+ */
+ public ArrayList<DiagramNode> getReturnPages() {
+ return returnPages;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsMetricsComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsMetricsComposite.java
index 464341cf96a..7a162ea07d2 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsMetricsComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsMetricsComposite.java
@@ -1,397 +1,397 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.SMAMetrics;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.xbargraph.XBarGraphLine;
-import org.eclipse.osee.framework.ui.skynet.widgets.xbargraph.XBarGraphTable;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-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.Label;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsMetricsComposite extends ScrolledComposite {
-
- private Composite toolBarComposite;
- private Composite metricsComposite;
- private final IAtsMetricsProvider iAtsMetricsProvider;
- private final Color BACKGROUND_COLOR = Displays.getSystemColor(SWT.COLOR_WHITE);
- private final Color FOREGROUND_COLOR = Displays.getSystemColor(SWT.COLOR_BLUE);
- private final Composite mainComp;
- private boolean refreshedOnce = true;
- private XDate estimatedReleaseXDate;
-
- /**
- * @param iAtsMetricsProvider
- * @param parent
- * @param style
- */
- public AtsMetricsComposite(IAtsMetricsProvider iAtsMetricsProvider, Composite parent, int style) {
- super(parent, style | SWT.V_SCROLL | SWT.H_SCROLL);
- this.iAtsMetricsProvider = iAtsMetricsProvider;
-
- setLayout(new GridLayout(1, true));
- setLayoutData(new GridData(GridData.FILL_BOTH));
-
- mainComp = new Composite(this, SWT.NONE);
- mainComp.setLayout(new GridLayout());
- mainComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- adapt(mainComp);
-
- if (!DbConnectionExceptionComposite.dbConnectionIsOk(mainComp)) {
- return;
- }
-
- adapt(this);
- creatToolBar(mainComp);
-
- setContent(mainComp);
- setExpandHorizontal(true);
- setExpandVertical(true);
- layout();
- }
-
- private void creatToolBar(Composite composite) {
- toolBarComposite = new Composite(composite, SWT.NONE);
- toolBarComposite.setLayoutData(new GridData(SWT.NONE, SWT.NONE, true, false, 1, 1));
- toolBarComposite.setLayout(new GridLayout(4, false));
- adapt(toolBarComposite);
-
- Button refresh = new Button(toolBarComposite, SWT.PUSH);
- refresh.setText("Display/Refresh Metrics");
- refresh.setToolTipText("Recalculate and Update Metrics");
- refresh.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- handleUpdateMetrics();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- adapt(refresh);
-
- estimatedReleaseXDate = new XDate("Estimated Release Date - Override");
- estimatedReleaseXDate.createWidgets(toolBarComposite, 2);
- adapt(estimatedReleaseXDate.getLabelWidget());
-
- if (!refreshedOnce) {
- Label label = new Label(toolBarComposite, SWT.NONE);
- label.setText(" Last Updated: " + XDate.getDateNow(XDate.MMDDYYHHMM));
- adapt(label);
- }
-
- }
-
- public void handleUpdateMetrics() throws OseeCoreException {
- refreshedOnce = false;
- if (metricsComposite != null) {
- metricsComposite.dispose();
- }
- metricsComposite = new Composite(mainComp, SWT.NONE);
- metricsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- metricsComposite.setLayout(ALayout.getZeroMarginLayout(1, true));
- adapt(metricsComposite);
-
- addSpace();
-
- try {
- if (estimatedReleaseXDate.getDate() == null && iAtsMetricsProvider.getMetricsVersionArtifact() != null && iAtsMetricsProvider.getMetricsVersionArtifact().getEstimatedReleaseDate() != null) {
- estimatedReleaseXDate.setDate(iAtsMetricsProvider.getMetricsVersionArtifact().getEstimatedReleaseDate());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- SMAMetrics sMet =
- new SMAMetrics(iAtsMetricsProvider.getMetricsArtifacts(),
- iAtsMetricsProvider.getMetricsVersionArtifact(),
- iAtsMetricsProvider.getManHoursPerDayPreference(), getEstimatedReleaseDate());
- createOverviewChart(sMet, metricsComposite);
- addSpace();
- createHoursRemainingByAssigneesChart(sMet, metricsComposite);
- addSpace();
- createCompletedByAssigneesChart(sMet, metricsComposite);
-
- mainComp.layout();
- computeScrollSize();
- }
-
- private Date getEstimatedReleaseDate() throws OseeCoreException {
- if (estimatedReleaseXDate != null && estimatedReleaseXDate.getDate() != null) {
- return estimatedReleaseXDate.getDate();
- }
- if (iAtsMetricsProvider.getMetricsVersionArtifact() != null) {
- return iAtsMetricsProvider.getMetricsVersionArtifact().getEstimatedReleaseDate();
- }
- // Try to find an estimated release date from one of the workflows
- for (Artifact art : iAtsMetricsProvider.getMetricsArtifacts()) {
- if (art instanceof TeamWorkFlowArtifact) {
- VersionArtifact verArt = ((TeamWorkFlowArtifact) art).getWorldViewTargetedVersion();
- if (verArt != null) {
- if (verArt.getEstimatedReleaseDate() != null) {
- return verArt.getEstimatedReleaseDate();
- }
- }
- }
- }
- return null;
- }
-
- public void computeScrollSize() {
- this.computeScrollSize(mainComp);
- }
-
- private void computeScrollSize(Composite viewableArea) {
- this.setMinSize(viewableArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- }
-
- private void addSpace() {
- Label label = new Label(metricsComposite, SWT.NONE);
- label.setText(" ");
- adapt(label);
- }
-
- public void createOverviewChart(SMAMetrics sMet, Composite parent) throws OseeCoreException {
- List<XBarGraphLine> lines = new ArrayList<XBarGraphLine>();
-
- lines.add(XBarGraphLine.getTextLine("Loaded", sMet.toStringObjectBreakout()));
- lines.add(XBarGraphLine.getTextLineRedIfTrue(
- "Workflows",
- String.format("Estimates off %d workflows with %d having 0 estimates.", sMet.getNumSMAs(),
- sMet.getNumNotEstimated()), sMet.getNumNotEstimated() > 0));
-
- lines.add(XBarGraphLine.getPercentLine(
- "By Workflow Percents (" + sMet.getCummulativeWorkflowPercentComplete() + "/" + sMet.getNumTeamWfs() + ")",
- (int) sMet.getPercentCompleteByWorkflowPercents()));
- lines.add(XBarGraphLine.getPercentLine(
- "By Number of Workflows (" + sMet.getCompletedWorkflows().size() + "/" + sMet.getNumSMAs() + ")",
- (int) sMet.getPercentCompleteByWorkflow()));
-
- lines.add(XBarGraphLine.getTextLine("Estimated Hours: ", String.format("%5.2f Hours", sMet.getEstHours())));
- lines.add(XBarGraphLine.getTextLine("Remaining Hours: ", String.format(
- "%5.2f Hours = (Estimated hours %5.2f - (Estimated hours %5.2f x Percent Complete %5.2f))",
- sMet.getHrsRemainFromEstimates(), sMet.getEstHours(), sMet.getEstHours(),
- sMet.getPercentCompleteByWorkflowPercents())));
- lines.add(XBarGraphLine.getTextLine("Hours Spent: ", String.format("%5.2f Hours", sMet.getHrsSpent())));
- lines.add(XBarGraphLine.getTextLine("Hours Per Man Day Preference: ",
- String.format("%5.2f Hours per Day", sMet.getHoursPerManDay())));
- lines.add(XBarGraphLine.getTextLine("Work Days Needed: ", String.format(
- "%5.2f Days = Remaining Hours %5.2f / Hours Per Day of %5.2f", sMet.getManDaysNeeded(),
- sMet.getHrsRemainFromEstimates(), sMet.getHoursPerManDay())));
-
- try {
- lines.add(new XBarGraphLine(
- "Targeted Version",
- 0,
- iAtsMetricsProvider.getMetricsVersionArtifact() == null ? "Not Set" : iAtsMetricsProvider.getMetricsVersionArtifact().getName()));
- lines.add(new XBarGraphLine(
- "Targeted Version - Estimated Release Date",
- 0,
- iAtsMetricsProvider.getMetricsVersionArtifact() == null ? "Not Set" : iAtsMetricsProvider.getMetricsVersionArtifact().getSoleAttributeValueAsString(
- ATSAttributes.ESTIMATED_RELEASE_DATE_ATTRIBUTE.getStoreName(), "Not Set")));
- lines.add(new XBarGraphLine("Metrics Estimated Release Date", 0,
- getEstimatedReleaseDate() == null ? "Not Set" : getEstimatedReleaseDate().toString()));
- lines.add(new XBarGraphLine("Work-Days Till Release", 0,
- getEstimatedReleaseDate() == null ? "Estimated Release Date Not Set" : sMet.getDaysTillRelStr()));
- double hoursTillRelease = sMet.getHoursTillRel();
- lines.add(new XBarGraphLine("Hours Till Release", 0,
- getEstimatedReleaseDate() == null ? "Estimated Release Date Not Set" : sMet.getHoursTillRelStr()));
- double hoursRemainingFromEstimates = sMet.getHrsRemainFromEstimates();
- int percent = 0;
- if (hoursTillRelease != 0) {
- percent = (int) (hoursRemainingFromEstimates / hoursTillRelease);
- }
- if (sMet.getEstRelDate() == null) {
- lines.add(new XBarGraphLine("Release Effort Remaining", 0, "Estimated Release Date Not Set"));
- } else if (hoursRemainingFromEstimates > hoursTillRelease) {
- lines.add(new XBarGraphLine("Release Effort Remaining", XBarGraphLine.DEFAULT_RED_FOREGROUND,
- XBarGraphLine.DEFAULT_RED_BACKGROUND, 100, String.format(
- "%5.2f hours exceeds remaining release hours %5.2f; Over by %5.2f hours.",
- hoursRemainingFromEstimates, hoursTillRelease,
- hoursRemainingFromEstimates - hoursTillRelease)));
- } else {
- lines.add(new XBarGraphLine("Release Effort Remaining", XBarGraphLine.DEFAULT_GREEN_FOREGROUND,
- XBarGraphLine.DEFAULT_GREEN_BACKGROUND, SWT.COLOR_WHITE, SWT.COLOR_WHITE, percent, String.format(
- "%5.2f remaining work hours", hoursRemainingFromEstimates), String.format(
- "%5.2f release remaining hours", hoursRemainingFromEstimates)));
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
-
- XBarGraphTable table = new XBarGraphTable("Overview", "", "", lines);
- table.setHeaderVisible(false);
- table.setFillHorizontally(true);
- table.createWidgets(parent, 1);
- adapt(table);
- }
-
- public void createCompletedByAssigneesChart(SMAMetrics sMet, Composite parent) {
- List<XBarGraphLine> lines = new ArrayList<XBarGraphLine>();
- for (User user : sMet.getAssigneesAssignedOrCompleted()) {
- try {
- int numCompleted = sMet.getUserToCompletedSmas(user).size();
- double cummulativePercentComplete = numCompleted * 100;
- int numInWork = sMet.getUserToAssignedSmas(user).size();
- // Since table is loaded with arts and also shows children, don't want to count artifacts twice
- Set<Artifact> processedArts = new HashSet<Artifact>();
- if (sMet.getUserToAssignedSmas().getValues(user) != null) {
- for (Artifact sma : sMet.getUserToAssignedSmas().getValues(user)) {
- if (!processedArts.contains(sma) && !sMet.getUserToCompletedSmas().containsValue(sma)) {
- cummulativePercentComplete += ((StateMachineArtifact) sma).getWorldViewPercentCompleteTotal();
- processedArts.add(sma);
- }
- }
- }
- int numTotal = numCompleted + numInWork;
- int percentCompleteByNumber = 0;
- if (numCompleted == numTotal) {
- percentCompleteByNumber = 100;
- } else if (numCompleted != 0 && numTotal != 0) {
- double percent = ((double) numCompleted / (double) numTotal) * 100.0;
- percentCompleteByNumber = (int) percent;
- }
- int percentCompleteByPercents = 0;
- if (cummulativePercentComplete == 0) {
- percentCompleteByPercents = 0;
-
- } else if (numTotal == 0) {
- percentCompleteByPercents = 100;
- } else {
- double percent = cummulativePercentComplete / numTotal;
- percentCompleteByPercents = (int) percent;
- }
- lines.add(XBarGraphLine.getPercentLineBlueGreen(
- user.getName() + " by Percents (" + cummulativePercentComplete + "/" + numTotal + ")",
- percentCompleteByPercents));
- lines.add(XBarGraphLine.getPercentLineBlueGreen(
- user.getName() + " by Number of Workflows (" + numCompleted + "/" + numTotal + ")",
- percentCompleteByNumber));
- } catch (Exception ex) {
- lines.add(XBarGraphLine.getTextLine(user.getName(), "Exception: " + ex.getLocalizedMessage()));
- }
- }
- XBarGraphTable table =
- new XBarGraphTable("Completed by Assignee per Assigned Workflow (Team, Task and Review)", "User",
- "Percent Complete", lines);
- table.setFillHorizontally(true);
- table.createWidgets(parent, 1);
- adapt(table);
- }
-
- public void createHoursRemainingByAssigneesChart(SMAMetrics sMet, Composite parent) throws OseeCoreException {
- List<XBarGraphLine> lines = new ArrayList<XBarGraphLine>();
- Double hoursRemain = null;
- if (sMet.getEstRelDate() != null) {
- hoursRemain = sMet.getHoursTillRel();
- }
- for (User user : sMet.getAssigneesAssignedOrCompleted()) {
- try {
- double userHoursRemain = 0;
- for (TeamWorkFlowArtifact team : sMet.getTeamArts()) {
- Collection<User> users = team.getStateMgr().getAssignees();
- if (users.contains(user)) {
- double hours = team.getRemainHoursTotal();
- if (hours > 0) {
- userHoursRemain += hours / users.size();
- }
- }
- }
- if (sMet.getEstRelDate() == null) {
- lines.add(new XBarGraphLine(user.getName(), (int) userHoursRemain, String.format(
- "%5.2f - (Estimated release date not set)", userHoursRemain)));
- } else if (hoursRemain == null) {
- lines.add(new XBarGraphLine(user.getName(), (int) userHoursRemain, String.format("%5.2f",
- userHoursRemain)));
- } else {
- if (userHoursRemain == 0.0) {
- lines.add(new XBarGraphLine(user.getName(), XBarGraphLine.DEFAULT_GREEN_FOREGROUND,
- XBarGraphLine.DEFAULT_GREEN_BACKGROUND, 100, "No Estimated Hours Remain"));
- } else if (userHoursRemain > hoursRemain) {
- lines.add(new XBarGraphLine(user.getName(), XBarGraphLine.DEFAULT_RED_FOREGROUND,
- XBarGraphLine.DEFAULT_RED_BACKGROUND,
- (((int) userHoursRemain) > 1 ? (int) userHoursRemain : 1), String.format(
- "%5.2f - Exceeds release remaining hours %5.2f.", userHoursRemain, hoursRemain)));
- } else {
- lines.add(new XBarGraphLine(user.getName(), XBarGraphLine.DEFAULT_GREEN_FOREGROUND,
- XBarGraphLine.DEFAULT_GREEN_BACKGROUND, (int) userHoursRemain, String.format(
- "%5.2f - Within remaining hours %5.2f.", userHoursRemain, hoursRemain)));
- }
- }
- } catch (OseeCoreException ex) {
- lines.add(new XBarGraphLine(user.getName(), 0, "Exception: " + ex.getLocalizedMessage()));
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- XBarGraphTable table =
- new XBarGraphTable(
- "Hours Remaining by Assignee (green = within remaining hours; red = exceeds remaining hours till release)",
- "User", "Hours Remaining", lines);
- table.setFillHorizontally(true);
- table.createWidgets(parent, 1);
- adapt(table);
- }
-
- public void disposeComposite() {
- }
-
- public void adapt(XWidget xWidget) {
- adapt(xWidget.getControl());
- adapt(xWidget.getLabelWidget());
- }
-
- public void adapt(Control control) {
- if (control == null) {
- return;
- }
- control.setBackground(BACKGROUND_COLOR);
- control.setForeground(FOREGROUND_COLOR);
- }
-
- public void adapt(Composite composite) {
- composite.setBackground(BACKGROUND_COLOR);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.SMAMetrics;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.xbargraph.XBarGraphLine;
+import org.eclipse.osee.framework.ui.skynet.widgets.xbargraph.XBarGraphTable;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+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.Label;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsMetricsComposite extends ScrolledComposite {
+
+ private Composite toolBarComposite;
+ private Composite metricsComposite;
+ private final IAtsMetricsProvider iAtsMetricsProvider;
+ private final Color BACKGROUND_COLOR = Displays.getSystemColor(SWT.COLOR_WHITE);
+ private final Color FOREGROUND_COLOR = Displays.getSystemColor(SWT.COLOR_BLUE);
+ private final Composite mainComp;
+ private boolean refreshedOnce = true;
+ private XDate estimatedReleaseXDate;
+
+ /**
+ * @param iAtsMetricsProvider
+ * @param parent
+ * @param style
+ */
+ public AtsMetricsComposite(IAtsMetricsProvider iAtsMetricsProvider, Composite parent, int style) {
+ super(parent, style | SWT.V_SCROLL | SWT.H_SCROLL);
+ this.iAtsMetricsProvider = iAtsMetricsProvider;
+
+ setLayout(new GridLayout(1, true));
+ setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ mainComp = new Composite(this, SWT.NONE);
+ mainComp.setLayout(new GridLayout());
+ mainComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ adapt(mainComp);
+
+ if (!DbConnectionExceptionComposite.dbConnectionIsOk(mainComp)) {
+ return;
+ }
+
+ adapt(this);
+ creatToolBar(mainComp);
+
+ setContent(mainComp);
+ setExpandHorizontal(true);
+ setExpandVertical(true);
+ layout();
+ }
+
+ private void creatToolBar(Composite composite) {
+ toolBarComposite = new Composite(composite, SWT.NONE);
+ toolBarComposite.setLayoutData(new GridData(SWT.NONE, SWT.NONE, true, false, 1, 1));
+ toolBarComposite.setLayout(new GridLayout(4, false));
+ adapt(toolBarComposite);
+
+ Button refresh = new Button(toolBarComposite, SWT.PUSH);
+ refresh.setText("Display/Refresh Metrics");
+ refresh.setToolTipText("Recalculate and Update Metrics");
+ refresh.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ handleUpdateMetrics();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ adapt(refresh);
+
+ estimatedReleaseXDate = new XDate("Estimated Release Date - Override");
+ estimatedReleaseXDate.createWidgets(toolBarComposite, 2);
+ adapt(estimatedReleaseXDate.getLabelWidget());
+
+ if (!refreshedOnce) {
+ Label label = new Label(toolBarComposite, SWT.NONE);
+ label.setText(" Last Updated: " + XDate.getDateNow(XDate.MMDDYYHHMM));
+ adapt(label);
+ }
+
+ }
+
+ public void handleUpdateMetrics() throws OseeCoreException {
+ refreshedOnce = false;
+ if (metricsComposite != null) {
+ metricsComposite.dispose();
+ }
+ metricsComposite = new Composite(mainComp, SWT.NONE);
+ metricsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ metricsComposite.setLayout(ALayout.getZeroMarginLayout(1, true));
+ adapt(metricsComposite);
+
+ addSpace();
+
+ try {
+ if (estimatedReleaseXDate.getDate() == null && iAtsMetricsProvider.getMetricsVersionArtifact() != null && iAtsMetricsProvider.getMetricsVersionArtifact().getEstimatedReleaseDate() != null) {
+ estimatedReleaseXDate.setDate(iAtsMetricsProvider.getMetricsVersionArtifact().getEstimatedReleaseDate());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ SMAMetrics sMet =
+ new SMAMetrics(iAtsMetricsProvider.getMetricsArtifacts(),
+ iAtsMetricsProvider.getMetricsVersionArtifact(),
+ iAtsMetricsProvider.getManHoursPerDayPreference(), getEstimatedReleaseDate());
+ createOverviewChart(sMet, metricsComposite);
+ addSpace();
+ createHoursRemainingByAssigneesChart(sMet, metricsComposite);
+ addSpace();
+ createCompletedByAssigneesChart(sMet, metricsComposite);
+
+ mainComp.layout();
+ computeScrollSize();
+ }
+
+ private Date getEstimatedReleaseDate() throws OseeCoreException {
+ if (estimatedReleaseXDate != null && estimatedReleaseXDate.getDate() != null) {
+ return estimatedReleaseXDate.getDate();
+ }
+ if (iAtsMetricsProvider.getMetricsVersionArtifact() != null) {
+ return iAtsMetricsProvider.getMetricsVersionArtifact().getEstimatedReleaseDate();
+ }
+ // Try to find an estimated release date from one of the workflows
+ for (Artifact art : iAtsMetricsProvider.getMetricsArtifacts()) {
+ if (art instanceof TeamWorkFlowArtifact) {
+ VersionArtifact verArt = ((TeamWorkFlowArtifact) art).getWorldViewTargetedVersion();
+ if (verArt != null) {
+ if (verArt.getEstimatedReleaseDate() != null) {
+ return verArt.getEstimatedReleaseDate();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public void computeScrollSize() {
+ this.computeScrollSize(mainComp);
+ }
+
+ private void computeScrollSize(Composite viewableArea) {
+ this.setMinSize(viewableArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ }
+
+ private void addSpace() {
+ Label label = new Label(metricsComposite, SWT.NONE);
+ label.setText(" ");
+ adapt(label);
+ }
+
+ public void createOverviewChart(SMAMetrics sMet, Composite parent) throws OseeCoreException {
+ List<XBarGraphLine> lines = new ArrayList<XBarGraphLine>();
+
+ lines.add(XBarGraphLine.getTextLine("Loaded", sMet.toStringObjectBreakout()));
+ lines.add(XBarGraphLine.getTextLineRedIfTrue(
+ "Workflows",
+ String.format("Estimates off %d workflows with %d having 0 estimates.", sMet.getNumSMAs(),
+ sMet.getNumNotEstimated()), sMet.getNumNotEstimated() > 0));
+
+ lines.add(XBarGraphLine.getPercentLine(
+ "By Workflow Percents (" + sMet.getCummulativeWorkflowPercentComplete() + "/" + sMet.getNumTeamWfs() + ")",
+ (int) sMet.getPercentCompleteByWorkflowPercents()));
+ lines.add(XBarGraphLine.getPercentLine(
+ "By Number of Workflows (" + sMet.getCompletedWorkflows().size() + "/" + sMet.getNumSMAs() + ")",
+ (int) sMet.getPercentCompleteByWorkflow()));
+
+ lines.add(XBarGraphLine.getTextLine("Estimated Hours: ", String.format("%5.2f Hours", sMet.getEstHours())));
+ lines.add(XBarGraphLine.getTextLine("Remaining Hours: ", String.format(
+ "%5.2f Hours = (Estimated hours %5.2f - (Estimated hours %5.2f x Percent Complete %5.2f))",
+ sMet.getHrsRemainFromEstimates(), sMet.getEstHours(), sMet.getEstHours(),
+ sMet.getPercentCompleteByWorkflowPercents())));
+ lines.add(XBarGraphLine.getTextLine("Hours Spent: ", String.format("%5.2f Hours", sMet.getHrsSpent())));
+ lines.add(XBarGraphLine.getTextLine("Hours Per Man Day Preference: ",
+ String.format("%5.2f Hours per Day", sMet.getHoursPerManDay())));
+ lines.add(XBarGraphLine.getTextLine("Work Days Needed: ", String.format(
+ "%5.2f Days = Remaining Hours %5.2f / Hours Per Day of %5.2f", sMet.getManDaysNeeded(),
+ sMet.getHrsRemainFromEstimates(), sMet.getHoursPerManDay())));
+
+ try {
+ lines.add(new XBarGraphLine(
+ "Targeted Version",
+ 0,
+ iAtsMetricsProvider.getMetricsVersionArtifact() == null ? "Not Set" : iAtsMetricsProvider.getMetricsVersionArtifact().getName()));
+ lines.add(new XBarGraphLine(
+ "Targeted Version - Estimated Release Date",
+ 0,
+ iAtsMetricsProvider.getMetricsVersionArtifact() == null ? "Not Set" : iAtsMetricsProvider.getMetricsVersionArtifact().getSoleAttributeValueAsString(
+ ATSAttributes.ESTIMATED_RELEASE_DATE_ATTRIBUTE.getStoreName(), "Not Set")));
+ lines.add(new XBarGraphLine("Metrics Estimated Release Date", 0,
+ getEstimatedReleaseDate() == null ? "Not Set" : getEstimatedReleaseDate().toString()));
+ lines.add(new XBarGraphLine("Work-Days Till Release", 0,
+ getEstimatedReleaseDate() == null ? "Estimated Release Date Not Set" : sMet.getDaysTillRelStr()));
+ double hoursTillRelease = sMet.getHoursTillRel();
+ lines.add(new XBarGraphLine("Hours Till Release", 0,
+ getEstimatedReleaseDate() == null ? "Estimated Release Date Not Set" : sMet.getHoursTillRelStr()));
+ double hoursRemainingFromEstimates = sMet.getHrsRemainFromEstimates();
+ int percent = 0;
+ if (hoursTillRelease != 0) {
+ percent = (int) (hoursRemainingFromEstimates / hoursTillRelease);
+ }
+ if (sMet.getEstRelDate() == null) {
+ lines.add(new XBarGraphLine("Release Effort Remaining", 0, "Estimated Release Date Not Set"));
+ } else if (hoursRemainingFromEstimates > hoursTillRelease) {
+ lines.add(new XBarGraphLine("Release Effort Remaining", XBarGraphLine.DEFAULT_RED_FOREGROUND,
+ XBarGraphLine.DEFAULT_RED_BACKGROUND, 100, String.format(
+ "%5.2f hours exceeds remaining release hours %5.2f; Over by %5.2f hours.",
+ hoursRemainingFromEstimates, hoursTillRelease,
+ hoursRemainingFromEstimates - hoursTillRelease)));
+ } else {
+ lines.add(new XBarGraphLine("Release Effort Remaining", XBarGraphLine.DEFAULT_GREEN_FOREGROUND,
+ XBarGraphLine.DEFAULT_GREEN_BACKGROUND, SWT.COLOR_WHITE, SWT.COLOR_WHITE, percent, String.format(
+ "%5.2f remaining work hours", hoursRemainingFromEstimates), String.format(
+ "%5.2f release remaining hours", hoursRemainingFromEstimates)));
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+
+ XBarGraphTable table = new XBarGraphTable("Overview", "", "", lines);
+ table.setHeaderVisible(false);
+ table.setFillHorizontally(true);
+ table.createWidgets(parent, 1);
+ adapt(table);
+ }
+
+ public void createCompletedByAssigneesChart(SMAMetrics sMet, Composite parent) {
+ List<XBarGraphLine> lines = new ArrayList<XBarGraphLine>();
+ for (User user : sMet.getAssigneesAssignedOrCompleted()) {
+ try {
+ int numCompleted = sMet.getUserToCompletedSmas(user).size();
+ double cummulativePercentComplete = numCompleted * 100;
+ int numInWork = sMet.getUserToAssignedSmas(user).size();
+ // Since table is loaded with arts and also shows children, don't want to count artifacts twice
+ Set<Artifact> processedArts = new HashSet<Artifact>();
+ if (sMet.getUserToAssignedSmas().getValues(user) != null) {
+ for (Artifact sma : sMet.getUserToAssignedSmas().getValues(user)) {
+ if (!processedArts.contains(sma) && !sMet.getUserToCompletedSmas().containsValue(sma)) {
+ cummulativePercentComplete += ((StateMachineArtifact) sma).getWorldViewPercentCompleteTotal();
+ processedArts.add(sma);
+ }
+ }
+ }
+ int numTotal = numCompleted + numInWork;
+ int percentCompleteByNumber = 0;
+ if (numCompleted == numTotal) {
+ percentCompleteByNumber = 100;
+ } else if (numCompleted != 0 && numTotal != 0) {
+ double percent = ((double) numCompleted / (double) numTotal) * 100.0;
+ percentCompleteByNumber = (int) percent;
+ }
+ int percentCompleteByPercents = 0;
+ if (cummulativePercentComplete == 0) {
+ percentCompleteByPercents = 0;
+
+ } else if (numTotal == 0) {
+ percentCompleteByPercents = 100;
+ } else {
+ double percent = cummulativePercentComplete / numTotal;
+ percentCompleteByPercents = (int) percent;
+ }
+ lines.add(XBarGraphLine.getPercentLineBlueGreen(
+ user.getName() + " by Percents (" + cummulativePercentComplete + "/" + numTotal + ")",
+ percentCompleteByPercents));
+ lines.add(XBarGraphLine.getPercentLineBlueGreen(
+ user.getName() + " by Number of Workflows (" + numCompleted + "/" + numTotal + ")",
+ percentCompleteByNumber));
+ } catch (Exception ex) {
+ lines.add(XBarGraphLine.getTextLine(user.getName(), "Exception: " + ex.getLocalizedMessage()));
+ }
+ }
+ XBarGraphTable table =
+ new XBarGraphTable("Completed by Assignee per Assigned Workflow (Team, Task and Review)", "User",
+ "Percent Complete", lines);
+ table.setFillHorizontally(true);
+ table.createWidgets(parent, 1);
+ adapt(table);
+ }
+
+ public void createHoursRemainingByAssigneesChart(SMAMetrics sMet, Composite parent) throws OseeCoreException {
+ List<XBarGraphLine> lines = new ArrayList<XBarGraphLine>();
+ Double hoursRemain = null;
+ if (sMet.getEstRelDate() != null) {
+ hoursRemain = sMet.getHoursTillRel();
+ }
+ for (User user : sMet.getAssigneesAssignedOrCompleted()) {
+ try {
+ double userHoursRemain = 0;
+ for (TeamWorkFlowArtifact team : sMet.getTeamArts()) {
+ Collection<User> users = team.getStateMgr().getAssignees();
+ if (users.contains(user)) {
+ double hours = team.getRemainHoursTotal();
+ if (hours > 0) {
+ userHoursRemain += hours / users.size();
+ }
+ }
+ }
+ if (sMet.getEstRelDate() == null) {
+ lines.add(new XBarGraphLine(user.getName(), (int) userHoursRemain, String.format(
+ "%5.2f - (Estimated release date not set)", userHoursRemain)));
+ } else if (hoursRemain == null) {
+ lines.add(new XBarGraphLine(user.getName(), (int) userHoursRemain, String.format("%5.2f",
+ userHoursRemain)));
+ } else {
+ if (userHoursRemain == 0.0) {
+ lines.add(new XBarGraphLine(user.getName(), XBarGraphLine.DEFAULT_GREEN_FOREGROUND,
+ XBarGraphLine.DEFAULT_GREEN_BACKGROUND, 100, "No Estimated Hours Remain"));
+ } else if (userHoursRemain > hoursRemain) {
+ lines.add(new XBarGraphLine(user.getName(), XBarGraphLine.DEFAULT_RED_FOREGROUND,
+ XBarGraphLine.DEFAULT_RED_BACKGROUND,
+ (((int) userHoursRemain) > 1 ? (int) userHoursRemain : 1), String.format(
+ "%5.2f - Exceeds release remaining hours %5.2f.", userHoursRemain, hoursRemain)));
+ } else {
+ lines.add(new XBarGraphLine(user.getName(), XBarGraphLine.DEFAULT_GREEN_FOREGROUND,
+ XBarGraphLine.DEFAULT_GREEN_BACKGROUND, (int) userHoursRemain, String.format(
+ "%5.2f - Within remaining hours %5.2f.", userHoursRemain, hoursRemain)));
+ }
+ }
+ } catch (OseeCoreException ex) {
+ lines.add(new XBarGraphLine(user.getName(), 0, "Exception: " + ex.getLocalizedMessage()));
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ XBarGraphTable table =
+ new XBarGraphTable(
+ "Hours Remaining by Assignee (green = within remaining hours; red = exceeds remaining hours till release)",
+ "User", "Hours Remaining", lines);
+ table.setFillHorizontally(true);
+ table.createWidgets(parent, 1);
+ adapt(table);
+ }
+
+ public void disposeComposite() {
+ }
+
+ public void adapt(XWidget xWidget) {
+ adapt(xWidget.getControl());
+ adapt(xWidget.getLabelWidget());
+ }
+
+ public void adapt(Control control) {
+ if (control == null) {
+ return;
+ }
+ control.setBackground(BACKGROUND_COLOR);
+ control.setForeground(FOREGROUND_COLOR);
+ }
+
+ public void adapt(Composite composite) {
+ composite.setBackground(BACKGROUND_COLOR);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java
index 25c037f617a..ffc37c0d160 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.world;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.osee.ats.actions.DuplicateWorkflowViaWorldEditorAction;
-import org.eclipse.osee.ats.actions.ExportChangeReportsAction;
-import org.eclipse.osee.ats.export.AtsExportManager;
-import org.eclipse.osee.ats.operation.CancelMultipleWorkflows;
-import org.eclipse.osee.ats.operation.CompleteMultipleWorkflows;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsWorldEditorItem extends AtsWorldEditorItemBase {
-
- @Override
- public List<? extends Action> getWorldEditorMenuActions(IWorldEditorProvider worldEditorProvider, WorldEditor worldEditor) throws OseeCoreException {
- return Arrays.asList(new AtsExportManager(worldEditor), new ExportChangeReportsAction(worldEditor),
- new DuplicateWorkflowViaWorldEditorAction(worldEditor), new CompleteMultipleWorkflows(worldEditor),
- new CancelMultipleWorkflows(worldEditor));
- }
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.jface.action.Action;
+import org.eclipse.osee.ats.actions.DuplicateWorkflowViaWorldEditorAction;
+import org.eclipse.osee.ats.actions.ExportChangeReportsAction;
+import org.eclipse.osee.ats.export.AtsExportManager;
+import org.eclipse.osee.ats.operation.CancelMultipleWorkflows;
+import org.eclipse.osee.ats.operation.CompleteMultipleWorkflows;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsWorldEditorItem extends AtsWorldEditorItemBase {
+
+ @Override
+ public List<? extends Action> getWorldEditorMenuActions(IWorldEditorProvider worldEditorProvider, WorldEditor worldEditor) throws OseeCoreException {
+ return Arrays.asList(new AtsExportManager(worldEditor), new ExportChangeReportsAction(worldEditor),
+ new DuplicateWorkflowViaWorldEditorAction(worldEditor), new CompleteMultipleWorkflows(worldEditor),
+ new CancelMultipleWorkflows(worldEditor));
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItemBase.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItemBase.java
index ef427300a8d..f9ed6015564 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItemBase.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItemBase.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.world;
-
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class AtsWorldEditorItemBase implements IAtsWorldEditorItem {
-
- @Override
- public Image getColumnImage(Object element, XViewerColumn col, int columnIndex) throws OseeCoreException {
- return null;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn col, int columnIndex) throws OseeCoreException {
- return null;
- }
-
- @Override
- public Color getForeground(Object element, XViewerColumn col, int columnIndex) throws OseeCoreException {
- return null;
- }
-
- @Override
- public List<XViewerColumn> getXViewerColumns() throws OseeCoreException {
- return Collections.emptyList();
- }
-
- @Override
- public boolean isXColumnProvider(XViewerColumn col) throws OseeCoreException {
- return false;
- }
-
- @Override
- public List<? extends Action> getWorldEditorMenuActions(IWorldEditorProvider worldEditorProvider, WorldEditor worldEditor) throws OseeCoreException {
- return Collections.emptyList();
- }
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.jface.action.Action;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class AtsWorldEditorItemBase implements IAtsWorldEditorItem {
+
+ @Override
+ public Image getColumnImage(Object element, XViewerColumn col, int columnIndex) throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn col, int columnIndex) throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public Color getForeground(Object element, XViewerColumn col, int columnIndex) throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public List<XViewerColumn> getXViewerColumns() throws OseeCoreException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public boolean isXColumnProvider(XViewerColumn col) throws OseeCoreException {
+ return false;
+ }
+
+ @Override
+ public List<? extends Action> getWorldEditorMenuActions(IWorldEditorProvider worldEditorProvider, WorldEditor worldEditor) throws OseeCoreException {
+ return Collections.emptyList();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsMetricsProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsMetricsProvider.java
index 2b2fc610560..1a78764ab20 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsMetricsProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsMetricsProvider.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.Collection;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IAtsMetricsProvider {
-
- public Collection<? extends Artifact> getMetricsArtifacts() throws OseeCoreException;
-
- public VersionArtifact getMetricsVersionArtifact() throws OseeCoreException;
-
- public double getManHoursPerDayPreference() throws OseeCoreException;
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.Collection;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IAtsMetricsProvider {
+
+ public Collection<? extends Artifact> getMetricsArtifacts() throws OseeCoreException;
+
+ public VersionArtifact getMetricsVersionArtifact() throws OseeCoreException;
+
+ public double getManHoursPerDayPreference() throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsWorldEditorItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsWorldEditorItem.java
index 0cfc3da4bf7..6515e96257a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsWorldEditorItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IAtsWorldEditorItem.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IAtsWorldEditorItem {
-
- public List<XViewerColumn> getXViewerColumns() throws OseeCoreException;
-
- public boolean isXColumnProvider(XViewerColumn xCol) throws OseeCoreException;
-
- public String getColumnText(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException;
-
- public Color getForeground(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException;
-
- public Image getColumnImage(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException;
-
- /**
- * Return menu item objects to add to the World Editor pull-down menu only if applicable for the given
- * worldSearchItem
- *
- * @param worldEditorProvider
- * @param worldComposite
- * @return applicable pull-down actions
- * @throws OseeCoreException
- */
- public List<? extends Action> getWorldEditorMenuActions(IWorldEditorProvider worldEditorProvider, WorldEditor worldEditor) throws OseeCoreException;
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.List;
+import org.eclipse.jface.action.Action;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IAtsWorldEditorItem {
+
+ public List<XViewerColumn> getXViewerColumns() throws OseeCoreException;
+
+ public boolean isXColumnProvider(XViewerColumn xCol) throws OseeCoreException;
+
+ public String getColumnText(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException;
+
+ public Color getForeground(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException;
+
+ public Image getColumnImage(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException;
+
+ /**
+ * Return menu item objects to add to the World Editor pull-down menu only if applicable for the given
+ * worldSearchItem
+ *
+ * @param worldEditorProvider
+ * @param worldComposite
+ * @return applicable pull-down actions
+ * @throws OseeCoreException
+ */
+ public List<? extends Action> getWorldEditorMenuActions(IWorldEditorProvider worldEditorProvider, WorldEditor worldEditor) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditor.java
index dff4126a5bb..2638900ae38 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditor.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.plugin.core.IActionable;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IWorldEditor {
-
- public abstract void reflow();
-
- public void setTableTitle(final String title, final boolean warning);
-
- public void reSearch() throws OseeCoreException;
-
- public IActionable getIActionable();
-
- public IWorldEditorProvider getWorldEditorProvider() throws OseeCoreException;
-
- public void createToolBarPulldown(Menu menu);
-
- public String getCurrentTitleLabel();
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+import org.eclipse.swt.widgets.Menu;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IWorldEditor {
+
+ public abstract void reflow();
+
+ public void setTableTitle(final String title, final boolean warning);
+
+ public void reSearch() throws OseeCoreException;
+
+ public IActionable getIActionable();
+
+ public IWorldEditorProvider getWorldEditorProvider() throws OseeCoreException;
+
+ public void createToolBarPulldown(Menu menu);
+
+ public String getCurrentTitleLabel();
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorConsumer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorConsumer.java
index 5744e1c5728..b2523c64fd3 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorConsumer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorConsumer.java
@@ -8,14 +8,14 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.world;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IWorldEditorConsumer {
-
- public void setWorldEditor(WorldEditor worldEditor);
-
- public WorldEditor getWorldEditor();
-}
+package org.eclipse.osee.ats.world;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IWorldEditorConsumer {
+
+ public void setWorldEditor(WorldEditor worldEditor);
+
+ public WorldEditor getWorldEditor();
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorParameterProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorParameterProvider.java
index 7c10142145a..9c1f7dfa98c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorParameterProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorParameterProvider.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.Collection;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IWorldEditorParameterProvider extends IWorldEditorProvider {
-
- public String getParameterXWidgetXml() throws OseeCoreException;
-
- public Collection<? extends Artifact> performSearchGetResults(SearchType searchType) throws OseeCoreException;
-
- public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener();
-
- public String[] getWidgetOptions(DynamicXWidgetLayoutData xWidgetData);
-
- public boolean isSaveButtonAvailable();
-
- public void handleSaveButtonPressed();
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.Collection;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IWorldEditorParameterProvider extends IWorldEditorProvider {
+
+ public String getParameterXWidgetXml() throws OseeCoreException;
+
+ public Collection<? extends Artifact> performSearchGetResults(SearchType searchType) throws OseeCoreException;
+
+ public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener();
+
+ public String[] getWidgetOptions(DynamicXWidgetLayoutData xWidgetData);
+
+ public boolean isSaveButtonAvailable();
+
+ public void handleSaveButtonPressed();
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java
index a07ea397ce1..3229a0525bb 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEditorProvider.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.ats.world;
-
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IWorldEditorProvider {
-
- public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException;
-
- public String getSelectedName(SearchType searchType) throws OseeCoreException;
-
- public String getName() throws OseeCoreException;
-
- public VersionArtifact getTargetedVersionArtifact() throws OseeCoreException;
-
- public IWorldEditorProvider copyProvider() throws OseeArgumentException;
-
- public void setCustomizeData(CustomizeData customizeData);
-
- public void setTableLoadOptions(TableLoadOption... tableLoadOptions);
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IWorldEditorProvider {
+
+ public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException;
+
+ public String getSelectedName(SearchType searchType) throws OseeCoreException;
+
+ public String getName() throws OseeCoreException;
+
+ public VersionArtifact getTargetedVersionArtifact() throws OseeCoreException;
+
+ public IWorldEditorProvider copyProvider() throws OseeArgumentException;
+
+ public void setCustomizeData(CustomizeData customizeData);
+
+ public void setTableLoadOptions(TableLoadOption... tableLoadOptions);
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldViewerEventHandler.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldViewerEventHandler.java
index 1f487411b20..e557d86c40c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldViewerEventHandler.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldViewerEventHandler.java
@@ -8,19 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.world;
-
+package org.eclipse.osee.ats.world;
+
import java.util.Collection;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IWorldViewerEventHandler {
-
- public WorldXViewer getWorldXViewer();
-
- public void removeItems(Collection<? extends Object> objects);
-
- public boolean isDisposed();
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IWorldViewerEventHandler {
+
+ public WorldXViewer getWorldXViewer();
+
+ public void removeItems(Collection<? extends Object> objects);
+
+ public boolean isDisposed();
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
index 48142c23d4e..7397b834010 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
@@ -1,261 +1,261 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorAction.IOpenNewAtsWorldEditorHandler;
-import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorSelectedAction.IOpenNewAtsWorldEditorSelectedHandler;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.world.search.WorldSearchItem;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction.IRefreshActionHandler;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-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;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldComposite extends ScrolledComposite implements IWorldViewerEventHandler, IOpenNewAtsWorldEditorHandler, IOpenNewAtsWorldEditorSelectedHandler, IRefreshActionHandler {
-
- private final WorldXViewer worldXViewer;
- private final Set<Artifact> worldArts = new HashSet<Artifact>(200);
- private final Set<Artifact> otherArts = new HashSet<Artifact>(200);
- private final IWorldEditor iWorldEditor;
- private final Composite mainComp;
-
- public WorldComposite(IWorldEditor worldEditor, Composite parent, int style) {
- this(worldEditor, null, parent, style);
- }
-
- public WorldComposite(IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style) {
- super(parent, style);
- this.iWorldEditor = worldEditor;
-
- setLayout(new GridLayout(1, true));
- setLayoutData(new GridData(GridData.FILL_BOTH));
-
- mainComp = new Composite(this, SWT.NONE);
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- mainComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- if (!DbConnectionExceptionComposite.dbConnectionIsOk(this)) {
- worldXViewer = null;
- return;
- }
-
- worldXViewer =
- new WorldXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION,
- xViewerFactory != null ? xViewerFactory : new WorldXViewerFactory());
- worldXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- worldXViewer.setContentProvider(new WorldContentProvider(worldXViewer));
- worldXViewer.setLabelProvider(new WorldLabelProvider(worldXViewer));
-
- new WorldViewDragAndDrop(this, WorldEditor.EDITOR_ID);
-
- setContent(mainComp);
- setExpandHorizontal(true);
- setExpandVertical(true);
- layout();
-
- WorldXViewerEventManager.add(this);
- }
-
- public double getManHoursPerDayPreference() throws OseeCoreException {
- if (worldArts.size() > 0) {
- Artifact artifact = worldArts.iterator().next();
- if (artifact instanceof ActionArtifact) {
- artifact = ((ActionArtifact) artifact).getTeamWorkFlowArtifacts().iterator().next();
- }
- return ((StateMachineArtifact) artifact).getManHrsPerDayPreference();
- }
- return StateMachineArtifact.DEFAULT_HOURS_PER_WORK_DAY;
- }
-
- public void setCustomizeData(CustomizeData customizeData) {
- worldXViewer.getCustomizeMgr().loadCustomization(customizeData);
- }
-
- public Control getControl() {
- return worldXViewer.getControl();
- }
-
- public void load(final String name, final Collection<? extends Artifact> arts, TableLoadOption... tableLoadOption) {
- load(name, arts, null, tableLoadOption);
- }
-
- public void load(final String name, final Collection<? extends Artifact> arts, final CustomizeData customizeData, TableLoadOption... tableLoadOption) {
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- worldArts.clear();
- otherArts.clear();
- for (Artifact art : arts) {
- if (art instanceof IWorldViewArtifact) {
- worldArts.add(art);
- } else {
- otherArts.add(art);
- }
- }
- if (customizeData != null && !worldXViewer.getCustomizeMgr().generateCustDataFromTable().equals(
- customizeData)) {
- setCustomizeData(customizeData);
- }
- if (arts.isEmpty()) {
- setTableTitle("No Results Found - " + name, true);
- } else {
- setTableTitle(name, false);
- }
- worldXViewer.setInput(worldArts);
- worldXViewer.updateStatusLabel();
- if (otherArts.size() > 0) {
- if (MessageDialog.openConfirm(
- Displays.getActiveShell(),
- "Open in Artifact Editor?",
- otherArts.size() + " Non-WorldView Artifacts were returned from request.\n\nOpen in Artifact Editor?")) {
- RendererManager.openInJob(otherArts, PresentationType.GENERALIZED_EDIT);
- }
- }
- worldXViewer.getTree().setFocus();
- }
- });
- // Need to reflow the managed page based on the results. Don't put this in the above thread.
- iWorldEditor.reflow();
- }
-
- public static class FilterLabelProvider implements ILabelProvider {
-
- public Image getImage(Object arg0) {
- return null;
- }
-
- public String getText(Object arg0) {
- try {
- return ((WorldSearchItem) arg0).getSelectedName(SearchType.Search);
- } catch (OseeCoreException ex) {
- return ex.getLocalizedMessage();
- }
- }
-
- public void addListener(ILabelProviderListener arg0) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object arg0, String arg1) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener arg0) {
- }
- }
-
- public static class FilterContentProvider implements IStructuredContentProvider {
- public Object[] getElements(Object arg0) {
- return ((ArrayList<?>) arg0).toArray();
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- }
- }
-
- public void setTableTitle(final String title, final boolean warning) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- iWorldEditor.setTableTitle(title, warning);
- worldXViewer.setReportingTitle(title + " - " + XDate.getDateNow());
- };
- });
- }
-
- public ArrayList<Artifact> getLoadedArtifacts() {
- return getXViewer().getLoadedArtifacts();
- }
-
- public void disposeComposite() {
- if (worldXViewer != null && !worldXViewer.getTree().isDisposed()) {
- worldXViewer.dispose();
- }
- WorldXViewerEventManager.remove(this);
- }
-
- public WorldXViewer getXViewer() {
- return worldXViewer;
- }
-
- @Override
- public void refreshActionHandler() {
- try {
- iWorldEditor.reSearch();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public CustomizeData getCustomizeDataCopy() throws OseeCoreException {
- return worldXViewer.getCustomizeMgr().generateCustDataFromTable();
- }
-
- @Override
- public IWorldEditorProvider getWorldEditorProviderCopy() throws OseeCoreException {
- return iWorldEditor.getWorldEditorProvider().copyProvider();
- }
-
- @Override
- public ArrayList<Artifact> getSelectedArtifacts() throws OseeCoreException {
- return worldXViewer.getSelectedArtifacts();
- }
-
- @Override
- public void removeItems(Collection<? extends Object> objects) {
- // remove from model
- worldArts.removeAll(objects);
- }
-
- @Override
- public WorldXViewer getWorldXViewer() {
- return worldXViewer;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorAction.IOpenNewAtsWorldEditorHandler;
+import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorSelectedAction.IOpenNewAtsWorldEditorSelectedHandler;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.world.search.WorldSearchItem;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.action.RefreshAction.IRefreshActionHandler;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+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;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldComposite extends ScrolledComposite implements IWorldViewerEventHandler, IOpenNewAtsWorldEditorHandler, IOpenNewAtsWorldEditorSelectedHandler, IRefreshActionHandler {
+
+ private final WorldXViewer worldXViewer;
+ private final Set<Artifact> worldArts = new HashSet<Artifact>(200);
+ private final Set<Artifact> otherArts = new HashSet<Artifact>(200);
+ private final IWorldEditor iWorldEditor;
+ private final Composite mainComp;
+
+ public WorldComposite(IWorldEditor worldEditor, Composite parent, int style) {
+ this(worldEditor, null, parent, style);
+ }
+
+ public WorldComposite(IWorldEditor worldEditor, IXViewerFactory xViewerFactory, Composite parent, int style) {
+ super(parent, style);
+ this.iWorldEditor = worldEditor;
+
+ setLayout(new GridLayout(1, true));
+ setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ mainComp = new Composite(this, SWT.NONE);
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ mainComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ if (!DbConnectionExceptionComposite.dbConnectionIsOk(this)) {
+ worldXViewer = null;
+ return;
+ }
+
+ worldXViewer =
+ new WorldXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION,
+ xViewerFactory != null ? xViewerFactory : new WorldXViewerFactory());
+ worldXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ worldXViewer.setContentProvider(new WorldContentProvider(worldXViewer));
+ worldXViewer.setLabelProvider(new WorldLabelProvider(worldXViewer));
+
+ new WorldViewDragAndDrop(this, WorldEditor.EDITOR_ID);
+
+ setContent(mainComp);
+ setExpandHorizontal(true);
+ setExpandVertical(true);
+ layout();
+
+ WorldXViewerEventManager.add(this);
+ }
+
+ public double getManHoursPerDayPreference() throws OseeCoreException {
+ if (worldArts.size() > 0) {
+ Artifact artifact = worldArts.iterator().next();
+ if (artifact instanceof ActionArtifact) {
+ artifact = ((ActionArtifact) artifact).getTeamWorkFlowArtifacts().iterator().next();
+ }
+ return ((StateMachineArtifact) artifact).getManHrsPerDayPreference();
+ }
+ return StateMachineArtifact.DEFAULT_HOURS_PER_WORK_DAY;
+ }
+
+ public void setCustomizeData(CustomizeData customizeData) {
+ worldXViewer.getCustomizeMgr().loadCustomization(customizeData);
+ }
+
+ public Control getControl() {
+ return worldXViewer.getControl();
+ }
+
+ public void load(final String name, final Collection<? extends Artifact> arts, TableLoadOption... tableLoadOption) {
+ load(name, arts, null, tableLoadOption);
+ }
+
+ public void load(final String name, final Collection<? extends Artifact> arts, final CustomizeData customizeData, TableLoadOption... tableLoadOption) {
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ worldArts.clear();
+ otherArts.clear();
+ for (Artifact art : arts) {
+ if (art instanceof IWorldViewArtifact) {
+ worldArts.add(art);
+ } else {
+ otherArts.add(art);
+ }
+ }
+ if (customizeData != null && !worldXViewer.getCustomizeMgr().generateCustDataFromTable().equals(
+ customizeData)) {
+ setCustomizeData(customizeData);
+ }
+ if (arts.isEmpty()) {
+ setTableTitle("No Results Found - " + name, true);
+ } else {
+ setTableTitle(name, false);
+ }
+ worldXViewer.setInput(worldArts);
+ worldXViewer.updateStatusLabel();
+ if (otherArts.size() > 0) {
+ if (MessageDialog.openConfirm(
+ Displays.getActiveShell(),
+ "Open in Artifact Editor?",
+ otherArts.size() + " Non-WorldView Artifacts were returned from request.\n\nOpen in Artifact Editor?")) {
+ RendererManager.openInJob(otherArts, PresentationType.GENERALIZED_EDIT);
+ }
+ }
+ worldXViewer.getTree().setFocus();
+ }
+ });
+ // Need to reflow the managed page based on the results. Don't put this in the above thread.
+ iWorldEditor.reflow();
+ }
+
+ public static class FilterLabelProvider implements ILabelProvider {
+
+ public Image getImage(Object arg0) {
+ return null;
+ }
+
+ public String getText(Object arg0) {
+ try {
+ return ((WorldSearchItem) arg0).getSelectedName(SearchType.Search);
+ } catch (OseeCoreException ex) {
+ return ex.getLocalizedMessage();
+ }
+ }
+
+ public void addListener(ILabelProviderListener arg0) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object arg0, String arg1) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener arg0) {
+ }
+ }
+
+ public static class FilterContentProvider implements IStructuredContentProvider {
+ public Object[] getElements(Object arg0) {
+ return ((ArrayList<?>) arg0).toArray();
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+ }
+ }
+
+ public void setTableTitle(final String title, final boolean warning) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ iWorldEditor.setTableTitle(title, warning);
+ worldXViewer.setReportingTitle(title + " - " + XDate.getDateNow());
+ };
+ });
+ }
+
+ public ArrayList<Artifact> getLoadedArtifacts() {
+ return getXViewer().getLoadedArtifacts();
+ }
+
+ public void disposeComposite() {
+ if (worldXViewer != null && !worldXViewer.getTree().isDisposed()) {
+ worldXViewer.dispose();
+ }
+ WorldXViewerEventManager.remove(this);
+ }
+
+ public WorldXViewer getXViewer() {
+ return worldXViewer;
+ }
+
+ @Override
+ public void refreshActionHandler() {
+ try {
+ iWorldEditor.reSearch();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public CustomizeData getCustomizeDataCopy() throws OseeCoreException {
+ return worldXViewer.getCustomizeMgr().generateCustDataFromTable();
+ }
+
+ @Override
+ public IWorldEditorProvider getWorldEditorProviderCopy() throws OseeCoreException {
+ return iWorldEditor.getWorldEditorProvider().copyProvider();
+ }
+
+ @Override
+ public ArrayList<Artifact> getSelectedArtifacts() throws OseeCoreException {
+ return worldXViewer.getSelectedArtifacts();
+ }
+
+ @Override
+ public void removeItems(Collection<? extends Object> objects) {
+ // remove from model
+ worldArts.removeAll(objects);
+ }
+
+ @Override
+ public WorldXViewer getWorldXViewer() {
+ return worldXViewer;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldContentProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldContentProvider.java
index 2b268aa6a25..7d2a415e5d5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldContentProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldContentProvider.java
@@ -1,169 +1,169 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.GoalArtifact;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsRelationTypes;
-import org.eclipse.osee.ats.util.widgets.ReviewManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-public class WorldContentProvider implements ITreeContentProvider {
-
- // Store off relatedArts as they are discovered so they're not garbage collected
- protected Set<Artifact> relatedArts = new HashSet<Artifact>();
- private final WorldXViewer xViewer;
- private static Object[] EMPTY_ARRAY = new Object[0];
-
- public WorldContentProvider(WorldXViewer WorldXViewer) {
- super();
- this.xViewer = WorldXViewer;
- }
-
- @Override
- public String toString() {
- return "WorldContentProvider";
- }
-
- public void clear(boolean forcePend) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- xViewer.setInput(Collections.emptyList());
- xViewer.refresh();
- };
- }, forcePend);
- }
-
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Collection<?>) {
- return ((Collection<?>) parentElement).toArray();
- }
- if (parentElement instanceof Artifact) {
- try {
- Artifact artifact = (Artifact) parentElement;
- if (artifact.isDeleted()) {
- return new Object[] {};
- }
- if (artifact instanceof ActionArtifact) {
- relatedArts.addAll(((ActionArtifact) artifact).getTeamWorkFlowArtifacts());
- return ((ActionArtifact) artifact).getTeamWorkFlowArtifacts().toArray();
- }
- if (artifact instanceof GoalArtifact) {
- List<Artifact> arts = artifact.getRelatedArtifacts(AtsRelationTypes.Goal_Member, false);
- relatedArts.addAll(arts);
- return arts.toArray(new Artifact[artifact.getRelatedArtifactsCount(AtsRelationTypes.Goal_Member)]);
- }
- if (artifact instanceof TeamWorkFlowArtifact) {
- TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) artifact;
- List<Artifact> arts = new ArrayList<Artifact>();
- // Convert artifacts to WorldArtifactItems
- arts.addAll(ReviewManager.getReviews(teamArt));
- arts.addAll(teamArt.getTaskArtifactsSorted());
- relatedArts.addAll(arts);
- return arts.toArray();
- }
- if (artifact instanceof ReviewSMArtifact) {
- ReviewSMArtifact reviewArt = (ReviewSMArtifact) artifact;
- List<Artifact> arts = new ArrayList<Artifact>();
- arts.addAll(reviewArt.getTaskArtifactsSorted());
- relatedArts.addAll(arts);
- return arts.toArray();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
- }
- }
- return EMPTY_ARRAY;
- }
-
- public Object getParent(Object element) {
- if (element instanceof Artifact) {
- try {
- Artifact artifact = (Artifact) element;
- if (artifact.isDeleted()) {
- return null;
- }
- if (artifact instanceof TeamWorkFlowArtifact) {
- return ((TeamWorkFlowArtifact) artifact).getParentActionArtifact();
- }
- if (artifact instanceof TaskArtifact) {
- return ((TaskArtifact) artifact).getParentSMA();
- }
- if (artifact instanceof ReviewSMArtifact) {
- return ((ReviewSMArtifact) artifact).getParentSMA();
- }
- if (artifact instanceof GoalArtifact) {
- return ((GoalArtifact) artifact).getParentSMA();
- }
- } catch (Exception ex) {
- // do nothing
- }
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof Collection<?>) {
- return true;
- }
- if (element instanceof String) {
- return false;
- }
- if (((Artifact) element).isDeleted()) {
- return false;
- }
- if (element instanceof ActionArtifact) {
- return true;
- }
- if (element instanceof StateMachineArtifact) {
- try {
- return ((StateMachineArtifact) element).hasAtsWorldChildren();
- } catch (Exception ex) {
- // do nothing
- }
- }
- return true;
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof String) {
- return new Object[] {inputElement};
- }
- return getChildren(inputElement);
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.GoalArtifact;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsRelationTypes;
+import org.eclipse.osee.ats.util.widgets.ReviewManager;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+public class WorldContentProvider implements ITreeContentProvider {
+
+ // Store off relatedArts as they are discovered so they're not garbage collected
+ protected Set<Artifact> relatedArts = new HashSet<Artifact>();
+ private final WorldXViewer xViewer;
+ private static Object[] EMPTY_ARRAY = new Object[0];
+
+ public WorldContentProvider(WorldXViewer WorldXViewer) {
+ super();
+ this.xViewer = WorldXViewer;
+ }
+
+ @Override
+ public String toString() {
+ return "WorldContentProvider";
+ }
+
+ public void clear(boolean forcePend) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ xViewer.setInput(Collections.emptyList());
+ xViewer.refresh();
+ };
+ }, forcePend);
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof Collection<?>) {
+ return ((Collection<?>) parentElement).toArray();
+ }
+ if (parentElement instanceof Artifact) {
+ try {
+ Artifact artifact = (Artifact) parentElement;
+ if (artifact.isDeleted()) {
+ return new Object[] {};
+ }
+ if (artifact instanceof ActionArtifact) {
+ relatedArts.addAll(((ActionArtifact) artifact).getTeamWorkFlowArtifacts());
+ return ((ActionArtifact) artifact).getTeamWorkFlowArtifacts().toArray();
+ }
+ if (artifact instanceof GoalArtifact) {
+ List<Artifact> arts = artifact.getRelatedArtifacts(AtsRelationTypes.Goal_Member, false);
+ relatedArts.addAll(arts);
+ return arts.toArray(new Artifact[artifact.getRelatedArtifactsCount(AtsRelationTypes.Goal_Member)]);
+ }
+ if (artifact instanceof TeamWorkFlowArtifact) {
+ TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) artifact;
+ List<Artifact> arts = new ArrayList<Artifact>();
+ // Convert artifacts to WorldArtifactItems
+ arts.addAll(ReviewManager.getReviews(teamArt));
+ arts.addAll(teamArt.getTaskArtifactsSorted());
+ relatedArts.addAll(arts);
+ return arts.toArray();
+ }
+ if (artifact instanceof ReviewSMArtifact) {
+ ReviewSMArtifact reviewArt = (ReviewSMArtifact) artifact;
+ List<Artifact> arts = new ArrayList<Artifact>();
+ arts.addAll(reviewArt.getTaskArtifactsSorted());
+ relatedArts.addAll(arts);
+ return arts.toArray();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ }
+ return EMPTY_ARRAY;
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof Artifact) {
+ try {
+ Artifact artifact = (Artifact) element;
+ if (artifact.isDeleted()) {
+ return null;
+ }
+ if (artifact instanceof TeamWorkFlowArtifact) {
+ return ((TeamWorkFlowArtifact) artifact).getParentActionArtifact();
+ }
+ if (artifact instanceof TaskArtifact) {
+ return ((TaskArtifact) artifact).getParentSMA();
+ }
+ if (artifact instanceof ReviewSMArtifact) {
+ return ((ReviewSMArtifact) artifact).getParentSMA();
+ }
+ if (artifact instanceof GoalArtifact) {
+ return ((GoalArtifact) artifact).getParentSMA();
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if (element instanceof Collection<?>) {
+ return true;
+ }
+ if (element instanceof String) {
+ return false;
+ }
+ if (((Artifact) element).isDeleted()) {
+ return false;
+ }
+ if (element instanceof ActionArtifact) {
+ return true;
+ }
+ if (element instanceof StateMachineArtifact) {
+ try {
+ return ((StateMachineArtifact) element).hasAtsWorldChildren();
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+ return true;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof String) {
+ return new Object[] {inputElement};
+ }
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java
index d52e28e4d66..4c9ed464ce1 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditor.java
@@ -1,282 +1,282 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.IActionable;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.part.MultiPageEditorPart;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldEditor extends FormEditor implements IWorldEditor, IDirtiableEditor, IAtsMetricsProvider, IActionable {
- public static final String EDITOR_ID = "org.eclipse.osee.ats.world.WorldEditor";
- private int mainPageIndex, metricsPageIndex;
- private WorldXWidgetActionPage worldXWidgetActionPage;
- private AtsMetricsComposite metricsComposite;
- public static final String HELP_CONTEXT_ID = "atsWorldView";
- public static int TITLE_MAX_LENGTH = 80;
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- }
-
- public static void open(final IWorldEditorProvider provider) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- IWorkbenchPage page = AWorkbench.getActivePage();
- try {
- page.openEditor(new WorldEditorInput(provider), EDITOR_ID);
- } catch (PartInitException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- }
-
- public void closeEditor() {
- final MultiPageEditorPart editor = this;
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- AWorkbench.getActivePage().closeEditor(editor, false);
- }
- });
- }
-
- public static Collection<WorldEditor> getEditors() {
- final List<WorldEditor> editors = new ArrayList<WorldEditor>();
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
- editors.add((WorldEditor) editor.getEditor(false));
- }
- }
- });
- return editors;
- }
-
- public static void closeAll() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
- AWorkbench.getActivePage().closeEditor((editor.getEditor(false)), false);
- }
- }
- });
- }
-
- @Override
- public boolean isSaveOnCloseNeeded() {
- return isDirty();
- }
-
- public void refreshTitle() {
- firePropertyChange(IWorkbenchPart.PROP_TITLE);
- }
-
- @Override
- public void dispose() {
- if (worldXWidgetActionPage != null && worldXWidgetActionPage.getWorldComposite() != null) {
- worldXWidgetActionPage.getWorldComposite().disposeComposite();
- }
- if (metricsComposite != null) {
- metricsComposite.disposeComposite();
- }
- super.dispose();
- }
-
- public String getCurrentTitleLabel() {
- return worldXWidgetActionPage.getCurrentTitleLabel();
- }
-
- public void setTableTitle(final String title, final boolean warning) {
- worldXWidgetActionPage.setTableTitle(title, warning);
- }
-
- @Override
- public boolean isDirty() {
- return false;
- }
-
- @Override
- protected void addPages() {
-
- try {
- OseeContributionItem.addTo(this, true);
-
- IWorldEditorProvider provider = getWorldEditorProvider();
- if (provider instanceof IWorldEditorConsumer) {
- ((IWorldEditorConsumer) provider).setWorldEditor(this);
- }
-
- createMainTab();
- createMetricsTab();
-
- setPartName(provider.getSelectedName(SearchType.Search));
- setActivePage(mainPageIndex);
-
- // Until WorldEditor has different help, just use WorldView's help
- AtsPlugin.getInstance().setHelp(worldXWidgetActionPage.getWorldComposite().getControl(), HELP_CONTEXT_ID,
- "org.eclipse.osee.ats.help.ui");
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public WorldComposite getWorldComposite() {
- return worldXWidgetActionPage.getWorldComposite();
- }
-
- public WorldXWidgetActionPage getWorldXWidgetActionPage() {
- return worldXWidgetActionPage;
- }
-
- public void setEditorTitle(final String str) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- setPartName(str);
- firePropertyChange(IWorkbenchPart.PROP_TITLE);
- }
- });
- }
-
- public IWorldEditorProvider getWorldEditorProvider() throws OseeArgumentException {
- IEditorInput editorInput = getEditorInput();
- if (!(editorInput instanceof WorldEditorInput)) {
- throw new OseeArgumentException("Editor Input not WorldEditorInput");
- }
- WorldEditorInput worldEditorInput = (WorldEditorInput) editorInput;
- return worldEditorInput.getIWorldEditorProvider();
- }
-
- public void reSearch() throws OseeCoreException {
- worldXWidgetActionPage.reSearch();
- }
-
- private void createMainTab() throws OseeCoreException, PartInitException {
- worldXWidgetActionPage = new WorldXWidgetActionPage(this);
- mainPageIndex = addPage(worldXWidgetActionPage);
- }
-
- private void createMetricsTab() throws OseeCoreException {
- Composite comp = AtsUtil.createCommonPageComposite(getContainer());
- AtsUtil.createCommonToolBar(comp);
- metricsComposite = new AtsMetricsComposite(this, comp, SWT.NONE);
- metricsPageIndex = addPage(comp);
- setPageText(metricsPageIndex, "Metrics");
- }
-
- public ArrayList<Artifact> getLoadedArtifacts() {
- return worldXWidgetActionPage.getWorldComposite().getLoadedArtifacts();
- }
-
- @Override
- public Collection<? extends Artifact> getMetricsArtifacts() throws OseeCoreException {
- return getLoadedArtifacts();
- }
-
- @Override
- public VersionArtifact getMetricsVersionArtifact() throws OseeCoreException {
- VersionArtifact verArt = getWorldEditorProvider().getTargetedVersionArtifact();
- if (verArt != null) {
- return verArt;
- }
- for (Artifact artifact : getLoadedArtifacts()) {
- if (artifact instanceof StateMachineArtifact) {
- if (((StateMachineArtifact) artifact).getWorldViewTargetedVersion() != null) {
- return ((StateMachineArtifact) artifact).getWorldViewTargetedVersion();
- }
- }
- }
- return null;
- }
-
- @Override
- public String getActionDescription() {
- return null;
- }
-
- @Override
- public double getManHoursPerDayPreference() throws OseeCoreException {
- return worldXWidgetActionPage.getWorldComposite().getManHoursPerDayPreference();
- }
-
- @Override
- public void reflow() {
- getWorldXWidgetActionPage().reflow();
- }
-
- @Override
- public void createToolBarPulldown(Menu menu) {
- new MenuItem(menu, SWT.SEPARATOR);
- try {
- for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
- for (final Action action : item.getWorldEditorMenuActions(getWorldEditorProvider(), this)) {
- AtsUtil.actionToMenuItem(menu, action, SWT.PUSH);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public IActionable getIActionable() {
- return null;
- }
-
- @Override
- public void doSaveAs() {
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- @Override
- public void onDirtied() {
- }
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.part.MultiPageEditorPart;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldEditor extends FormEditor implements IWorldEditor, IDirtiableEditor, IAtsMetricsProvider, IActionable {
+ public static final String EDITOR_ID = "org.eclipse.osee.ats.world.WorldEditor";
+ private int mainPageIndex, metricsPageIndex;
+ private WorldXWidgetActionPage worldXWidgetActionPage;
+ private AtsMetricsComposite metricsComposite;
+ public static final String HELP_CONTEXT_ID = "atsWorldView";
+ public static int TITLE_MAX_LENGTH = 80;
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ }
+
+ public static void open(final IWorldEditorProvider provider) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ IWorkbenchPage page = AWorkbench.getActivePage();
+ try {
+ page.openEditor(new WorldEditorInput(provider), EDITOR_ID);
+ } catch (PartInitException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+
+ public void closeEditor() {
+ final MultiPageEditorPart editor = this;
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ AWorkbench.getActivePage().closeEditor(editor, false);
+ }
+ });
+ }
+
+ public static Collection<WorldEditor> getEditors() {
+ final List<WorldEditor> editors = new ArrayList<WorldEditor>();
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
+ editors.add((WorldEditor) editor.getEditor(false));
+ }
+ }
+ });
+ return editors;
+ }
+
+ public static void closeAll() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) {
+ AWorkbench.getActivePage().closeEditor((editor.getEditor(false)), false);
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean isSaveOnCloseNeeded() {
+ return isDirty();
+ }
+
+ public void refreshTitle() {
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ }
+
+ @Override
+ public void dispose() {
+ if (worldXWidgetActionPage != null && worldXWidgetActionPage.getWorldComposite() != null) {
+ worldXWidgetActionPage.getWorldComposite().disposeComposite();
+ }
+ if (metricsComposite != null) {
+ metricsComposite.disposeComposite();
+ }
+ super.dispose();
+ }
+
+ public String getCurrentTitleLabel() {
+ return worldXWidgetActionPage.getCurrentTitleLabel();
+ }
+
+ public void setTableTitle(final String title, final boolean warning) {
+ worldXWidgetActionPage.setTableTitle(title, warning);
+ }
+
+ @Override
+ public boolean isDirty() {
+ return false;
+ }
+
+ @Override
+ protected void addPages() {
+
+ try {
+ OseeContributionItem.addTo(this, true);
+
+ IWorldEditorProvider provider = getWorldEditorProvider();
+ if (provider instanceof IWorldEditorConsumer) {
+ ((IWorldEditorConsumer) provider).setWorldEditor(this);
+ }
+
+ createMainTab();
+ createMetricsTab();
+
+ setPartName(provider.getSelectedName(SearchType.Search));
+ setActivePage(mainPageIndex);
+
+ // Until WorldEditor has different help, just use WorldView's help
+ AtsPlugin.getInstance().setHelp(worldXWidgetActionPage.getWorldComposite().getControl(), HELP_CONTEXT_ID,
+ "org.eclipse.osee.ats.help.ui");
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public WorldComposite getWorldComposite() {
+ return worldXWidgetActionPage.getWorldComposite();
+ }
+
+ public WorldXWidgetActionPage getWorldXWidgetActionPage() {
+ return worldXWidgetActionPage;
+ }
+
+ public void setEditorTitle(final String str) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ setPartName(str);
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ }
+ });
+ }
+
+ public IWorldEditorProvider getWorldEditorProvider() throws OseeArgumentException {
+ IEditorInput editorInput = getEditorInput();
+ if (!(editorInput instanceof WorldEditorInput)) {
+ throw new OseeArgumentException("Editor Input not WorldEditorInput");
+ }
+ WorldEditorInput worldEditorInput = (WorldEditorInput) editorInput;
+ return worldEditorInput.getIWorldEditorProvider();
+ }
+
+ public void reSearch() throws OseeCoreException {
+ worldXWidgetActionPage.reSearch();
+ }
+
+ private void createMainTab() throws OseeCoreException, PartInitException {
+ worldXWidgetActionPage = new WorldXWidgetActionPage(this);
+ mainPageIndex = addPage(worldXWidgetActionPage);
+ }
+
+ private void createMetricsTab() throws OseeCoreException {
+ Composite comp = AtsUtil.createCommonPageComposite(getContainer());
+ AtsUtil.createCommonToolBar(comp);
+ metricsComposite = new AtsMetricsComposite(this, comp, SWT.NONE);
+ metricsPageIndex = addPage(comp);
+ setPageText(metricsPageIndex, "Metrics");
+ }
+
+ public ArrayList<Artifact> getLoadedArtifacts() {
+ return worldXWidgetActionPage.getWorldComposite().getLoadedArtifacts();
+ }
+
+ @Override
+ public Collection<? extends Artifact> getMetricsArtifacts() throws OseeCoreException {
+ return getLoadedArtifacts();
+ }
+
+ @Override
+ public VersionArtifact getMetricsVersionArtifact() throws OseeCoreException {
+ VersionArtifact verArt = getWorldEditorProvider().getTargetedVersionArtifact();
+ if (verArt != null) {
+ return verArt;
+ }
+ for (Artifact artifact : getLoadedArtifacts()) {
+ if (artifact instanceof StateMachineArtifact) {
+ if (((StateMachineArtifact) artifact).getWorldViewTargetedVersion() != null) {
+ return ((StateMachineArtifact) artifact).getWorldViewTargetedVersion();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getActionDescription() {
+ return null;
+ }
+
+ @Override
+ public double getManHoursPerDayPreference() throws OseeCoreException {
+ return worldXWidgetActionPage.getWorldComposite().getManHoursPerDayPreference();
+ }
+
+ @Override
+ public void reflow() {
+ getWorldXWidgetActionPage().reflow();
+ }
+
+ @Override
+ public void createToolBarPulldown(Menu menu) {
+ new MenuItem(menu, SWT.SEPARATOR);
+ try {
+ for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
+ for (final Action action : item.getWorldEditorMenuActions(getWorldEditorProvider(), this)) {
+ AtsUtil.actionToMenuItem(menu, action, SWT.PUSH);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public IActionable getIActionable() {
+ return null;
+ }
+
+ @Override
+ public void doSaveAs() {
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ @Override
+ public void onDirtied() {
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorInput.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorInput.java
index f480dd5aca2..88ca239bf06 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorInput.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorInput.java
@@ -1,84 +1,84 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.logging.Level;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldEditorInput implements IEditorInput {
-
- IWorldEditorProvider iWorldEditorProvider;
-
- @Override
- public int hashCode() {
- return iWorldEditorProvider.hashCode();
- }
-
- public IWorldEditorProvider getIWorldEditorProvider() {
- return iWorldEditorProvider;
- }
-
- public WorldEditorInput(IWorldEditorProvider iWorldEditorProvider) {
- this.iWorldEditorProvider = iWorldEditorProvider;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof WorldEditorInput)) return false;
- WorldEditorInput castObj = (WorldEditorInput) obj;
- return castObj.iWorldEditorProvider.equals(this.iWorldEditorProvider);
- }
-
- public boolean exists() {
- return false;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getToolTipText() {
- try {
- return iWorldEditorProvider.getName();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return "Exception getting name: " + ex.getLocalizedMessage();
- }
- }
-
- @Override
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public String getName() {
- try {
- return iWorldEditorProvider.getName();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return "Exception getting name: " + ex.getLocalizedMessage();
- }
- }
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.logging.Level;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldEditorInput implements IEditorInput {
+
+ IWorldEditorProvider iWorldEditorProvider;
+
+ @Override
+ public int hashCode() {
+ return iWorldEditorProvider.hashCode();
+ }
+
+ public IWorldEditorProvider getIWorldEditorProvider() {
+ return iWorldEditorProvider;
+ }
+
+ public WorldEditorInput(IWorldEditorProvider iWorldEditorProvider) {
+ this.iWorldEditorProvider = iWorldEditorProvider;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof WorldEditorInput)) return false;
+ WorldEditorInput castObj = (WorldEditorInput) obj;
+ return castObj.iWorldEditorProvider.equals(this.iWorldEditorProvider);
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public String getToolTipText() {
+ try {
+ return iWorldEditorProvider.getName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return "Exception getting name: " + ex.getLocalizedMessage();
+ }
+ }
+
+ @Override
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ try {
+ return iWorldEditorProvider.getName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return "Exception getting name: " + ex.getLocalizedMessage();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorOperationProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorOperationProvider.java
index 8ea74a94168..d16662618ad 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorOperationProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorOperationProvider.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldEditorOperationProvider extends WorldEditorProvider implements IWorldEditorConsumer {
-
- private final AbstractOperation operation;
-
- public WorldEditorOperationProvider(AbstractOperation operation) {
- super(null, new TableLoadOption[] {TableLoadOption.None});
- this.operation = operation;
- }
-
- @Override
- public IWorldEditorProvider copyProvider() {
- return new WorldEditorOperationProvider(operation);
- }
-
- @Override
- public void run(WorldEditor worldEditor, SearchType searchtype, boolean forcePend) throws OseeCoreException {
- // WorldEditor is provided to the operation independently
- // Don't need search type cause operation should already handle if it wants to search or re-search
- if (forcePend) {
- Operations.executeAndPend(operation, true);
- } else {
- Operations.executeAsJob(operation, true);
- }
- }
-
- @Override
- public String getName() throws OseeCoreException {
- return operation.getName();
- }
-
- @Override
- public WorldEditor getWorldEditor() {
- if (operation instanceof IWorldEditorConsumer) {
- return ((IWorldEditorConsumer) operation).getWorldEditor();
- }
- return null;
- }
-
- @Override
- public void setWorldEditor(WorldEditor worldEditor) {
- if (operation instanceof IWorldEditorConsumer) {
- ((IWorldEditorConsumer) operation).setWorldEditor(worldEditor);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldEditorOperationProvider extends WorldEditorProvider implements IWorldEditorConsumer {
+
+ private final AbstractOperation operation;
+
+ public WorldEditorOperationProvider(AbstractOperation operation) {
+ super(null, new TableLoadOption[] {TableLoadOption.None});
+ this.operation = operation;
+ }
+
+ @Override
+ public IWorldEditorProvider copyProvider() {
+ return new WorldEditorOperationProvider(operation);
+ }
+
+ @Override
+ public void run(WorldEditor worldEditor, SearchType searchtype, boolean forcePend) throws OseeCoreException {
+ // WorldEditor is provided to the operation independently
+ // Don't need search type cause operation should already handle if it wants to search or re-search
+ if (forcePend) {
+ Operations.executeAndPend(operation, true);
+ } else {
+ Operations.executeAsJob(operation, true);
+ }
+ }
+
+ @Override
+ public String getName() throws OseeCoreException {
+ return operation.getName();
+ }
+
+ @Override
+ public WorldEditor getWorldEditor() {
+ if (operation instanceof IWorldEditorConsumer) {
+ return ((IWorldEditorConsumer) operation).getWorldEditor();
+ }
+ return null;
+ }
+
+ @Override
+ public void setWorldEditor(WorldEditor worldEditor) {
+ if (operation instanceof IWorldEditorConsumer) {
+ ((IWorldEditorConsumer) operation).setWorldEditor(worldEditor);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItem.java
index 8f8b73df957..36715cd2512 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItem.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.world.search.WorldSearchItem;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetOptionResolver;
-import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class WorldEditorParameterSearchItem extends WorldSearchItem implements IWorldEditorParameterProvider, IDynamicWidgetLayoutListener, IXWidgetOptionResolver {
-
- private CustomizeData customizeData;
- private TableLoadOption[] tableLoadOptions;
-
- public WorldEditorParameterSearchItem(String name, KeyedImage oseeImage) throws OseeArgumentException {
- super(name, LoadView.WorldEditor, oseeImage);
- }
-
- public WorldEditorParameterSearchItem(String name, LoadView loadView) throws OseeArgumentException {
- this(name, loadView, null);
- }
-
- public WorldEditorParameterSearchItem(String name, LoadView loadView, KeyedImage oseeImage) throws OseeArgumentException {
- super(name, loadView, oseeImage);
- }
-
- public WorldEditorParameterSearchItem(WorldSearchItem worldSearchItem) throws OseeArgumentException {
- this(worldSearchItem, null);
- }
-
- public WorldEditorParameterSearchItem(WorldSearchItem worldSearchItem, KeyedImage oseeImage) throws OseeArgumentException {
- super(worldSearchItem, oseeImage);
- }
-
- public abstract String getParameterXWidgetXml() throws OseeCoreException;
-
- public abstract Result isParameterSelectionValid() throws OseeCoreException;
-
- @Override
- public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException {
- }
-
- @Override
- public String[] getWidgetOptions(DynamicXWidgetLayoutData widgetData) {
- return null;
- }
-
- public void setCustomizeData(CustomizeData customizeData) {
- this.customizeData = customizeData;
- }
-
- public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
- this.tableLoadOptions = tableLoadOptions;
- }
-
- public CustomizeData getCustomizeData() {
- return customizeData;
- }
-
- public TableLoadOption[] getTableLoadOptions() {
- return tableLoadOptions;
- }
-
- @Override
- public void handleSaveButtonPressed() {
- }
-
- @Override
- public boolean isSaveButtonAvailable() {
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.world;
+
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.world.search.WorldSearchItem;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetOptionResolver;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class WorldEditorParameterSearchItem extends WorldSearchItem implements IWorldEditorParameterProvider, IDynamicWidgetLayoutListener, IXWidgetOptionResolver {
+
+ private CustomizeData customizeData;
+ private TableLoadOption[] tableLoadOptions;
+
+ public WorldEditorParameterSearchItem(String name, KeyedImage oseeImage) throws OseeArgumentException {
+ super(name, LoadView.WorldEditor, oseeImage);
+ }
+
+ public WorldEditorParameterSearchItem(String name, LoadView loadView) throws OseeArgumentException {
+ this(name, loadView, null);
+ }
+
+ public WorldEditorParameterSearchItem(String name, LoadView loadView, KeyedImage oseeImage) throws OseeArgumentException {
+ super(name, loadView, oseeImage);
+ }
+
+ public WorldEditorParameterSearchItem(WorldSearchItem worldSearchItem) throws OseeArgumentException {
+ this(worldSearchItem, null);
+ }
+
+ public WorldEditorParameterSearchItem(WorldSearchItem worldSearchItem, KeyedImage oseeImage) throws OseeArgumentException {
+ super(worldSearchItem, oseeImage);
+ }
+
+ public abstract String getParameterXWidgetXml() throws OseeCoreException;
+
+ public abstract Result isParameterSelectionValid() throws OseeCoreException;
+
+ @Override
+ public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException {
+ }
+
+ @Override
+ public String[] getWidgetOptions(DynamicXWidgetLayoutData widgetData) {
+ return null;
+ }
+
+ public void setCustomizeData(CustomizeData customizeData) {
+ this.customizeData = customizeData;
+ }
+
+ public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
+ this.tableLoadOptions = tableLoadOptions;
+ }
+
+ public CustomizeData getCustomizeData() {
+ return customizeData;
+ }
+
+ public TableLoadOption[] getTableLoadOptions() {
+ return tableLoadOptions;
+ }
+
+ @Override
+ public void handleSaveButtonPressed() {
+ }
+
+ @Override
+ public boolean isSaveButtonAvailable() {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItemProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItemProvider.java
index 8b7c7d11a77..61fee1929d1 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItemProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorParameterSearchItemProvider.java
@@ -1,222 +1,222 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.Collection;
-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.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.world.search.WorldSearchItem;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.framework.ui.swt.CursorManager;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldEditorParameterSearchItemProvider extends WorldEditorProvider implements IWorldEditorParameterProvider {
-
- private final WorldEditorParameterSearchItem worldParameterSearchItem;
- public static String ENTER_OPTIONS_AND_SELECT_SEARCH = "Enter options and select \"Search\"";
- private boolean firstTime = true;
- private boolean loading = false;
- private WorldEditor worldEditor;
-
- public WorldEditorParameterSearchItemProvider(WorldEditorParameterSearchItem worldParameterSearchItem) {
- this(worldParameterSearchItem, null, TableLoadOption.None);
- }
-
- public WorldEditorParameterSearchItemProvider(WorldEditorParameterSearchItem worldParameterSearchItem, CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
- super(customizeData, tableLoadOptions);
- this.worldParameterSearchItem = worldParameterSearchItem;
- }
-
- @Override
- public IWorldEditorProvider copyProvider() throws OseeArgumentException {
- return new WorldEditorParameterSearchItemProvider(
- (WorldEditorParameterSearchItem) worldParameterSearchItem.copy(), customizeData, tableLoadOptions);
- }
-
- public WorldSearchItem getWorldSearchItem() {
- return worldParameterSearchItem;
- }
-
- @Override
- public String getName() throws OseeCoreException {
- return worldParameterSearchItem.getName();
- }
-
- public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException {
- this.worldEditor = worldEditor;
- if (firstTime) {
- firstTime = false;
- worldEditor.setTableTitle(ENTER_OPTIONS_AND_SELECT_SEARCH, false);
- return;
- }
- if (worldParameterSearchItem.isCancelled()) return;
-
- Result result = worldParameterSearchItem.isParameterSelectionValid();
- if (result.isFalse()) {
- result.popup();
- return;
- }
-
- if (loading) {
- AWorkbench.popup("Already Loading, Please Wait");
- return;
- }
- LoadTableJob job = null;
- job = new LoadTableJob(worldEditor, worldParameterSearchItem, searchType, tableLoadOptions, forcePend);
- job.setUser(false);
- job.setPriority(Job.LONG);
- job.schedule();
- if (forcePend) {
- try {
- job.join();
- } catch (InterruptedException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- private class LoadTableJob extends Job {
-
- private final WorldEditorParameterSearchItem worldParameterSearchItem;
- private boolean cancel = false;
- private final SearchType searchType;
- private final WorldEditor worldEditor;
- private final TableLoadOption[] tableLoadOptions;
- private final boolean forcePend;
-
- public LoadTableJob(WorldEditor worldEditor, WorldEditorParameterSearchItem worldParameterSearchItem, SearchType searchType, TableLoadOption[] tableLoadOptions, boolean forcePend) throws OseeCoreException {
- super("Loading \"" + worldParameterSearchItem.getSelectedName(searchType) + "\"...");
- this.worldEditor = worldEditor;
- this.worldParameterSearchItem = worldParameterSearchItem;
- this.searchType = searchType;
- this.tableLoadOptions = tableLoadOptions;
- this.forcePend = forcePend;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (loading) {
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, "Already Loading, Please Wait", null);
- }
- String selectedName = "";
- try {
- setLoading(true);
- selectedName = worldParameterSearchItem.getSelectedName(searchType);
- worldEditor.setEditorTitle(selectedName != null ? selectedName : worldParameterSearchItem.getName());
- worldEditor.setTableTitle("Loading \"" + (selectedName != null ? selectedName : "") + "\"...", false);
- cancel = false;
- worldParameterSearchItem.setCancelled(cancel);
- final Collection<? extends Artifact> artifacts;
- worldEditor.getWorldComposite().getXViewer().clear(forcePend);
- artifacts = worldParameterSearchItem.performSearchGetResults(searchType);
- if (artifacts.isEmpty()) {
- if (worldParameterSearchItem.isCancelled()) {
- monitor.done();
- worldEditor.setTableTitle("CANCELLED - " + selectedName, false);
- return Status.CANCEL_STATUS;
- } else {
- monitor.done();
- worldEditor.setTableTitle("No Results Found - " + selectedName, true);
- return Status.OK_STATUS;
- }
- }
- worldEditor.getWorldComposite().load(selectedName, artifacts, customizeData, tableLoadOptions);
- } catch (final Exception ex) {
- String str = "Exception occurred. Network may be down.";
- if (ex.getLocalizedMessage() != null && !ex.getLocalizedMessage().equals("")) str +=
- " => " + ex.getLocalizedMessage();
- worldEditor.getWorldComposite().setTableTitle("Searching Error - " + selectedName, false);
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- monitor.done();
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, str, null);
- } finally {
- setLoading(false);
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- }
-
- @Override
- public String getSelectedName(SearchType searchType) throws OseeCoreException {
- return Strings.truncate(worldParameterSearchItem.getSelectedName(searchType), WorldEditor.TITLE_MAX_LENGTH, true);
- }
-
- @Override
- public String getParameterXWidgetXml() throws OseeCoreException {
- return worldParameterSearchItem.getParameterXWidgetXml();
- }
-
- @Override
- public Collection<? extends Artifact> performSearchGetResults(SearchType searchType) throws OseeCoreException {
- return worldParameterSearchItem.performSearchGetResults(searchType);
- }
-
- @Override
- public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
- return worldParameterSearchItem;
- }
-
- @Override
- public String[] getWidgetOptions(DynamicXWidgetLayoutData widgetData) {
- return null;
- }
-
- public boolean isLoading() {
- return loading;
- }
-
- public void setLoading(final boolean loading) {
- this.loading = loading;
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (loading) {
- worldEditor.getWorldComposite().setCursor(CursorManager.getCursor(SWT.CURSOR_WAIT));
- } else {
- worldEditor.getWorldComposite().setCursor(null);
- }
- }
- });
-
- }
-
- @Override
- public void handleSaveButtonPressed() {
- if (isSaveButtonAvailable()) {
- worldParameterSearchItem.handleSaveButtonPressed();
- }
- }
-
- @Override
- public boolean isSaveButtonAvailable() {
- return worldParameterSearchItem.isSaveButtonAvailable();
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.Collection;
+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.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.world.search.WorldSearchItem;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.osee.framework.ui.swt.CursorManager;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldEditorParameterSearchItemProvider extends WorldEditorProvider implements IWorldEditorParameterProvider {
+
+ private final WorldEditorParameterSearchItem worldParameterSearchItem;
+ public static String ENTER_OPTIONS_AND_SELECT_SEARCH = "Enter options and select \"Search\"";
+ private boolean firstTime = true;
+ private boolean loading = false;
+ private WorldEditor worldEditor;
+
+ public WorldEditorParameterSearchItemProvider(WorldEditorParameterSearchItem worldParameterSearchItem) {
+ this(worldParameterSearchItem, null, TableLoadOption.None);
+ }
+
+ public WorldEditorParameterSearchItemProvider(WorldEditorParameterSearchItem worldParameterSearchItem, CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
+ super(customizeData, tableLoadOptions);
+ this.worldParameterSearchItem = worldParameterSearchItem;
+ }
+
+ @Override
+ public IWorldEditorProvider copyProvider() throws OseeArgumentException {
+ return new WorldEditorParameterSearchItemProvider(
+ (WorldEditorParameterSearchItem) worldParameterSearchItem.copy(), customizeData, tableLoadOptions);
+ }
+
+ public WorldSearchItem getWorldSearchItem() {
+ return worldParameterSearchItem;
+ }
+
+ @Override
+ public String getName() throws OseeCoreException {
+ return worldParameterSearchItem.getName();
+ }
+
+ public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException {
+ this.worldEditor = worldEditor;
+ if (firstTime) {
+ firstTime = false;
+ worldEditor.setTableTitle(ENTER_OPTIONS_AND_SELECT_SEARCH, false);
+ return;
+ }
+ if (worldParameterSearchItem.isCancelled()) return;
+
+ Result result = worldParameterSearchItem.isParameterSelectionValid();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+
+ if (loading) {
+ AWorkbench.popup("Already Loading, Please Wait");
+ return;
+ }
+ LoadTableJob job = null;
+ job = new LoadTableJob(worldEditor, worldParameterSearchItem, searchType, tableLoadOptions, forcePend);
+ job.setUser(false);
+ job.setPriority(Job.LONG);
+ job.schedule();
+ if (forcePend) {
+ try {
+ job.join();
+ } catch (InterruptedException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ private class LoadTableJob extends Job {
+
+ private final WorldEditorParameterSearchItem worldParameterSearchItem;
+ private boolean cancel = false;
+ private final SearchType searchType;
+ private final WorldEditor worldEditor;
+ private final TableLoadOption[] tableLoadOptions;
+ private final boolean forcePend;
+
+ public LoadTableJob(WorldEditor worldEditor, WorldEditorParameterSearchItem worldParameterSearchItem, SearchType searchType, TableLoadOption[] tableLoadOptions, boolean forcePend) throws OseeCoreException {
+ super("Loading \"" + worldParameterSearchItem.getSelectedName(searchType) + "\"...");
+ this.worldEditor = worldEditor;
+ this.worldParameterSearchItem = worldParameterSearchItem;
+ this.searchType = searchType;
+ this.tableLoadOptions = tableLoadOptions;
+ this.forcePend = forcePend;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (loading) {
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, "Already Loading, Please Wait", null);
+ }
+ String selectedName = "";
+ try {
+ setLoading(true);
+ selectedName = worldParameterSearchItem.getSelectedName(searchType);
+ worldEditor.setEditorTitle(selectedName != null ? selectedName : worldParameterSearchItem.getName());
+ worldEditor.setTableTitle("Loading \"" + (selectedName != null ? selectedName : "") + "\"...", false);
+ cancel = false;
+ worldParameterSearchItem.setCancelled(cancel);
+ final Collection<? extends Artifact> artifacts;
+ worldEditor.getWorldComposite().getXViewer().clear(forcePend);
+ artifacts = worldParameterSearchItem.performSearchGetResults(searchType);
+ if (artifacts.isEmpty()) {
+ if (worldParameterSearchItem.isCancelled()) {
+ monitor.done();
+ worldEditor.setTableTitle("CANCELLED - " + selectedName, false);
+ return Status.CANCEL_STATUS;
+ } else {
+ monitor.done();
+ worldEditor.setTableTitle("No Results Found - " + selectedName, true);
+ return Status.OK_STATUS;
+ }
+ }
+ worldEditor.getWorldComposite().load(selectedName, artifacts, customizeData, tableLoadOptions);
+ } catch (final Exception ex) {
+ String str = "Exception occurred. Network may be down.";
+ if (ex.getLocalizedMessage() != null && !ex.getLocalizedMessage().equals("")) str +=
+ " => " + ex.getLocalizedMessage();
+ worldEditor.getWorldComposite().setTableTitle("Searching Error - " + selectedName, false);
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ monitor.done();
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, str, null);
+ } finally {
+ setLoading(false);
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ }
+
+ @Override
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
+ return Strings.truncate(worldParameterSearchItem.getSelectedName(searchType), WorldEditor.TITLE_MAX_LENGTH, true);
+ }
+
+ @Override
+ public String getParameterXWidgetXml() throws OseeCoreException {
+ return worldParameterSearchItem.getParameterXWidgetXml();
+ }
+
+ @Override
+ public Collection<? extends Artifact> performSearchGetResults(SearchType searchType) throws OseeCoreException {
+ return worldParameterSearchItem.performSearchGetResults(searchType);
+ }
+
+ @Override
+ public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() {
+ return worldParameterSearchItem;
+ }
+
+ @Override
+ public String[] getWidgetOptions(DynamicXWidgetLayoutData widgetData) {
+ return null;
+ }
+
+ public boolean isLoading() {
+ return loading;
+ }
+
+ public void setLoading(final boolean loading) {
+ this.loading = loading;
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (loading) {
+ worldEditor.getWorldComposite().setCursor(CursorManager.getCursor(SWT.CURSOR_WAIT));
+ } else {
+ worldEditor.getWorldComposite().setCursor(null);
+ }
+ }
+ });
+
+ }
+
+ @Override
+ public void handleSaveButtonPressed() {
+ if (isSaveButtonAvailable()) {
+ worldParameterSearchItem.handleSaveButtonPressed();
+ }
+ }
+
+ @Override
+ public boolean isSaveButtonAvailable() {
+ return worldParameterSearchItem.isSaveButtonAvailable();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java
index 58020dc0723..33e9ec2a90e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorProvider.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class WorldEditorProvider implements IWorldEditorProvider {
-
- protected TableLoadOption[] tableLoadOptions;
- protected CustomizeData customizeData;
-
- public WorldEditorProvider(CustomizeData customizeData, TableLoadOption[] tableLoadOptions) {
- this.customizeData = customizeData;
- this.tableLoadOptions = tableLoadOptions;
- }
-
- @Override
- public String getSelectedName(SearchType searchType) throws OseeCoreException {
- return getName();
- }
-
- @Override
- public VersionArtifact getTargetedVersionArtifact() throws OseeCoreException {
- return null;
- }
-
- public TableLoadOption[] getTableLoadOptions() {
- return tableLoadOptions;
- }
-
- public CustomizeData getCustomizeData() {
- return customizeData;
- }
-
- public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
- this.tableLoadOptions = tableLoadOptions;
- }
-
- public void setCustomizeData(CustomizeData customizeData) {
- this.customizeData = customizeData;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class WorldEditorProvider implements IWorldEditorProvider {
+
+ protected TableLoadOption[] tableLoadOptions;
+ protected CustomizeData customizeData;
+
+ public WorldEditorProvider(CustomizeData customizeData, TableLoadOption[] tableLoadOptions) {
+ this.customizeData = customizeData;
+ this.tableLoadOptions = tableLoadOptions;
+ }
+
+ @Override
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
+ return getName();
+ }
+
+ @Override
+ public VersionArtifact getTargetedVersionArtifact() throws OseeCoreException {
+ return null;
+ }
+
+ public TableLoadOption[] getTableLoadOptions() {
+ return tableLoadOptions;
+ }
+
+ public CustomizeData getCustomizeData() {
+ return customizeData;
+ }
+
+ public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
+ this.tableLoadOptions = tableLoadOptions;
+ }
+
+ public void setCustomizeData(CustomizeData customizeData) {
+ this.customizeData = customizeData;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorSimpleProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorSimpleProvider.java
index ba72cfd906e..5fccea21625 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorSimpleProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorSimpleProvider.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.Collection;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldEditorSimpleProvider extends WorldEditorProvider {
-
- private final String name;
- private final Collection<? extends Artifact> artifacts;
-
- public WorldEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts) {
- this(name, artifacts, null, TableLoadOption.None);
- }
-
- public WorldEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts, CustomizeData customizeData, TableLoadOption... tableLoadOption) {
- super(customizeData, tableLoadOption);
- this.name = name;
- this.artifacts = artifacts;
- }
-
- @Override
- public IWorldEditorProvider copyProvider() {
- return new WorldEditorSimpleProvider(name, artifacts, customizeData, tableLoadOptions);
- }
-
- @Override
- public void run(WorldEditor worldEditor, SearchType searchtype, boolean forcePend) throws OseeCoreException {
- worldEditor.getWorldComposite().load(name, artifacts, customizeData, getTableLoadOptions());
- }
-
- @Override
- public String getName() throws OseeCoreException {
- return name;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.Collection;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldEditorSimpleProvider extends WorldEditorProvider {
+
+ private final String name;
+ private final Collection<? extends Artifact> artifacts;
+
+ public WorldEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts) {
+ this(name, artifacts, null, TableLoadOption.None);
+ }
+
+ public WorldEditorSimpleProvider(String name, Collection<? extends Artifact> artifacts, CustomizeData customizeData, TableLoadOption... tableLoadOption) {
+ super(customizeData, tableLoadOption);
+ this.name = name;
+ this.artifacts = artifacts;
+ }
+
+ @Override
+ public IWorldEditorProvider copyProvider() {
+ return new WorldEditorSimpleProvider(name, artifacts, customizeData, tableLoadOptions);
+ }
+
+ @Override
+ public void run(WorldEditor worldEditor, SearchType searchtype, boolean forcePend) throws OseeCoreException {
+ worldEditor.getWorldComposite().load(name, artifacts, customizeData, getTableLoadOptions());
+ }
+
+ @Override
+ public String getName() throws OseeCoreException {
+ return name;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorUISearchItemProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorUISearchItemProvider.java
index 654d550f3bf..97deb58997d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorUISearchItemProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldEditorUISearchItemProvider.java
@@ -1,161 +1,161 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.Collection;
-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.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.world.search.NextVersionSearchItem;
-import org.eclipse.osee.ats.world.search.VersionTargetedForTeamSearchItem;
-import org.eclipse.osee.ats.world.search.WorldSearchItem;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.ats.world.search.WorldUISearchItem;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldEditorUISearchItemProvider extends WorldEditorProvider {
-
- private final WorldUISearchItem worldUISearchItem;
-
- public WorldEditorUISearchItemProvider(WorldUISearchItem worldUISearchItem) {
- this(worldUISearchItem, null, TableLoadOption.None);
- }
-
- public WorldEditorUISearchItemProvider(WorldUISearchItem worldUISearchItem, CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
- super(customizeData, tableLoadOptions);
- this.worldUISearchItem = worldUISearchItem;
- }
-
- @Override
- public IWorldEditorProvider copyProvider() throws OseeArgumentException {
- return new WorldEditorUISearchItemProvider((WorldUISearchItem) worldUISearchItem.copy(), customizeData,
- tableLoadOptions);
- }
-
- /**
- * @return the worldSearchItem
- */
- public WorldSearchItem getWorldSearchItem() {
- return worldUISearchItem;
- }
-
- @Override
- public String getName() throws OseeCoreException {
- return worldUISearchItem.getName();
- }
-
- @Override
- public String getSelectedName(SearchType searchType) throws OseeCoreException {
- return Strings.truncate(worldUISearchItem.getSelectedName(searchType), WorldEditor.TITLE_MAX_LENGTH, true);
- }
-
- @Override
- public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException {
-
- Collection<TableLoadOption> options = Collections.getAggregate(tableLoadOptions);
- if (!options.contains(TableLoadOption.NoUI) && searchType == SearchType.Search) {
- worldUISearchItem.performUI(searchType);
- }
- if (worldUISearchItem.isCancelled()) {
- worldEditor.close(false);
- return;
- }
-
- LoadTableJob job = null;
- job = new LoadTableJob(worldEditor, worldUISearchItem, searchType, forcePend);
- job.setUser(false);
- job.setPriority(Job.LONG);
- job.schedule();
- if (options.contains(TableLoadOption.ForcePend)) {
- try {
- job.join();
- } catch (InterruptedException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
-
- private class LoadTableJob extends Job {
-
- private final WorldUISearchItem worldUISearchItem;
- private boolean cancel = false;
- private final SearchType searchType;
- private final WorldEditor worldEditor;
- private final boolean forcePend;
-
- public LoadTableJob(WorldEditor worldEditor, WorldUISearchItem worldUISearchItem, SearchType searchType, boolean forcePend) throws OseeCoreException {
- super("Loading \"" + worldUISearchItem.getSelectedName(searchType) + "\"...");
- this.worldEditor = worldEditor;
- this.worldUISearchItem = worldUISearchItem;
- this.searchType = searchType;
- this.forcePend = forcePend;
-
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- String selectedName = "";
- try {
- selectedName = worldUISearchItem.getSelectedName(searchType);
- worldEditor.setEditorTitle(selectedName != null ? selectedName : worldUISearchItem.getName());
- worldEditor.setTableTitle("Loading \"" + (selectedName != null ? selectedName : "") + "\"...", false);
- cancel = false;
- worldUISearchItem.setCancelled(cancel);
- final Collection<Artifact> artifacts;
- worldEditor.getWorldComposite().getXViewer().clear(forcePend);
- artifacts = worldUISearchItem.performSearchGetResults(false, searchType);
- if (artifacts.isEmpty()) {
- if (worldUISearchItem.isCancelled()) {
- worldEditor.setTableTitle("CANCELLED - " + selectedName, false);
- return Status.CANCEL_STATUS;
- } else {
- worldEditor.setTableTitle("No Results Found - " + selectedName, true);
- return Status.OK_STATUS;
- }
- }
- worldEditor.getWorldComposite().load((selectedName != null ? selectedName : ""), artifacts, customizeData);
- } catch (final Exception ex) {
- worldEditor.getWorldComposite().setTableTitle("Searching Error - " + selectedName, false);
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex);
- } finally {
- monitor.done();
- }
-
- return Status.OK_STATUS;
- }
- }
-
- @Override
- public VersionArtifact getTargetedVersionArtifact() throws OseeCoreException {
- if (worldUISearchItem instanceof VersionTargetedForTeamSearchItem) {
- return ((VersionTargetedForTeamSearchItem) worldUISearchItem).getSearchVersionArtifact();
- } else if (worldUISearchItem instanceof NextVersionSearchItem) {
- return ((NextVersionSearchItem) worldUISearchItem).getSelectedVersionArt();
- }
- return 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.ats.world;
+
+import java.util.Collection;
+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.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.world.search.NextVersionSearchItem;
+import org.eclipse.osee.ats.world.search.VersionTargetedForTeamSearchItem;
+import org.eclipse.osee.ats.world.search.WorldSearchItem;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.ats.world.search.WorldUISearchItem;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldEditorUISearchItemProvider extends WorldEditorProvider {
+
+ private final WorldUISearchItem worldUISearchItem;
+
+ public WorldEditorUISearchItemProvider(WorldUISearchItem worldUISearchItem) {
+ this(worldUISearchItem, null, TableLoadOption.None);
+ }
+
+ public WorldEditorUISearchItemProvider(WorldUISearchItem worldUISearchItem, CustomizeData customizeData, TableLoadOption... tableLoadOptions) {
+ super(customizeData, tableLoadOptions);
+ this.worldUISearchItem = worldUISearchItem;
+ }
+
+ @Override
+ public IWorldEditorProvider copyProvider() throws OseeArgumentException {
+ return new WorldEditorUISearchItemProvider((WorldUISearchItem) worldUISearchItem.copy(), customizeData,
+ tableLoadOptions);
+ }
+
+ /**
+ * @return the worldSearchItem
+ */
+ public WorldSearchItem getWorldSearchItem() {
+ return worldUISearchItem;
+ }
+
+ @Override
+ public String getName() throws OseeCoreException {
+ return worldUISearchItem.getName();
+ }
+
+ @Override
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
+ return Strings.truncate(worldUISearchItem.getSelectedName(searchType), WorldEditor.TITLE_MAX_LENGTH, true);
+ }
+
+ @Override
+ public void run(WorldEditor worldEditor, SearchType searchType, boolean forcePend) throws OseeCoreException {
+
+ Collection<TableLoadOption> options = Collections.getAggregate(tableLoadOptions);
+ if (!options.contains(TableLoadOption.NoUI) && searchType == SearchType.Search) {
+ worldUISearchItem.performUI(searchType);
+ }
+ if (worldUISearchItem.isCancelled()) {
+ worldEditor.close(false);
+ return;
+ }
+
+ LoadTableJob job = null;
+ job = new LoadTableJob(worldEditor, worldUISearchItem, searchType, forcePend);
+ job.setUser(false);
+ job.setPriority(Job.LONG);
+ job.schedule();
+ if (options.contains(TableLoadOption.ForcePend)) {
+ try {
+ job.join();
+ } catch (InterruptedException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ private class LoadTableJob extends Job {
+
+ private final WorldUISearchItem worldUISearchItem;
+ private boolean cancel = false;
+ private final SearchType searchType;
+ private final WorldEditor worldEditor;
+ private final boolean forcePend;
+
+ public LoadTableJob(WorldEditor worldEditor, WorldUISearchItem worldUISearchItem, SearchType searchType, boolean forcePend) throws OseeCoreException {
+ super("Loading \"" + worldUISearchItem.getSelectedName(searchType) + "\"...");
+ this.worldEditor = worldEditor;
+ this.worldUISearchItem = worldUISearchItem;
+ this.searchType = searchType;
+ this.forcePend = forcePend;
+
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ String selectedName = "";
+ try {
+ selectedName = worldUISearchItem.getSelectedName(searchType);
+ worldEditor.setEditorTitle(selectedName != null ? selectedName : worldUISearchItem.getName());
+ worldEditor.setTableTitle("Loading \"" + (selectedName != null ? selectedName : "") + "\"...", false);
+ cancel = false;
+ worldUISearchItem.setCancelled(cancel);
+ final Collection<Artifact> artifacts;
+ worldEditor.getWorldComposite().getXViewer().clear(forcePend);
+ artifacts = worldUISearchItem.performSearchGetResults(false, searchType);
+ if (artifacts.isEmpty()) {
+ if (worldUISearchItem.isCancelled()) {
+ worldEditor.setTableTitle("CANCELLED - " + selectedName, false);
+ return Status.CANCEL_STATUS;
+ } else {
+ worldEditor.setTableTitle("No Results Found - " + selectedName, true);
+ return Status.OK_STATUS;
+ }
+ }
+ worldEditor.getWorldComposite().load((selectedName != null ? selectedName : ""), artifacts, customizeData);
+ } catch (final Exception ex) {
+ worldEditor.getWorldComposite().setTableTitle("Searching Error - " + selectedName, false);
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex);
+ } finally {
+ monitor.done();
+ }
+
+ return Status.OK_STATUS;
+ }
+ }
+
+ @Override
+ public VersionArtifact getTargetedVersionArtifact() throws OseeCoreException {
+ if (worldUISearchItem instanceof VersionTargetedForTeamSearchItem) {
+ return ((VersionTargetedForTeamSearchItem) worldUISearchItem).getSearchVersionArtifact();
+ } else if (worldUISearchItem instanceof NextVersionSearchItem) {
+ return ((NextVersionSearchItem) worldUISearchItem).getSelectedVersionArt();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldLabelProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldLabelProvider.java
index f13d7302ea4..6dac50e79dc 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldLabelProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldLabelProvider.java
@@ -1,384 +1,384 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.nebula.widgets.xviewer.XViewerCells;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
-import org.eclipse.osee.ats.artifact.GoalArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.widgets.dialog.TaskResOptionDefinition;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-
-public class WorldLabelProvider extends XViewerLabelProvider {
-
- private final WorldXViewer worldXViewer;
- protected Font font;
- private GoalArtifact parentGoalArtifact;
-
- public WorldLabelProvider(WorldXViewer worldXViewer) {
- super(worldXViewer);
- this.worldXViewer = worldXViewer;
- }
-
- @Override
- public Image getColumnImage(Object element, XViewerColumn xCol, int columnIndex) {
- try {
- if (!(element instanceof IWorldViewArtifact)) {
- return null;
- }
- IWorldViewArtifact wva = (IWorldViewArtifact) element;
- if (xCol.equals(WorldXViewerFactory.Change_Type_Col)) {
- return wva.getWorldViewChangeType().getImage();
- } else if (xCol.equals(WorldXViewerFactory.Type_Col)) {
- return ArtifactImageManager.getImage((Artifact) element);
- } else if (xCol.equals(WorldXViewerFactory.Assignees_Col)) {
- return wva.getAssigneeImage();
- } else if (xCol.equals(WorldXViewerFactory.Deadline_Col)) {
- if (wva.isWorldViewDeadlineAlerting().isTrue()) {
- return ImageManager.getImage(FrameworkImage.WARNING);
- }
- } else if (xCol.equals(WorldXViewerFactory.Artifact_Type_Col)) {
- return ArtifactImageManager.getImage((Artifact) wva);
- }
- for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
- if (item.isXColumnProvider(xCol)) {
- Image image = item.getColumnImage(element, xCol, columnIndex);
- if (image != null) {
- return image;
- }
- }
- }
- } catch (Exception ex) {
- // do nothing
- }
- return null;
- }
-
- @Override
- public Color getForeground(Object element, XViewerColumn xCol, int columnIndex) {
- try {
- if (element instanceof TaskArtifact && xCol.equals(WorldXViewerFactory.Resolution_Col)) {
- TaskArtifact taskArt = (TaskArtifact) element;
- TaskResOptionDefinition def = taskArt.getTaskResolutionOptionDefinition(taskArt.getWorldViewResolution());
- if (def != null) {
- return Displays.getSystemColor(def.getColorInt());
- }
- }
- for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
- if (item.isXColumnProvider(xCol)) {
- Color color = item.getForeground(element, xCol, columnIndex);
- if (color != null) {
- return color;
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- return null;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn xCol, int columnIndex) {
- try {
- // NOTE: HRID, Type, Title are handled by XViewerValueColumn values
- if (!(element instanceof IWorldViewArtifact)) {
- return "";
- }
- IWorldViewArtifact wva = (IWorldViewArtifact) element;
- Artifact art = (Artifact) element;
- if (art.isDeleted()) {
- if (xCol.equals(WorldXViewerFactory.Title_Col)) {
- return art.getName();
- } else {
- return "<deleted>";
- }
- }
- if (xCol.equals(WorldXViewerFactory.Type_Col)) {
- return wva.getWorldViewType();
- }
- if (xCol.equals(WorldXViewerFactory.State_Col)) {
- return wva.getWorldViewState();
- }
- if (xCol.equals(WorldXViewerFactory.Assignees_Col)) {
- return wva.getWorldViewActivePoc();
- }
- if (xCol.equals(WorldXViewerFactory.Change_Type_Col)) {
- return wva.getWorldViewChangeTypeStr();
- }
- if (xCol.equals(WorldXViewerFactory.Priority_Col)) {
- return wva.getWorldViewPriority();
- }
- if (xCol.equals(WorldXViewerFactory.Actionable_Items_Col)) {
- return wva.getWorldViewActionableItems();
- }
- if (xCol.equals(WorldXViewerFactory.User_Community_Col)) {
- return wva.getWorldViewUserCommunity();
- }
- if (xCol.equals(WorldXViewerFactory.Version_Target_Col)) {
- return wva.getWorldViewTargetedVersionStr();
- }
- if (xCol.equals(WorldXViewerFactory.Notes_Col)) {
- return wva.getWorldViewNotes();
- }
-
- if (xCol.equals(WorldXViewerFactory.Resolution_Col)) {
- return wva.getWorldViewResolution();
- }
- if (xCol.equals(WorldXViewerFactory.Groups_Col)) {
- return wva.getWorldViewGroups();
- }
- if (xCol.equals(WorldXViewerFactory.Goals_Col)) {
- return wva.getWorldViewGoals();
- }
- if (xCol.equals(WorldXViewerFactory.Legacy_PCR_Col)) {
- return wva.getWorldViewLegacyPCR();
- }
- if (xCol.equals(WorldXViewerFactory.Created_Date_Col)) {
- return wva.getWorldViewCreatedDateStr();
- }
- if (xCol.equals(WorldXViewerFactory.Completed_Date_Col)) {
- return wva.getWorldViewCompletedDateStr();
- }
- if (xCol.equals(WorldXViewerFactory.Cancelled_Date_Col)) {
- return wva.getWorldViewCancelledDateStr();
- }
- if (xCol.equals(WorldXViewerFactory.Team_Col)) {
- return wva.getWorldViewTeam();
- }
- if (xCol.equals(WorldXViewerFactory.Related_To_State_Col)) {
- return wva.getWorldViewRelatedToState();
- }
- if (xCol.equals(WorldXViewerFactory.Originator_Col)) {
- return wva.getWorldViewOriginator();
- }
- if (xCol.equals(WorldXViewerFactory.Branch_Status_Col)) {
- return wva.getWorldViewBranchStatus();
- }
- if (xCol.equals(WorldXViewerFactory.Decision_Col)) {
- return wva.getWorldViewDecision();
- }
- if (xCol.equals(WorldXViewerFactory.Estimated_Hours_Col)) {
- return AtsUtil.doubleToI18nString(wva.getWorldViewEstimatedHours());
- }
- if (xCol.equals(WorldXViewerFactory.Remaining_Hours_Col)) {
- Result result = wva.isWorldViewRemainHoursValid();
- if (result.isFalse()) {
- return result.getText();
- }
- return AtsUtil.doubleToI18nString(wva.getWorldViewRemainHours());
- }
- if (xCol.equals(WorldXViewerFactory.Percent_Complete_State_Col)) {
- return String.valueOf(wva.getWorldViewPercentCompleteState());
- }
- if (xCol.equals(WorldXViewerFactory.Percent_Complete_State_Task_Col)) {
- return String.valueOf(wva.getWorldViewPercentCompleteStateTask());
- }
- if (xCol.equals(WorldXViewerFactory.Percent_Complete_State_Review_Col)) {
- return String.valueOf(wva.getWorldViewPercentCompleteStateReview());
- }
- if (xCol.equals(WorldXViewerFactory.Percent_Complete_Total_Col)) {
- return String.valueOf(wva.getWorldViewPercentCompleteTotal());
- }
- if (xCol.equals(WorldXViewerFactory.Hours_Spent_State_Col)) {
- return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentState());
- }
- if (xCol.equals(WorldXViewerFactory.Hours_Spent_State_Task_Col)) {
- return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentStateTask());
- }
- if (xCol.equals(WorldXViewerFactory.Hours_Spent_State_Review_Col)) {
- return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentStateReview());
- }
- if (xCol.equals(WorldXViewerFactory.Hours_Spent_Total_Col)) {
- return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentStateTotal());
- }
-
- if (xCol.equals(WorldXViewerFactory.Total_Hours_Spent_Col)) {
- return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentTotal());
- }
-
- if (xCol.equals(WorldXViewerFactory.Percent_Rework_Col)) {
- return wva.getWorldViewPercentReworkStr();
- }
- if (xCol.equals(WorldXViewerFactory.Estimated_Release_Date_Col)) {
- return wva.getWorldViewEstimatedReleaseDateStr();
- }
- if (xCol.equals(WorldXViewerFactory.Estimated_Completion_Date_Col)) {
- return wva.getWorldViewEstimatedCompletionDateStr();
- }
- if (xCol.equals(WorldXViewerFactory.Release_Date_Col)) {
- return wva.getWorldViewReleaseDateStr();
- }
- if (xCol.equals(WorldXViewerFactory.Deadline_Col)) {
- return wva.getWorldViewDeadlineDateStr();
- }
- if (xCol.equals(WorldXViewerFactory.Work_Package_Col)) {
- return wva.getWorldViewWorkPackage();
- }
- if (xCol.equals(WorldXViewerFactory.Points_Col)) {
- return wva.getWorldViewPoint();
- }
- if (xCol.equals(WorldXViewerFactory.Numeric1_Col)) {
- return wva.getWorldViewNumeric1();
- }
- if (xCol.equals(WorldXViewerFactory.Numeric2_Col)) {
- return wva.getWorldViewNumeric2();
- }
- if (xCol.equals(WorldXViewerFactory.Goal_Order_Vote_Col)) {
- return wva.getWorldViewGoalOrderVote();
- }
- if (xCol.equals(WorldXViewerFactory.Goal_Order)) {
- if (parentGoalArtifact != null) {
- return GoalArtifact.getGoalOrder(parentGoalArtifact, art);
- }
- return wva.getWorldViewGoalOrder();
- }
- if (xCol.equals(WorldXViewerFactory.Category_Col)) {
- return wva.getWorldViewCategory();
- }
- if (xCol.equals(WorldXViewerFactory.Category2_Col)) {
- return wva.getWorldViewCategory2();
- }
- if (xCol.equals(WorldXViewerFactory.Category3_Col)) {
- return wva.getWorldViewCategory3();
- }
- if (xCol.equals(WorldXViewerFactory.Number_of_Tasks_Col)) {
- return wva.getWorldViewNumberOfTasks();
- }
- if (xCol.equals(WorldXViewerFactory.Number_of_Tasks_Remining_Col)) {
- return wva.getWorldViewNumberOfTasksRemaining();
- }
- if (xCol.equals(WorldXViewerFactory.Review_Issues)) {
- return wva.getWorldViewNumberOfReviewIssueDefects();
- }
- if (xCol.equals(WorldXViewerFactory.Review_Major_Defects)) {
- return wva.getWorldViewNumberOfReviewMajorDefects();
- }
- if (xCol.equals(WorldXViewerFactory.Review_Minor_Defects)) {
- return wva.getWorldViewNumberOfReviewMinorDefects();
- }
- if (xCol.equals(WorldXViewerFactory.Last_Statused_Col)) {
- return wva.getWorldViewLastStatused();
- }
- if (xCol.equals(WorldXViewerFactory.Description_Col)) {
- return wva.getWorldViewDescription();
- }
- if (xCol.equals(WorldXViewerFactory.Validation_Required_Col)) {
- return wva.getWorldViewValidationRequiredStr();
- }
- if (xCol.equals(WorldXViewerFactory.Implementor_Col)) {
- return wva.getWorldViewImplementer();
- }
- if (xCol.equals(WorldXViewerFactory.Review_Author_Col)) {
- return wva.getWorldViewReviewAuthor();
- }
- if (xCol.equals(WorldXViewerFactory.Review_Moderator_Col)) {
- return wva.getWorldViewReviewModerator();
- }
- if (xCol.equals(WorldXViewerFactory.Review_Reviewer_Col)) {
- return wva.getWorldViewReviewReviewer();
- }
- if (xCol.equals(WorldXViewerFactory.Review_Decider_Col)) {
- return wva.getWorldViewReviewDecider();
- }
- if (xCol.equals(WorldXViewerFactory.Actions_Initiating_Workflow_Col)) {
- return wva.getWorldViewActionsIntiatingWorkflow();
- }
- if (xCol.equals(WorldXViewerFactory.Parent_ID_Col)) {
- return wva.getWorldViewParentID();
- }
- if (xCol.equals(WorldXViewerFactory.Parent_State_Col)) {
- return wva.getWorldViewParentState();
- }
- if (xCol.equals(WorldXViewerFactory.Days_In_Current_State)) {
- return wva.getWorldViewDaysInCurrentState();
- }
- if (xCol.equals(WorldXViewerFactory.Weekly_Benefit_Hrs_Col)) {
- return AtsUtil.doubleToI18nString(wva.getWorldViewWeeklyBenefit(), true);
- }
- if (xCol.equals(WorldXViewerFactory.Annual_Cost_Avoidance_Col)) {
- Result result = wva.isWorldViewAnnualCostAvoidanceValid();
- if (result.isFalse()) {
- return result.getText();
- }
- return AtsUtil.doubleToI18nString(wva.getWorldViewAnnualCostAvoidance(), true);
- }
- if (xCol.equals(WorldXViewerFactory.Work_Days_Needed_Col)) {
- Result result = wva.isWorldViewManDaysNeededValid();
- if (result.isFalse()) {
- return result.getText();
- }
- return AtsUtil.doubleToI18nString(wva.getWorldViewManDaysNeeded());
- }
- if (xCol.equals(WorldXViewerFactory.Artifact_Type_Col)) {
- return ((Artifact) wva).getArtifactTypeName();
- }
- if (xCol.equals(WorldXViewerFactory.Originating_Workflow)) {
- return wva.getWorldViewOriginatingWorkflowStr();
- }
- for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
- if (item.isXColumnProvider(xCol)) {
- String text = item.getColumnText(element, xCol, columnIndex);
- if (text != null) {
- return text;
- }
- }
- }
-
- return "Unhandled Column";
- } catch (Exception ex) {
- return XViewerCells.getCellExceptionString(ex);
- }
- }
-
- public void dispose() {
- if (font != null) {
- font.dispose();
- }
- font = null;
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public WorldXViewer getWorldXViewer() {
- return worldXViewer;
- }
-
- /**
- * Value will be set, and changed, as label provider refreshes its elements. This is so the goal members can tell
- * which parent they belong to.
- */
- public void setParentGoal(GoalArtifact parentGoalArtifact) {
- this.parentGoalArtifact = parentGoalArtifact;
- }
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.nebula.widgets.xviewer.XViewerCells;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
+import org.eclipse.osee.ats.artifact.GoalArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.widgets.dialog.TaskResOptionDefinition;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+public class WorldLabelProvider extends XViewerLabelProvider {
+
+ private final WorldXViewer worldXViewer;
+ protected Font font;
+ private GoalArtifact parentGoalArtifact;
+
+ public WorldLabelProvider(WorldXViewer worldXViewer) {
+ super(worldXViewer);
+ this.worldXViewer = worldXViewer;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, XViewerColumn xCol, int columnIndex) {
+ try {
+ if (!(element instanceof IWorldViewArtifact)) {
+ return null;
+ }
+ IWorldViewArtifact wva = (IWorldViewArtifact) element;
+ if (xCol.equals(WorldXViewerFactory.Change_Type_Col)) {
+ return wva.getWorldViewChangeType().getImage();
+ } else if (xCol.equals(WorldXViewerFactory.Type_Col)) {
+ return ArtifactImageManager.getImage((Artifact) element);
+ } else if (xCol.equals(WorldXViewerFactory.Assignees_Col)) {
+ return wva.getAssigneeImage();
+ } else if (xCol.equals(WorldXViewerFactory.Deadline_Col)) {
+ if (wva.isWorldViewDeadlineAlerting().isTrue()) {
+ return ImageManager.getImage(FrameworkImage.WARNING);
+ }
+ } else if (xCol.equals(WorldXViewerFactory.Artifact_Type_Col)) {
+ return ArtifactImageManager.getImage((Artifact) wva);
+ }
+ for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
+ if (item.isXColumnProvider(xCol)) {
+ Image image = item.getColumnImage(element, xCol, columnIndex);
+ if (image != null) {
+ return image;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+ return null;
+ }
+
+ @Override
+ public Color getForeground(Object element, XViewerColumn xCol, int columnIndex) {
+ try {
+ if (element instanceof TaskArtifact && xCol.equals(WorldXViewerFactory.Resolution_Col)) {
+ TaskArtifact taskArt = (TaskArtifact) element;
+ TaskResOptionDefinition def = taskArt.getTaskResolutionOptionDefinition(taskArt.getWorldViewResolution());
+ if (def != null) {
+ return Displays.getSystemColor(def.getColorInt());
+ }
+ }
+ for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
+ if (item.isXColumnProvider(xCol)) {
+ Color color = item.getForeground(element, xCol, columnIndex);
+ if (color != null) {
+ return color;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn xCol, int columnIndex) {
+ try {
+ // NOTE: HRID, Type, Title are handled by XViewerValueColumn values
+ if (!(element instanceof IWorldViewArtifact)) {
+ return "";
+ }
+ IWorldViewArtifact wva = (IWorldViewArtifact) element;
+ Artifact art = (Artifact) element;
+ if (art.isDeleted()) {
+ if (xCol.equals(WorldXViewerFactory.Title_Col)) {
+ return art.getName();
+ } else {
+ return "<deleted>";
+ }
+ }
+ if (xCol.equals(WorldXViewerFactory.Type_Col)) {
+ return wva.getWorldViewType();
+ }
+ if (xCol.equals(WorldXViewerFactory.State_Col)) {
+ return wva.getWorldViewState();
+ }
+ if (xCol.equals(WorldXViewerFactory.Assignees_Col)) {
+ return wva.getWorldViewActivePoc();
+ }
+ if (xCol.equals(WorldXViewerFactory.Change_Type_Col)) {
+ return wva.getWorldViewChangeTypeStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Priority_Col)) {
+ return wva.getWorldViewPriority();
+ }
+ if (xCol.equals(WorldXViewerFactory.Actionable_Items_Col)) {
+ return wva.getWorldViewActionableItems();
+ }
+ if (xCol.equals(WorldXViewerFactory.User_Community_Col)) {
+ return wva.getWorldViewUserCommunity();
+ }
+ if (xCol.equals(WorldXViewerFactory.Version_Target_Col)) {
+ return wva.getWorldViewTargetedVersionStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Notes_Col)) {
+ return wva.getWorldViewNotes();
+ }
+
+ if (xCol.equals(WorldXViewerFactory.Resolution_Col)) {
+ return wva.getWorldViewResolution();
+ }
+ if (xCol.equals(WorldXViewerFactory.Groups_Col)) {
+ return wva.getWorldViewGroups();
+ }
+ if (xCol.equals(WorldXViewerFactory.Goals_Col)) {
+ return wva.getWorldViewGoals();
+ }
+ if (xCol.equals(WorldXViewerFactory.Legacy_PCR_Col)) {
+ return wva.getWorldViewLegacyPCR();
+ }
+ if (xCol.equals(WorldXViewerFactory.Created_Date_Col)) {
+ return wva.getWorldViewCreatedDateStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Completed_Date_Col)) {
+ return wva.getWorldViewCompletedDateStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Cancelled_Date_Col)) {
+ return wva.getWorldViewCancelledDateStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Team_Col)) {
+ return wva.getWorldViewTeam();
+ }
+ if (xCol.equals(WorldXViewerFactory.Related_To_State_Col)) {
+ return wva.getWorldViewRelatedToState();
+ }
+ if (xCol.equals(WorldXViewerFactory.Originator_Col)) {
+ return wva.getWorldViewOriginator();
+ }
+ if (xCol.equals(WorldXViewerFactory.Branch_Status_Col)) {
+ return wva.getWorldViewBranchStatus();
+ }
+ if (xCol.equals(WorldXViewerFactory.Decision_Col)) {
+ return wva.getWorldViewDecision();
+ }
+ if (xCol.equals(WorldXViewerFactory.Estimated_Hours_Col)) {
+ return AtsUtil.doubleToI18nString(wva.getWorldViewEstimatedHours());
+ }
+ if (xCol.equals(WorldXViewerFactory.Remaining_Hours_Col)) {
+ Result result = wva.isWorldViewRemainHoursValid();
+ if (result.isFalse()) {
+ return result.getText();
+ }
+ return AtsUtil.doubleToI18nString(wva.getWorldViewRemainHours());
+ }
+ if (xCol.equals(WorldXViewerFactory.Percent_Complete_State_Col)) {
+ return String.valueOf(wva.getWorldViewPercentCompleteState());
+ }
+ if (xCol.equals(WorldXViewerFactory.Percent_Complete_State_Task_Col)) {
+ return String.valueOf(wva.getWorldViewPercentCompleteStateTask());
+ }
+ if (xCol.equals(WorldXViewerFactory.Percent_Complete_State_Review_Col)) {
+ return String.valueOf(wva.getWorldViewPercentCompleteStateReview());
+ }
+ if (xCol.equals(WorldXViewerFactory.Percent_Complete_Total_Col)) {
+ return String.valueOf(wva.getWorldViewPercentCompleteTotal());
+ }
+ if (xCol.equals(WorldXViewerFactory.Hours_Spent_State_Col)) {
+ return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentState());
+ }
+ if (xCol.equals(WorldXViewerFactory.Hours_Spent_State_Task_Col)) {
+ return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentStateTask());
+ }
+ if (xCol.equals(WorldXViewerFactory.Hours_Spent_State_Review_Col)) {
+ return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentStateReview());
+ }
+ if (xCol.equals(WorldXViewerFactory.Hours_Spent_Total_Col)) {
+ return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentStateTotal());
+ }
+
+ if (xCol.equals(WorldXViewerFactory.Total_Hours_Spent_Col)) {
+ return AtsUtil.doubleToI18nString(wva.getWorldViewHoursSpentTotal());
+ }
+
+ if (xCol.equals(WorldXViewerFactory.Percent_Rework_Col)) {
+ return wva.getWorldViewPercentReworkStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Estimated_Release_Date_Col)) {
+ return wva.getWorldViewEstimatedReleaseDateStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Estimated_Completion_Date_Col)) {
+ return wva.getWorldViewEstimatedCompletionDateStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Release_Date_Col)) {
+ return wva.getWorldViewReleaseDateStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Deadline_Col)) {
+ return wva.getWorldViewDeadlineDateStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Work_Package_Col)) {
+ return wva.getWorldViewWorkPackage();
+ }
+ if (xCol.equals(WorldXViewerFactory.Points_Col)) {
+ return wva.getWorldViewPoint();
+ }
+ if (xCol.equals(WorldXViewerFactory.Numeric1_Col)) {
+ return wva.getWorldViewNumeric1();
+ }
+ if (xCol.equals(WorldXViewerFactory.Numeric2_Col)) {
+ return wva.getWorldViewNumeric2();
+ }
+ if (xCol.equals(WorldXViewerFactory.Goal_Order_Vote_Col)) {
+ return wva.getWorldViewGoalOrderVote();
+ }
+ if (xCol.equals(WorldXViewerFactory.Goal_Order)) {
+ if (parentGoalArtifact != null) {
+ return GoalArtifact.getGoalOrder(parentGoalArtifact, art);
+ }
+ return wva.getWorldViewGoalOrder();
+ }
+ if (xCol.equals(WorldXViewerFactory.Category_Col)) {
+ return wva.getWorldViewCategory();
+ }
+ if (xCol.equals(WorldXViewerFactory.Category2_Col)) {
+ return wva.getWorldViewCategory2();
+ }
+ if (xCol.equals(WorldXViewerFactory.Category3_Col)) {
+ return wva.getWorldViewCategory3();
+ }
+ if (xCol.equals(WorldXViewerFactory.Number_of_Tasks_Col)) {
+ return wva.getWorldViewNumberOfTasks();
+ }
+ if (xCol.equals(WorldXViewerFactory.Number_of_Tasks_Remining_Col)) {
+ return wva.getWorldViewNumberOfTasksRemaining();
+ }
+ if (xCol.equals(WorldXViewerFactory.Review_Issues)) {
+ return wva.getWorldViewNumberOfReviewIssueDefects();
+ }
+ if (xCol.equals(WorldXViewerFactory.Review_Major_Defects)) {
+ return wva.getWorldViewNumberOfReviewMajorDefects();
+ }
+ if (xCol.equals(WorldXViewerFactory.Review_Minor_Defects)) {
+ return wva.getWorldViewNumberOfReviewMinorDefects();
+ }
+ if (xCol.equals(WorldXViewerFactory.Last_Statused_Col)) {
+ return wva.getWorldViewLastStatused();
+ }
+ if (xCol.equals(WorldXViewerFactory.Description_Col)) {
+ return wva.getWorldViewDescription();
+ }
+ if (xCol.equals(WorldXViewerFactory.Validation_Required_Col)) {
+ return wva.getWorldViewValidationRequiredStr();
+ }
+ if (xCol.equals(WorldXViewerFactory.Implementor_Col)) {
+ return wva.getWorldViewImplementer();
+ }
+ if (xCol.equals(WorldXViewerFactory.Review_Author_Col)) {
+ return wva.getWorldViewReviewAuthor();
+ }
+ if (xCol.equals(WorldXViewerFactory.Review_Moderator_Col)) {
+ return wva.getWorldViewReviewModerator();
+ }
+ if (xCol.equals(WorldXViewerFactory.Review_Reviewer_Col)) {
+ return wva.getWorldViewReviewReviewer();
+ }
+ if (xCol.equals(WorldXViewerFactory.Review_Decider_Col)) {
+ return wva.getWorldViewReviewDecider();
+ }
+ if (xCol.equals(WorldXViewerFactory.Actions_Initiating_Workflow_Col)) {
+ return wva.getWorldViewActionsIntiatingWorkflow();
+ }
+ if (xCol.equals(WorldXViewerFactory.Parent_ID_Col)) {
+ return wva.getWorldViewParentID();
+ }
+ if (xCol.equals(WorldXViewerFactory.Parent_State_Col)) {
+ return wva.getWorldViewParentState();
+ }
+ if (xCol.equals(WorldXViewerFactory.Days_In_Current_State)) {
+ return wva.getWorldViewDaysInCurrentState();
+ }
+ if (xCol.equals(WorldXViewerFactory.Weekly_Benefit_Hrs_Col)) {
+ return AtsUtil.doubleToI18nString(wva.getWorldViewWeeklyBenefit(), true);
+ }
+ if (xCol.equals(WorldXViewerFactory.Annual_Cost_Avoidance_Col)) {
+ Result result = wva.isWorldViewAnnualCostAvoidanceValid();
+ if (result.isFalse()) {
+ return result.getText();
+ }
+ return AtsUtil.doubleToI18nString(wva.getWorldViewAnnualCostAvoidance(), true);
+ }
+ if (xCol.equals(WorldXViewerFactory.Work_Days_Needed_Col)) {
+ Result result = wva.isWorldViewManDaysNeededValid();
+ if (result.isFalse()) {
+ return result.getText();
+ }
+ return AtsUtil.doubleToI18nString(wva.getWorldViewManDaysNeeded());
+ }
+ if (xCol.equals(WorldXViewerFactory.Artifact_Type_Col)) {
+ return ((Artifact) wva).getArtifactTypeName();
+ }
+ if (xCol.equals(WorldXViewerFactory.Originating_Workflow)) {
+ return wva.getWorldViewOriginatingWorkflowStr();
+ }
+ for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
+ if (item.isXColumnProvider(xCol)) {
+ String text = item.getColumnText(element, xCol, columnIndex);
+ if (text != null) {
+ return text;
+ }
+ }
+ }
+
+ return "Unhandled Column";
+ } catch (Exception ex) {
+ return XViewerCells.getCellExceptionString(ex);
+ }
+ }
+
+ public void dispose() {
+ if (font != null) {
+ font.dispose();
+ }
+ font = null;
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public WorldXViewer getWorldXViewer() {
+ return worldXViewer;
+ }
+
+ /**
+ * Value will be set, and changed, as label provider refreshes its elements. This is so the goal members can tell
+ * which parent they belong to.
+ */
+ public void setParentGoal(GoalArtifact parentGoalArtifact) {
+ this.parentGoalArtifact = parentGoalArtifact;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java
index 9488841589b..122bc6551f2 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewDragAndDrop.java
@@ -1,138 +1,138 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-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.IStructuredSelection;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.world.search.GroupWorldSearchItem;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.Jobs;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
-import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldViewDragAndDrop extends SkynetDragAndDrop {
-
- private final WorldComposite worldComposite;
-
- public WorldViewDragAndDrop(WorldComposite worldComposite, String viewId) {
- super(worldComposite.getXViewer().getTree(), viewId);
- this.worldComposite = worldComposite;
- }
-
- @Override
- public Artifact[] getArtifacts() {
- IStructuredSelection selection = (IStructuredSelection) worldComposite.getXViewer().getSelection();
- Iterator<?> i = selection.iterator();
- List<Artifact> artifacts = new ArrayList<Artifact>();
- while (i.hasNext()) {
- Object object = i.next();
- if (object instanceof Artifact) {
- artifacts.add((Artifact) object);
- }
- }
- return artifacts.toArray(new Artifact[artifacts.size()]);
- }
-
- private boolean isValidForArtifactDrop(DropTargetEvent event) throws OseeCoreException {
- if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
- ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
-
- if (artData != null) {
- Artifact[] artifacts = artData.getArtifacts();
- for (Artifact art : artifacts) {
- if (art instanceof IWorldViewArtifact || art.isOfType(CoreArtifactTypes.UniversalGroup)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- @Override
- public void performDragOver(DropTargetEvent event) throws OseeCoreException {
- if (isValidForArtifactDrop(event)) {
- event.detail = DND.DROP_COPY;
- }
- }
-
- @Override
- public void performDrop(final DropTargetEvent event) {
- if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
- final ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
- Job job = new Job("Loading WorldView...") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- String name = "Dropped Artifacts";
- Set<Artifact> arts = new HashSet<Artifact>();
- if (artData != null) {
- Artifact[] artifacts = artData.getArtifacts();
- if (artifacts.length == 1) {
- Artifact art = artifacts[0];
- if (art instanceof IWorldViewArtifact) {
- name = art.getName();
- } else if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
- GroupWorldSearchItem groupWorldSearchItem = new GroupWorldSearchItem(art.getBranch());
- groupWorldSearchItem.setSelectedGroup(art);
- WorldEditor.open(new WorldEditorUISearchItemProvider(groupWorldSearchItem, null,
- TableLoadOption.NoUI));
- return Status.OK_STATUS;
- }
- }
- for (Artifact art : artifacts) {
- if (art instanceof IWorldViewArtifact) {
- arts.add(art);
- } else if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
- for (Artifact relArt : art.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members)) {
- if (relArt instanceof IWorldViewArtifact) {
- arts.add(relArt);
- }
- }
- }
- }
- }
- if (arts.size() > 0) {
- WorldEditor.open(new WorldEditorSimpleProvider(name, arts));
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, ex.getLocalizedMessage(), ex);
- }
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+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.IStructuredSelection;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.world.search.GroupWorldSearchItem;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
+import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldViewDragAndDrop extends SkynetDragAndDrop {
+
+ private final WorldComposite worldComposite;
+
+ public WorldViewDragAndDrop(WorldComposite worldComposite, String viewId) {
+ super(worldComposite.getXViewer().getTree(), viewId);
+ this.worldComposite = worldComposite;
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ IStructuredSelection selection = (IStructuredSelection) worldComposite.getXViewer().getSelection();
+ Iterator<?> i = selection.iterator();
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ while (i.hasNext()) {
+ Object object = i.next();
+ if (object instanceof Artifact) {
+ artifacts.add((Artifact) object);
+ }
+ }
+ return artifacts.toArray(new Artifact[artifacts.size()]);
+ }
+
+ private boolean isValidForArtifactDrop(DropTargetEvent event) throws OseeCoreException {
+ if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
+
+ if (artData != null) {
+ Artifact[] artifacts = artData.getArtifacts();
+ for (Artifact art : artifacts) {
+ if (art instanceof IWorldViewArtifact || art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void performDragOver(DropTargetEvent event) throws OseeCoreException {
+ if (isValidForArtifactDrop(event)) {
+ event.detail = DND.DROP_COPY;
+ }
+ }
+
+ @Override
+ public void performDrop(final DropTargetEvent event) {
+ if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ final ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
+ Job job = new Job("Loading WorldView...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ String name = "Dropped Artifacts";
+ Set<Artifact> arts = new HashSet<Artifact>();
+ if (artData != null) {
+ Artifact[] artifacts = artData.getArtifacts();
+ if (artifacts.length == 1) {
+ Artifact art = artifacts[0];
+ if (art instanceof IWorldViewArtifact) {
+ name = art.getName();
+ } else if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ GroupWorldSearchItem groupWorldSearchItem = new GroupWorldSearchItem(art.getBranch());
+ groupWorldSearchItem.setSelectedGroup(art);
+ WorldEditor.open(new WorldEditorUISearchItemProvider(groupWorldSearchItem, null,
+ TableLoadOption.NoUI));
+ return Status.OK_STATUS;
+ }
+ }
+ for (Artifact art : artifacts) {
+ if (art instanceof IWorldViewArtifact) {
+ arts.add(art);
+ } else if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ for (Artifact relArt : art.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members)) {
+ if (relArt instanceof IWorldViewArtifact) {
+ arts.add(relArt);
+ }
+ }
+ }
+ }
+ }
+ if (arts.size() > 0) {
+ WorldEditor.open(new WorldEditorSimpleProvider(name, arts));
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, ex.getLocalizedMessage(), ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java
index d1a22dea7ca..52aaf02a228 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.world;
-
+package org.eclipse.osee.ats.world;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -30,117 +30,117 @@ import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType;
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.swt.Displays;
-
-/**
- * Common location for event handling for task and world composites in order to keep number of registrations and
- * processing to a minimum.
- *
- * @author Donald G. Dunne
- */
-public class WorldViewerEventManager implements IArtifactEventListener {
-
- List<IWorldViewerEventHandler> handlers = new ArrayList<IWorldViewerEventHandler>();
- static WorldViewerEventManager instance;
-
- public static void add(IWorldViewerEventHandler iWorldEventHandler) {
- if (instance == null) {
- instance = new WorldViewerEventManager();
- OseeEventManager.addListener(instance);
- }
- instance.handlers.add(iWorldEventHandler);
- }
-
- public static void remove(IWorldViewerEventHandler iWorldEventHandler) {
- if (instance != null) {
- instance.handlers.remove(iWorldEventHandler);
- }
- }
-
- @Override
- public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
- for (IWorldViewerEventHandler handler : new CopyOnWriteArrayList<IWorldViewerEventHandler>(handlers)) {
- if (handler.isDisposed()) {
- handlers.remove(handler);
- }
- }
- try {
- if (artifactEvent.getBranchGuid() == null || !artifactEvent.getBranchGuid().equals(
- AtsUtil.getAtsBranch().getGuid())) {
- return;
- }
- } catch (OseeCoreException ex) {
- return;
- }
- final Collection<Artifact> modifiedArts =
- artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
- final Collection<Artifact> relModifiedArts = artifactEvent.getRelCacheArtifacts();
- final Collection<EventBasicGuidArtifact> deletedPurgedArts =
- artifactEvent.get(EventModType.Deleted, EventModType.Purged);
-
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!deletedPurgedArts.isEmpty()) {
- for (IWorldViewerEventHandler handler : handlers) {
- if (!handler.isDisposed()) {
- // allow handler to remove from model
- handler.removeItems(deletedPurgedArts);
- IContentProvider contentProvider = handler.getWorldXViewer().getContentProvider();
- // remove from UI
- if (contentProvider instanceof WorldContentProvider) {
- handler.getWorldXViewer().remove(
- deletedPurgedArts.toArray(new Object[deletedPurgedArts.size()]));
- }
- }
- }
- }
- for (IWorldViewerEventHandler handler : handlers) {
- if (!handler.isDisposed()) {
- for (Artifact artifact : modifiedArts) {
- try {
- // Don't refresh deleted artifacts
- if (artifact.isDeleted()) {
- continue;
- }
- if (artifact instanceof IWorldViewArtifact) {
- handler.getWorldXViewer().refresh(artifact);
- // If parent is loaded and child changed, refresh parent
- if (artifact instanceof StateMachineArtifact && ((StateMachineArtifact) artifact).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- handler.getWorldXViewer().refresh(
- ((StateMachineArtifact) artifact).getParentAtsArtifact());
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- for (Artifact art : relModifiedArts) {
- // Don't refresh deleted artifacts
- if (art.isDeleted()) {
- continue;
- }
- if (art instanceof IWorldViewArtifact) {
- handler.getWorldXViewer().refresh(art);
- // If parent is loaded and child changed, refresh parent
- try {
- if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- handler.getWorldXViewer().refresh(((StateMachineArtifact) art).getParentAtsArtifact());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- }
- }
- });
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return AtsUtil.getAtsObjectEventFilters();
- }
-
-}
+
+/**
+ * Common location for event handling for task and world composites in order to keep number of registrations and
+ * processing to a minimum.
+ *
+ * @author Donald G. Dunne
+ */
+public class WorldViewerEventManager implements IArtifactEventListener {
+
+ List<IWorldViewerEventHandler> handlers = new ArrayList<IWorldViewerEventHandler>();
+ static WorldViewerEventManager instance;
+
+ public static void add(IWorldViewerEventHandler iWorldEventHandler) {
+ if (instance == null) {
+ instance = new WorldViewerEventManager();
+ OseeEventManager.addListener(instance);
+ }
+ instance.handlers.add(iWorldEventHandler);
+ }
+
+ public static void remove(IWorldViewerEventHandler iWorldEventHandler) {
+ if (instance != null) {
+ instance.handlers.remove(iWorldEventHandler);
+ }
+ }
+
+ @Override
+ public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
+ for (IWorldViewerEventHandler handler : new CopyOnWriteArrayList<IWorldViewerEventHandler>(handlers)) {
+ if (handler.isDisposed()) {
+ handlers.remove(handler);
+ }
+ }
+ try {
+ if (artifactEvent.getBranchGuid() == null || !artifactEvent.getBranchGuid().equals(
+ AtsUtil.getAtsBranch().getGuid())) {
+ return;
+ }
+ } catch (OseeCoreException ex) {
+ return;
+ }
+ final Collection<Artifact> modifiedArts =
+ artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
+ final Collection<Artifact> relModifiedArts = artifactEvent.getRelCacheArtifacts();
+ final Collection<EventBasicGuidArtifact> deletedPurgedArts =
+ artifactEvent.get(EventModType.Deleted, EventModType.Purged);
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (!deletedPurgedArts.isEmpty()) {
+ for (IWorldViewerEventHandler handler : handlers) {
+ if (!handler.isDisposed()) {
+ // allow handler to remove from model
+ handler.removeItems(deletedPurgedArts);
+ IContentProvider contentProvider = handler.getWorldXViewer().getContentProvider();
+ // remove from UI
+ if (contentProvider instanceof WorldContentProvider) {
+ handler.getWorldXViewer().remove(
+ deletedPurgedArts.toArray(new Object[deletedPurgedArts.size()]));
+ }
+ }
+ }
+ }
+ for (IWorldViewerEventHandler handler : handlers) {
+ if (!handler.isDisposed()) {
+ for (Artifact artifact : modifiedArts) {
+ try {
+ // Don't refresh deleted artifacts
+ if (artifact.isDeleted()) {
+ continue;
+ }
+ if (artifact instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(artifact);
+ // If parent is loaded and child changed, refresh parent
+ if (artifact instanceof StateMachineArtifact && ((StateMachineArtifact) artifact).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(
+ ((StateMachineArtifact) artifact).getParentAtsArtifact());
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ for (Artifact art : relModifiedArts) {
+ // Don't refresh deleted artifacts
+ if (art.isDeleted()) {
+ continue;
+ }
+ if (art instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(art);
+ // If parent is loaded and child changed, refresh parent
+ try {
+ if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(((StateMachineArtifact) art).getParentAtsArtifact());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return AtsUtil.getAtsObjectEventFilters();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
index ee5196a5534..df7bca50496 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
@@ -1,1128 +1,1128 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.ats.AtsOpenOption;
-import org.eclipse.osee.ats.actions.ConvertActionableItemsAction;
-import org.eclipse.osee.ats.actions.DeletePurgeAtsArtifactsAction;
-import org.eclipse.osee.ats.actions.EmailActionAction;
-import org.eclipse.osee.ats.actions.FavoriteAction;
-import org.eclipse.osee.ats.actions.ISelectedAtsArtifacts;
-import org.eclipse.osee.ats.actions.OpenInArtifactEditorAction;
-import org.eclipse.osee.ats.actions.OpenInAtsWorkflowEditor;
-import org.eclipse.osee.ats.actions.OpenInMassEditorAction;
-import org.eclipse.osee.ats.actions.SubscribedAction;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.GoalArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.artifact.VersionArtifact.VersionReleaseType;
-import org.eclipse.osee.ats.editor.SMAPromptChangeStatus;
-import org.eclipse.osee.ats.goal.GoalXViewerFactory;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.task.TaskEditor;
-import org.eclipse.osee.ats.task.TaskEditorSimpleProvider;
-import org.eclipse.osee.ats.task.TaskXViewer;
-import org.eclipse.osee.ats.util.ArtifactEmailWizard;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.PromptChangeUtil;
-import org.eclipse.osee.ats.util.xviewer.column.XViewerAtsAttributeColumn;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
-import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
-import org.eclipse.osee.framework.skynet.core.event.IArtifactReloadEventListener;
-import org.eclipse.osee.framework.skynet.core.event.IArtifactsChangeTypeEventListener;
-import org.eclipse.osee.framework.skynet.core.event.IArtifactsPurgedEventListener;
-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.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactPromptChange;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerAttributeColumn;
-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.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-
-/**
- * <REM2>
- *
- * @author Donald G. Dunne
- */
-public class WorldXViewer extends XViewer implements ISelectedAtsArtifacts, IArtifactsPurgedEventListener, IArtifactReloadEventListener, IArtifactsChangeTypeEventListener, IFrameworkTransactionEventListener {
- private String title;
- private String extendedStatusString = "";
- public static final String MENU_GROUP_ATS_WORLD_EDIT = "ATS WORLD EDIT";
- public static final String MENU_GROUP_ATS_WORLD_OPEN = "ATS WORLD OPEN";
- public static final String MENU_GROUP_ATS_WORLD_OTHER = "ATS WORLD OTHER";
- public static final String ADD_AS_FAVORITE = "Add as Favorite";
- public static final String REMOVE_FAVORITE = "Remove Favorite";
- public static final String SUBSCRIBE = "Subscribe for Notifications";
- public static final String UN_SUBSCRIBE = "Un-Subscribe for Notifications";
- public final WorldXViewer thisXViewer = this;
-
- public WorldXViewer(Composite parent, int style, IXViewerFactory xViewerFactory) {
- super(parent, style, xViewerFactory);
- }
-
- @Override
- public void handleArtifactsPurgedEvent(Sender sender, final LoadedArtifacts loadedArtifacts) {
- if (thisXViewer.getTree().isDisposed()) {
- OseeEventManager.removeListener(this);
- return;
- }
- try {
- if (loadedArtifacts.getLoadedArtifacts().isEmpty()) {
- return;
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- IContentProvider contentProvider = getContentProvider();
- if (contentProvider instanceof WorldContentProvider) {
- remove(loadedArtifacts.getLoadedArtifacts().toArray());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
-
- }
-
- @Override
- public void handleArtifactsChangeTypeEvent(Sender sender, int toArtifactTypeId, final LoadedArtifacts loadedArtifacts) {
- if (thisXViewer.getTree().isDisposed()) {
- OseeEventManager.removeListener(this);
- return;
- }
- try {
- if (loadedArtifacts.getLoadedArtifacts().isEmpty()) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- remove(loadedArtifacts.getLoadedArtifacts().toArray(
- new Object[loadedArtifacts.getLoadedArtifacts().size()]));
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
- if (thisXViewer.getTree().isDisposed()) {
- OseeEventManager.removeListener(this);
- return;
- }
- if (transData.branchId != AtsUtil.getAtsBranch().getId()) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (getContentProvider() == null) {
- return;
- }
- if (transData.cacheDeletedArtifacts.size() > 0) {
- remove(transData.cacheDeletedArtifacts.toArray(new Object[transData.cacheDeletedArtifacts.size()]));
- }
- if (transData.cacheChangedArtifacts.size() > 0) {
- update(transData.cacheChangedArtifacts.toArray(new Object[transData.cacheChangedArtifacts.size()]), null);
- for (Artifact art : transData.cacheChangedArtifacts) {
- if (art instanceof IWorldViewArtifact) {
- // If parent is loaded and child changed, refresh parent
- try {
- if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- update(((StateMachineArtifact) art).getParentAtsArtifact(), null);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- Set<Artifact> arts = new HashSet<Artifact>();
- arts.addAll(transData.cacheRelationAddedArtifacts);
- arts.addAll(transData.cacheRelationChangedArtifacts);
- arts.addAll(transData.cacheRelationDeletedArtifacts);
- for (Artifact art : arts) {
- // Don't refresh deleted artifacts
- if (art.isDeleted()) {
- continue;
- }
- if (art instanceof IWorldViewArtifact) {
- refresh(art);
- // If parent is loaded and child changed, refresh parent
- try {
- if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- refresh(((StateMachineArtifact) art).getParentAtsArtifact());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- });
- }
-
- @Override
- protected void createSupportWidgets(Composite parent) {
- final WorldXViewer fWorldXViewer = this;
- super.createSupportWidgets(parent);
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- OseeEventManager.removeListener(fWorldXViewer); // <REM2> Don't need this cause handled through IWorldViewerEventHandler
- ((WorldContentProvider) getContentProvider()).clear(false);
- }
- });
- createMenuActions();
- OseeEventManager.addListener(this); // <REM2> Don't need this cause handled through IWorldViewerEventHandler
- }
-
- Action editStatusAction, editNotesAction, editResolutionAction, editEstimateAction, editChangeTypeAction,
- editPriorityAction, editTargetVersionAction, editAssigneeAction, editActionableItemsAction;
- ConvertActionableItemsAction convertActionableItemsAction;
- Action openInAtsWorldEditorAction, openInAtsTaskEditorAction;
- OpenInAtsWorkflowEditor openInAtsWorkflowEditorAction;
- OpenInArtifactEditorAction openInArtifactEditorAction;
- OpenInMassEditorAction openInMassEditorAction;
- FavoriteAction favoritesAction;
- SubscribedAction subscribedAction;
- DeletePurgeAtsArtifactsAction deletePurgeAtsObjectAction;
- EmailActionAction emailAction;
- Action resetActionArtifactAction;
-
- public void createMenuActions() {
-
- convertActionableItemsAction = new ConvertActionableItemsAction(this);
- openInMassEditorAction = new OpenInMassEditorAction(this);
- openInAtsWorkflowEditorAction = new OpenInAtsWorkflowEditor("Open", this);
- favoritesAction = new FavoriteAction(this);
- subscribedAction = new SubscribedAction(this);
- openInArtifactEditorAction = new OpenInArtifactEditorAction(this);
- deletePurgeAtsObjectAction = new DeletePurgeAtsArtifactsAction(this);
- emailAction = new EmailActionAction(this);
-
- editNotesAction = new Action("Edit Notes", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- if (PromptChangeUtil.promptChangeAttribute(getSelectedSMAArtifacts(), ATSAttributes.SMA_NOTE_ATTRIBUTE,
- true, true)) {
- update(getSelectedSMAArtifacts().toArray(), null);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- editResolutionAction = new Action("Edit Resolution", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- if (PromptChangeUtil.promptChangeAttribute(getSelectedSMAArtifacts(),
- ATSAttributes.RESOLUTION_ATTRIBUTE, true, true)) {
- update(getSelectedSMAArtifacts().toArray(), null);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- editStatusAction = new Action("Edit Status", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- if (SMAPromptChangeStatus.promptChangeStatus(getSelectedSMAArtifacts(), true)) {
- update(getSelectedSMAArtifacts().toArray(), null);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- editEstimateAction = new Action("Edit Estimated Hours", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- if (ArtifactPromptChange.promptChangeFloatAttribute(
- ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName(),
- ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getDisplayName(), getSelectedSMAArtifacts(), true)) {
- update(getSelectedSMAArtifacts().toArray(), null);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- editChangeTypeAction = new Action("Edit Change Type", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- if (PromptChangeUtil.promptChangeType(getSelectedTeamWorkflowArtifacts(), true)) {
- update(getSelectedArtifactItems().toArray(), null);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- editPriorityAction = new Action("Edit Priority", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- if (PromptChangeUtil.promptChangePriority(getSelectedTeamWorkflowArtifacts(), true)) {
- update(getSelectedArtifactItems().toArray(), null);
- }
- }
- };
-
- editTargetVersionAction = new Action("Edit Targeted Version", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- if (PromptChangeUtil.promptChangeVersion(getSelectedTeamWorkflowArtifacts(),
- (AtsUtil.isAtsAdmin() ? VersionReleaseType.Both : VersionReleaseType.UnReleased), true)) {
- update(getSelectedArtifactItems().toArray(), null);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- editAssigneeAction = new Action("Edit Assignee", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- Set<StateMachineArtifact> artifacts = getSelectedSMAArtifacts();
- if (PromptChangeUtil.promptChangeAssignees(artifacts, false)) {
- Artifacts.persistInTransaction(artifacts);
- update(getSelectedArtifactItems().toArray(), null);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- editActionableItemsAction = new Action("Edit Actionable Item(s)", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- try {
- if (getSelectedActionArtifacts().size() == 1) {
- ActionArtifact actionArt = getSelectedActionArtifacts().iterator().next();
- AtsUtil.editActionableItems(actionArt);
- refresh(getSelectedArtifactItems().iterator().next());
- } else {
- TeamWorkFlowArtifact teamArt = getSelectedTeamWorkflowArtifacts().iterator().next();
- AtsUtil.editActionableItems(teamArt);
- refresh(getSelectedArtifactItems().toArray()[0]);
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
-
- openInAtsWorldEditorAction = new Action("Open in ATS World Editor", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- if (getSelectedArtifacts().isEmpty()) {
- AWorkbench.popup("Error", "No items selected");
- return;
- }
- WorldEditorInput worldEditorInput = null;
- if (thisXViewer instanceof TaskXViewer) {
- worldEditorInput =
- new WorldEditorInput(new WorldEditorSimpleProvider("ATS World", getSelectedArtifacts(), null,
- TableLoadOption.None));
- } else {
- worldEditorInput =
- new WorldEditorInput(new WorldEditorSimpleProvider("ATS World", getSelectedArtifacts(),
- getCustomizeMgr().generateCustDataFromTable(), TableLoadOption.None));
- }
- if (worldEditorInput != null) {
- IWorkbenchPage page = AWorkbench.getActivePage();
- try {
- page.openEditor(worldEditorInput, WorldEditor.EDITOR_ID);
- } catch (PartInitException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(AtsImage.GLOBE);
- }
-
- };
-
- openInAtsTaskEditorAction = new Action("Open in ATS Task Editor", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- if (getSelectedTaskArtifacts().isEmpty()) {
- AWorkbench.popup("Error", "No Tasks selected");
- return;
- }
- try {
- TaskEditor.open(new TaskEditorSimpleProvider("ATS Tasks", getSelectedTaskArtifacts()));
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(AtsImage.TASK);
- }
-
- };
-
- resetActionArtifactAction = new Action("Reset Action off Children", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- SkynetTransaction transaction;
- try {
- transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Reset Action off Children");
- for (ActionArtifact actionArt : getSelectedActionArtifacts()) {
- actionArt.resetAttributesOffChildren(transaction);
- }
- transaction.execute();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
-
- }
- };
- }
-
- @Override
- public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
- handleColumnMultiEdit(treeColumn, treeItems, true);
- }
-
- public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems, final boolean persist) {
- if (treeColumn.getData().equals(WorldXViewerFactory.Groups_Col)) {
- try {
- Set<StateMachineArtifact> smas = new HashSet<StateMachineArtifact>();
- for (TreeItem item : treeItems) {
- Artifact art = (Artifact) item.getData();
- if (art instanceof TeamWorkFlowArtifact) {
- smas.add((StateMachineArtifact) art);
- }
- }
- PromptChangeUtil.promptChangeGroups(smas, true);
- return;
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- } else if (treeColumn.getData().equals(WorldXViewerFactory.Goals_Col)) {
- try {
- Set<StateMachineArtifact> smas = new HashSet<StateMachineArtifact>();
- for (TreeItem item : treeItems) {
- Artifact art = (Artifact) item.getData();
- if (art instanceof StateMachineArtifact) {
- smas.add((StateMachineArtifact) art);
- }
- }
- PromptChangeUtil.promptChangeGoals(smas, true);
- return;
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- } else if (treeColumn.getData().equals(WorldXViewerFactory.Points_Col)) {
- try {
- Set<TeamWorkFlowArtifact> smas = new HashSet<TeamWorkFlowArtifact>();
- for (TreeItem item : treeItems) {
- Artifact art = (Artifact) item.getData();
- if (art instanceof TeamWorkFlowArtifact) {
- smas.add((TeamWorkFlowArtifact) art);
- }
- }
- PromptChangeUtil.promptChangePoints(smas, true);
- return;
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- if (!(treeColumn.getData() instanceof XViewerAttributeColumn) && !(treeColumn.getData() instanceof XViewerAtsAttributeColumn)) {
- AWorkbench.popup("ERROR", "Column is not attribute and thus not multi-editable " + treeColumn.getText());
- return;
- }
-
- XResultData rData = new XResultData();
- String attrName = null;
- if (treeColumn.getData() instanceof XViewerAttributeColumn) {
- final XViewerAttributeColumn xCol = (XViewerAttributeColumn) treeColumn.getData();
- attrName = xCol.getAttributeTypeName();
- }
- if (treeColumn.getData() instanceof XViewerAtsAttributeColumn) {
- final XViewerAtsAttributeColumn xCol = (XViewerAtsAttributeColumn) treeColumn.getData();
- attrName = xCol.getAttributeTypeName();
- }
- if (attrName == null) {
- AWorkbench.popup("ERROR", "Can't retrieve attribute name from attribute column " + treeColumn.getText());
- return;
- }
- final Set<Artifact> useArts = new HashSet<Artifact>();
- for (TreeItem item : treeItems) {
- Artifact art = (Artifact) item.getData();
- try {
- if (art.isAttributeTypeValid(attrName)) {
- useArts.add(art);
- } else {
- rData.logError(attrName + " not valid for artifact " + art.getGuid() + " - " + art.getName());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- rData.logError(ex.getLocalizedMessage());
- }
- }
-
- try {
- if (!rData.isEmpty()) {
- rData.report("Column Multi Edit Errors");
- return;
- }
- if (useArts.size() > 0) {
- ArtifactPromptChange.promptChangeAttribute(attrName, attrName, useArts, persist);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public boolean isColumnMultiEditable(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
- if (treeColumn.getData().equals(WorldXViewerFactory.Groups_Col)) {
- return true;
- }
- if (!(treeColumn.getData() instanceof XViewerColumn)) {
- return false;
- }
- if (!((XViewerColumn) treeColumn.getData()).isMultiColumnEditable()) {
- return false;
- }
- String attrName = null;
- // Currently don't know how to multi-edit anything but attribute
- if (treeColumn.getData() instanceof XViewerAttributeColumn) {
- XViewerAttributeColumn xCol = (XViewerAttributeColumn) treeColumn.getData();
- attrName = xCol.getAttributeTypeName();
- } else if (treeColumn.getData() instanceof XViewerAtsAttributeColumn) {
- XViewerAtsAttributeColumn xCol = (XViewerAtsAttributeColumn) treeColumn.getData();
- attrName = xCol.getAttributeTypeName();
- } else {
- return false;
- }
-
- if (attrName == null) {
- AWorkbench.popup("ERROR", "Can't retrieve attribute name from attribute column " + treeColumn.getText());
- return false;
- }
- for (TreeItem item : treeItems) {
- if (item.getData() instanceof ActionArtifact) {
- return false;
- }
- try {
- if (!((Artifact) item.getData()).isAttributeTypeValid(attrName)) {
- return false;
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean isColumnMultiEditEnabled() {
- return true;
- }
-
- public void handleEmailSelectedAtsObject() throws OseeCoreException {
- Artifact art = getSelectedArtifacts().iterator().next();
- if (art instanceof ActionArtifact) {
- if (((ActionArtifact) art).getTeamWorkFlowArtifacts().size() > 1) {
- art = AtsUtil.promptSelectTeamWorkflow((ActionArtifact) art);
- if (art == null) {
- return;
- }
- } else {
- art = ((ActionArtifact) art).getTeamWorkFlowArtifacts().iterator().next();
- }
- }
- if (art != null) {
- ArtifactEmailWizard ew = new ArtifactEmailWizard((StateMachineArtifact) art);
- WizardDialog dialog = new WizardDialog(Displays.getActiveShell(), ew);
- dialog.create();
- dialog.open();
- }
- }
-
- public StateMachineArtifact getSelectedSMA() {
- Object obj = null;
- if (getSelectedArtifactItems().isEmpty()) {
- return null;
- }
- obj = getTree().getSelection()[0].getData();
- return obj != null && obj instanceof StateMachineArtifact ? (StateMachineArtifact) obj : null;
- }
-
- public void updateEditMenuActions() {
- MenuManager mm = getMenuManager();
-
- // EDIT MENU BLOCK
- mm.insertBefore(MENU_GROUP_PRE, editChangeTypeAction);
- editChangeTypeAction.setEnabled(getSelectedTeamWorkflowArtifacts().size() > 0);
-
- mm.insertBefore(MENU_GROUP_PRE, editPriorityAction);
- editPriorityAction.setEnabled(getSelectedTeamWorkflowArtifacts().size() > 0);
-
- mm.insertBefore(MENU_GROUP_PRE, editTargetVersionAction);
- editTargetVersionAction.setEnabled(getSelectedTeamWorkflowArtifacts().size() > 0);
-
- mm.insertBefore(MENU_GROUP_PRE, editAssigneeAction);
- editAssigneeAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
-
- mm.insertBefore(MENU_GROUP_PRE, editStatusAction);
- editStatusAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
-
- mm.insertBefore(MENU_GROUP_PRE, editEstimateAction);
- editEstimateAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
-
- mm.insertBefore(MENU_GROUP_PRE, editResolutionAction);
- editResolutionAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
-
- mm.insertBefore(MENU_GROUP_PRE, editNotesAction);
- editNotesAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
-
- mm.insertBefore(MENU_GROUP_PRE, editActionableItemsAction);
- editActionableItemsAction.setEnabled(getSelectedActionArtifacts().size() == 1 || getSelectedTeamWorkflowArtifacts().size() == 1);
-
- mm.insertBefore(MENU_GROUP_PRE, convertActionableItemsAction);
- convertActionableItemsAction.updateEnablement();
-
- }
-
- @Override
- public void updateMenuActionsForTable() {
- MenuManager mm = getMenuManager();
-
- mm.insertBefore(XViewer.MENU_GROUP_PRE, new GroupMarker(MENU_GROUP_ATS_WORLD_EDIT));
- updateEditMenuActions();
-
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
-
- // OPEN MENU BLOCK
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
- mm.insertBefore(MENU_GROUP_PRE, openInAtsWorkflowEditorAction);
- openInAtsWorkflowEditorAction.updateEnablement();
-
- MenuManager openWithMenuManager = new MenuManager("Open With", "openwith");
-
- openWithMenuManager.add(openInMassEditorAction);
- openInMassEditorAction.updateEnablement();
-
- openWithMenuManager.add(openInAtsWorldEditorAction);
- openInAtsWorldEditorAction.setEnabled(getSelectedArtifacts() != null);
- openWithMenuManager.add(openInAtsTaskEditorAction);
- openInAtsTaskEditorAction.setEnabled(getSelectedTaskArtifacts() != null);
- if (AtsUtil.isAtsAdmin()) {
- openWithMenuManager.add(openInArtifactEditorAction);
- openInArtifactEditorAction.updateEnablement();
- }
- mm.insertBefore(MENU_GROUP_PRE, openWithMenuManager);
-
- if (AtsUtil.isAtsAdmin()) {
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
- mm.insertBefore(MENU_GROUP_PRE, deletePurgeAtsObjectAction);
- deletePurgeAtsObjectAction.updateEnablement();
- }
-
- mm.insertBefore(XViewer.MENU_GROUP_PRE, new GroupMarker(MENU_GROUP_ATS_WORLD_OPEN));
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
-
- // OTHER MENU BLOCK
- mm.insertBefore(MENU_GROUP_PRE, favoritesAction);
- favoritesAction.updateEnablement();
-
- mm.insertBefore(MENU_GROUP_PRE, subscribedAction);
- subscribedAction.updateEnablement();
-
- mm.insertBefore(MENU_GROUP_PRE, emailAction);
- emailAction.updateEnablement();
-
- mm.insertBefore(MENU_GROUP_PRE, resetActionArtifactAction);
- resetActionArtifactAction.setEnabled(getSelectedActionArtifacts().size() > 0);
-
- mm.insertAfter(XViewer.MENU_GROUP_PRE, new GroupMarker(MENU_GROUP_ATS_WORLD_OTHER));
- mm.insertAfter(MENU_GROUP_PRE, new Separator());
-
- }
-
- @Override
- public void handleDoubleClick() {
- if (getSelectedArtifactItems().isEmpty()) {
- return;
- }
- Artifact art = getSelectedArtifactItems().iterator().next();
- AtsUtil.openATSAction(art, AtsOpenOption.OpenOneOrPopupSelect);
- }
-
- public ArrayList<Artifact> getLoadedArtifacts() {
- ArrayList<Artifact> arts = new ArrayList<Artifact>();
- if (getRoot() != null) {
- for (Object artifact : (Collection<?>) getRoot()) {
- if (artifact instanceof Artifact) {
- arts.add((Artifact) artifact);
- }
- }
- }
- return arts;
- }
-
- public void clear(boolean forcePend) {
- ((WorldContentProvider) getContentProvider()).clear(forcePend);
- }
-
- /**
- * Release resources
- */
- @Override
- public void dispose() {
- // Dispose of the table objects is done through separate dispose listener off tree
- // Tell the label provider to release its resources
- getLabelProvider().dispose();
- super.dispose();
- }
-
- public ArrayList<Artifact> getSelectedArtifacts() {
- ArrayList<Artifact> arts = new ArrayList<Artifact>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) {
- for (TreeItem item : items) {
- arts.add((Artifact) item.getData());
- }
- }
- return arts;
- }
-
- public ArrayList<TaskArtifact> getSelectedTaskArtifacts() {
- ArrayList<TaskArtifact> arts = new ArrayList<TaskArtifact>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) {
- for (TreeItem item : items) {
- if (item.getData() instanceof TaskArtifact) {
- arts.add((TaskArtifact) item.getData());
- }
- }
- }
- return arts;
- }
-
- /**
- * @return true if all selected are Workflow OR are Actions with single workflow
- */
- public boolean isSelectedTeamWorkflowArtifacts() {
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) {
- for (TreeItem item : items) {
- if (item.getData() instanceof ActionArtifact) {
- try {
- if (((ActionArtifact) item.getData()).getTeamWorkFlowArtifacts().size() != 1) {
- return false;
- }
- } catch (OseeCoreException ex) {
- // Do Nothing
- }
- } else if (!(item.getData() instanceof TeamWorkFlowArtifact)) {
- return false;
- }
- }
- }
- return true;
- }
-
- /**
- * @return all selected Workflow and any workflow that have Actions with single workflow
- */
- public Set<TeamWorkFlowArtifact> getSelectedTeamWorkflowArtifacts() {
- Set<TeamWorkFlowArtifact> teamArts = new HashSet<TeamWorkFlowArtifact>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) {
- for (TreeItem item : items) {
- if (item.getData() instanceof TeamWorkFlowArtifact) {
- teamArts.add((TeamWorkFlowArtifact) item.getData());
- }
- if (item.getData() instanceof ActionArtifact) {
- try {
- if (((ActionArtifact) item.getData()).getTeamWorkFlowArtifacts().size() == 1) {
- teamArts.addAll(((ActionArtifact) item.getData()).getTeamWorkFlowArtifacts());
- }
- } catch (OseeCoreException ex) {
- // Do Nothing
- }
- }
- }
- }
- return teamArts;
- }
-
- /**
- * @return all selected Workflow and any workflow that have Actions with single workflow
- */
- public Set<StateMachineArtifact> getSelectedSMAArtifacts() {
- Set<StateMachineArtifact> smaArts = new HashSet<StateMachineArtifact>();
- try {
- Iterator<?> i = ((IStructuredSelection) getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof StateMachineArtifact) {
- smaArts.add((StateMachineArtifact) obj);
- } else if (obj instanceof ActionArtifact) {
- smaArts.addAll(((ActionArtifact) obj).getTeamWorkFlowArtifacts());
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- return smaArts;
- }
-
- public Set<ActionArtifact> getSelectedActionArtifacts() {
- Set<ActionArtifact> actionArts = new HashSet<ActionArtifact>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) {
- for (TreeItem item : items) {
- if (item.getData() instanceof ActionArtifact) {
- actionArts.add((ActionArtifact) item.getData());
- }
- }
- }
- return actionArts;
- }
-
- public void setCancelledNotification() {
- TreeItem item = getTree().getItem(0);
- if (item.getData() instanceof String) {
- item.setData(DefaultTeamState.Cancelled.name());
- }
- refresh(item.getData());
- }
-
- /**
- * @param title string to be used in reporting
- */
- public void setReportingTitle(String title) {
- this.title = title;
- }
-
- /**
- * @return Returns the title.
- */
- public String getTitle() {
- return title;
- }
-
- @Override
- public void load(Collection<Object> objects) {
- Set<Artifact> arts = new HashSet<Artifact>();
- for (Object obj : objects) {
- if (obj instanceof IWorldViewArtifact) {
- arts.add((Artifact) obj);
- }
- }
-
- setInput(arts);
- }
-
- public ArrayList<Artifact> getSelectedArtifactItems() {
- ArrayList<Artifact> arts = new ArrayList<Artifact>();
- TreeItem items[] = getTree().getSelection();
- if (items.length > 0) {
- for (TreeItem item : items) {
- arts.add((Artifact) item.getData());
- }
- }
- return arts;
- }
-
- @Override
- public String getStatusString() {
- return extendedStatusString;
- }
-
- @Override
- public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
- return handleAltLeftClick(treeColumn, treeItem, true);
- }
-
- @Override
- public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
- try {
- Artifact useArt = (Artifact) treeItem.getData();
- boolean modified = false;
- if (useArt instanceof ActionArtifact) {
- if (((ActionArtifact) useArt).getTeamWorkFlowArtifacts().size() == 1) {
- useArt = ((ActionArtifact) useArt).getTeamWorkFlowArtifacts().iterator().next();
- } else {
- return false;
- }
- }
- if (modified) {
- update(useArt, null);
- return true;
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem, boolean persist) {
- try {
- super.handleAltLeftClick(treeColumn, treeItem);
- if (!(treeColumn.getData() instanceof XViewerColumn)) {
- return false;
- }
- Artifact useArt = (Artifact) treeItem.getData();
- XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
- if (useArt instanceof IATSArtifact) {
- boolean modified = false;
- if (xCol.equals(WorldXViewerFactory.Goal_Order)) {
- handleAltLeftClickGoalOrder(treeItem, (IATSArtifact) useArt);
- return false;
- } else if (xCol.equals(WorldXViewerFactory.Goal_Order_Vote_Col)) {
- modified =
- PromptChangeUtil.promptChangeAttribute((Artifact) useArt, ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE,
- persist, true);
- } else if (xCol.equals(WorldXViewerFactory.Goals_Col)) {
- modified = PromptChangeUtil.promptChangeGoals((Artifact) useArt, persist);
- }
- if (modified) {
- update(useArt, null);
- return true;
- }
- }
- if (useArt instanceof ActionArtifact) {
- if (((ActionArtifact) useArt).getTeamWorkFlowArtifacts().size() == 1) {
- useArt = ((ActionArtifact) useArt).getTeamWorkFlowArtifacts().iterator().next();
- } else {
- return false;
- }
- }
- StateMachineArtifact sma = (StateMachineArtifact) useArt;
- boolean modified = false;
- if (xCol.equals(WorldXViewerFactory.Version_Target_Col)) {
- modified =
- PromptChangeUtil.promptChangeVersion(sma,
- AtsUtil.isAtsAdmin() ? VersionReleaseType.Both : VersionReleaseType.UnReleased, true);
- } else if (xCol.equals(WorldXViewerFactory.Notes_Col)) {
- modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.SMA_NOTE_ATTRIBUTE, persist, true);
- } else if (xCol.equals(WorldXViewerFactory.Percent_Rework_Col)) {
- modified =
- PromptChangeUtil.promptChangePercentAttribute(sma, ATSAttributes.PERCENT_REWORK_ATTRIBUTE, persist);
- } else if (xCol.equals(WorldXViewerFactory.Estimated_Hours_Col)) {
- modified =
- PromptChangeUtil.promptChangeFloatAttribute(sma, ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE, persist);
- } else if (xCol.equals(WorldXViewerFactory.Weekly_Benefit_Hrs_Col)) {
- modified =
- PromptChangeUtil.promptChangeFloatAttribute(sma, ATSAttributes.WEEKLY_BENEFIT_ATTRIBUTE, persist);
- } else if (xCol.equals(WorldXViewerFactory.Estimated_Release_Date_Col)) {
- modified = PromptChangeUtil.promptChangeEstimatedReleaseDate(sma);
- } else if (xCol.equals(WorldXViewerFactory.Groups_Col)) {
- modified = PromptChangeUtil.promptChangeGroups(sma, persist);
- } else if (xCol.equals(WorldXViewerFactory.Estimated_Completion_Date_Col)) {
- modified =
- PromptChangeUtil.promptChangeDate(sma, ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE, persist);
- } else if (xCol.equals(WorldXViewerFactory.Deadline_Col)) {
- modified = PromptChangeUtil.promptChangeDate(sma, ATSAttributes.NEED_BY_ATTRIBUTE, persist);
- } else if (xCol.equals(WorldXViewerFactory.Assignees_Col)) {
- modified = PromptChangeUtil.promptChangeAssignees(sma, persist);
- } else if (xCol.equals(WorldXViewerFactory.Remaining_Hours_Col)) {
- AWorkbench.popup("Calculated Field",
- "Hours Remaining field is calculated.\nHour Estimate - (Hour Estimate * Percent Complete)");
- return false;
- } else if (xCol.equals(WorldXViewerFactory.Work_Days_Needed_Col)) {
- AWorkbench.popup(
- "Calculated Field",
- "Work Days Needed field is calculated.\nRemaining Hours / Hours per Week (" + sma.getManHrsPerDayPreference() + ")");
- return false;
- } else if (xCol.equals(WorldXViewerFactory.Release_Date_Col)) {
- modified = PromptChangeUtil.promptChangeReleaseDate(sma);
- } else if (xCol.equals(WorldXViewerFactory.Work_Package_Col)) {
- modified =
- PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.WORK_PACKAGE_ATTRIBUTE, persist, false);
- } else if (xCol.equals(WorldXViewerFactory.Points_Col)) {
- modified = PromptChangeUtil.promptChangePoints(sma, persist);
- } else if (xCol.equals(WorldXViewerFactory.Numeric1_Col)) {
- modified = PromptChangeUtil.promptChangeFloatAttribute(sma, ATSAttributes.NUMERIC1_ATTRIBUTE, persist);
- } else if (xCol.equals(WorldXViewerFactory.Numeric2_Col)) {
- modified = PromptChangeUtil.promptChangeFloatAttribute(sma, ATSAttributes.NUMERIC2_ATTRIBUTE, persist);
- } else if (xCol.equals(WorldXViewerFactory.Category_Col)) {
- modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.CATEGORY_ATTRIBUTE, persist, true);
- } else if (xCol.equals(WorldXViewerFactory.Resolution_Col)) {
- modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.RESOLUTION_ATTRIBUTE, persist, true);
- } else if (xCol.equals(WorldXViewerFactory.Category2_Col)) {
- modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.CATEGORY2_ATTRIBUTE, persist, true);
- } else if (xCol.equals(WorldXViewerFactory.Category3_Col)) {
- modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.CATEGORY3_ATTRIBUTE, persist, true);
- } else if (xCol.equals(WorldXViewerFactory.Change_Type_Col)) {
- modified = PromptChangeUtil.promptChangeType(sma, persist);
- } else if (xCol.equals(WorldXViewerFactory.Priority_Col)) {
- modified = PromptChangeUtil.promptChangePriority(sma, persist);
- }
- if (modified) {
- update(useArt, null);
- return true;
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
- private void handleAltLeftClickGoalOrder(TreeItem treeItem, IATSArtifact atsArt) throws OseeCoreException {
-
- GoalArtifact parentGoalArtifact = null;
- if (xViewerFactory instanceof GoalXViewerFactory) {
- parentGoalArtifact = ((GoalXViewerFactory) xViewerFactory).getSoleGoalArtifact();
- }
- if (parentGoalArtifact == null) {
- parentGoalArtifact = getParentGoalArtifact(treeItem);
- }
- GoalArtifact changedGoal = null;
- if (parentGoalArtifact != null) {
- changedGoal = GoalArtifact.promptChangeGoalOrder(parentGoalArtifact, (Artifact) treeItem.getData());
- } else {
- changedGoal = GoalArtifact.promptChangeGoalOrder((Artifact) treeItem.getData());
- }
- if (changedGoal != null) {
- refresh(changedGoal);
- update(atsArt, null);
- }
- }
-
- public String getExtendedStatusString() {
- return extendedStatusString;
- }
-
- public void setExtendedStatusString(String extendedStatusString) {
- this.extendedStatusString = extendedStatusString;
- updateStatusLabel();
- }
-
- @Override
- public void handleReloadEvent(Sender sender, final Collection<? extends Artifact> artifacts) throws OseeCoreException {
- if (!Widgets.isAccessible(getTree())) return;
- if (!artifacts.iterator().next().getBranch().equals(AtsUtil.getAtsBranch())) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- for (Artifact art : artifacts) {
- if (art instanceof IWorldViewArtifact) {
- refresh(art);
- // If parent is loaded and child changed, refresh parent
- try {
- if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- refresh(((StateMachineArtifact) art).getParentAtsArtifact());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- });
-
- }
-
- private GoalArtifact getParentGoalArtifact(TreeItem treeItem) {
- if (Widgets.isAccessible(treeItem) && Widgets.isAccessible(treeItem.getParentItem()) && treeItem.getParentItem().getData() instanceof GoalArtifact) {
- return (GoalArtifact) treeItem.getParentItem().getData();
- }
- return null;
- }
-
- /**
- * store off parent goalItem in label provider so it can determine parent when providing order of goal member
- */
- protected void doUpdateItem(Item item, Object element) {
- if (item instanceof TreeItem) {
- GoalArtifact parentGoalArtifact = getParentGoalArtifact((TreeItem) item);
- if (parentGoalArtifact != null) {
- ((WorldLabelProvider) getLabelProvider()).setParentGoal(parentGoalArtifact);
- }
- }
- super.doUpdateItem(item, element);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.AtsOpenOption;
+import org.eclipse.osee.ats.actions.ConvertActionableItemsAction;
+import org.eclipse.osee.ats.actions.DeletePurgeAtsArtifactsAction;
+import org.eclipse.osee.ats.actions.EmailActionAction;
+import org.eclipse.osee.ats.actions.FavoriteAction;
+import org.eclipse.osee.ats.actions.ISelectedAtsArtifacts;
+import org.eclipse.osee.ats.actions.OpenInArtifactEditorAction;
+import org.eclipse.osee.ats.actions.OpenInAtsWorkflowEditor;
+import org.eclipse.osee.ats.actions.OpenInMassEditorAction;
+import org.eclipse.osee.ats.actions.SubscribedAction;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.GoalArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.artifact.VersionArtifact.VersionReleaseType;
+import org.eclipse.osee.ats.editor.SMAPromptChangeStatus;
+import org.eclipse.osee.ats.goal.GoalXViewerFactory;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.task.TaskEditor;
+import org.eclipse.osee.ats.task.TaskEditorSimpleProvider;
+import org.eclipse.osee.ats.task.TaskXViewer;
+import org.eclipse.osee.ats.util.ArtifactEmailWizard;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.PromptChangeUtil;
+import org.eclipse.osee.ats.util.xviewer.column.XViewerAtsAttributeColumn;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
+import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
+import org.eclipse.osee.framework.skynet.core.event.IArtifactReloadEventListener;
+import org.eclipse.osee.framework.skynet.core.event.IArtifactsChangeTypeEventListener;
+import org.eclipse.osee.framework.skynet.core.event.IArtifactsPurgedEventListener;
+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.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactPromptChange;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerAttributeColumn;
+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.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * <REM2>
+ *
+ * @author Donald G. Dunne
+ */
+public class WorldXViewer extends XViewer implements ISelectedAtsArtifacts, IArtifactsPurgedEventListener, IArtifactReloadEventListener, IArtifactsChangeTypeEventListener, IFrameworkTransactionEventListener {
+ private String title;
+ private String extendedStatusString = "";
+ public static final String MENU_GROUP_ATS_WORLD_EDIT = "ATS WORLD EDIT";
+ public static final String MENU_GROUP_ATS_WORLD_OPEN = "ATS WORLD OPEN";
+ public static final String MENU_GROUP_ATS_WORLD_OTHER = "ATS WORLD OTHER";
+ public static final String ADD_AS_FAVORITE = "Add as Favorite";
+ public static final String REMOVE_FAVORITE = "Remove Favorite";
+ public static final String SUBSCRIBE = "Subscribe for Notifications";
+ public static final String UN_SUBSCRIBE = "Un-Subscribe for Notifications";
+ public final WorldXViewer thisXViewer = this;
+
+ public WorldXViewer(Composite parent, int style, IXViewerFactory xViewerFactory) {
+ super(parent, style, xViewerFactory);
+ }
+
+ @Override
+ public void handleArtifactsPurgedEvent(Sender sender, final LoadedArtifacts loadedArtifacts) {
+ if (thisXViewer.getTree().isDisposed()) {
+ OseeEventManager.removeListener(this);
+ return;
+ }
+ try {
+ if (loadedArtifacts.getLoadedArtifacts().isEmpty()) {
+ return;
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ IContentProvider contentProvider = getContentProvider();
+ if (contentProvider instanceof WorldContentProvider) {
+ remove(loadedArtifacts.getLoadedArtifacts().toArray());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+
+ }
+
+ @Override
+ public void handleArtifactsChangeTypeEvent(Sender sender, int toArtifactTypeId, final LoadedArtifacts loadedArtifacts) {
+ if (thisXViewer.getTree().isDisposed()) {
+ OseeEventManager.removeListener(this);
+ return;
+ }
+ try {
+ if (loadedArtifacts.getLoadedArtifacts().isEmpty()) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ remove(loadedArtifacts.getLoadedArtifacts().toArray(
+ new Object[loadedArtifacts.getLoadedArtifacts().size()]));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
+ if (thisXViewer.getTree().isDisposed()) {
+ OseeEventManager.removeListener(this);
+ return;
+ }
+ if (transData.branchId != AtsUtil.getAtsBranch().getId()) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (getContentProvider() == null) {
+ return;
+ }
+ if (transData.cacheDeletedArtifacts.size() > 0) {
+ remove(transData.cacheDeletedArtifacts.toArray(new Object[transData.cacheDeletedArtifacts.size()]));
+ }
+ if (transData.cacheChangedArtifacts.size() > 0) {
+ update(transData.cacheChangedArtifacts.toArray(new Object[transData.cacheChangedArtifacts.size()]), null);
+ for (Artifact art : transData.cacheChangedArtifacts) {
+ if (art instanceof IWorldViewArtifact) {
+ // If parent is loaded and child changed, refresh parent
+ try {
+ if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ update(((StateMachineArtifact) art).getParentAtsArtifact(), null);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ Set<Artifact> arts = new HashSet<Artifact>();
+ arts.addAll(transData.cacheRelationAddedArtifacts);
+ arts.addAll(transData.cacheRelationChangedArtifacts);
+ arts.addAll(transData.cacheRelationDeletedArtifacts);
+ for (Artifact art : arts) {
+ // Don't refresh deleted artifacts
+ if (art.isDeleted()) {
+ continue;
+ }
+ if (art instanceof IWorldViewArtifact) {
+ refresh(art);
+ // If parent is loaded and child changed, refresh parent
+ try {
+ if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ refresh(((StateMachineArtifact) art).getParentAtsArtifact());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void createSupportWidgets(Composite parent) {
+ final WorldXViewer fWorldXViewer = this;
+ super.createSupportWidgets(parent);
+ parent.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ OseeEventManager.removeListener(fWorldXViewer); // <REM2> Don't need this cause handled through IWorldViewerEventHandler
+ ((WorldContentProvider) getContentProvider()).clear(false);
+ }
+ });
+ createMenuActions();
+ OseeEventManager.addListener(this); // <REM2> Don't need this cause handled through IWorldViewerEventHandler
+ }
+
+ Action editStatusAction, editNotesAction, editResolutionAction, editEstimateAction, editChangeTypeAction,
+ editPriorityAction, editTargetVersionAction, editAssigneeAction, editActionableItemsAction;
+ ConvertActionableItemsAction convertActionableItemsAction;
+ Action openInAtsWorldEditorAction, openInAtsTaskEditorAction;
+ OpenInAtsWorkflowEditor openInAtsWorkflowEditorAction;
+ OpenInArtifactEditorAction openInArtifactEditorAction;
+ OpenInMassEditorAction openInMassEditorAction;
+ FavoriteAction favoritesAction;
+ SubscribedAction subscribedAction;
+ DeletePurgeAtsArtifactsAction deletePurgeAtsObjectAction;
+ EmailActionAction emailAction;
+ Action resetActionArtifactAction;
+
+ public void createMenuActions() {
+
+ convertActionableItemsAction = new ConvertActionableItemsAction(this);
+ openInMassEditorAction = new OpenInMassEditorAction(this);
+ openInAtsWorkflowEditorAction = new OpenInAtsWorkflowEditor("Open", this);
+ favoritesAction = new FavoriteAction(this);
+ subscribedAction = new SubscribedAction(this);
+ openInArtifactEditorAction = new OpenInArtifactEditorAction(this);
+ deletePurgeAtsObjectAction = new DeletePurgeAtsArtifactsAction(this);
+ emailAction = new EmailActionAction(this);
+
+ editNotesAction = new Action("Edit Notes", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ if (PromptChangeUtil.promptChangeAttribute(getSelectedSMAArtifacts(), ATSAttributes.SMA_NOTE_ATTRIBUTE,
+ true, true)) {
+ update(getSelectedSMAArtifacts().toArray(), null);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ editResolutionAction = new Action("Edit Resolution", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ if (PromptChangeUtil.promptChangeAttribute(getSelectedSMAArtifacts(),
+ ATSAttributes.RESOLUTION_ATTRIBUTE, true, true)) {
+ update(getSelectedSMAArtifacts().toArray(), null);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ editStatusAction = new Action("Edit Status", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ if (SMAPromptChangeStatus.promptChangeStatus(getSelectedSMAArtifacts(), true)) {
+ update(getSelectedSMAArtifacts().toArray(), null);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ editEstimateAction = new Action("Edit Estimated Hours", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ if (ArtifactPromptChange.promptChangeFloatAttribute(
+ ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName(),
+ ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getDisplayName(), getSelectedSMAArtifacts(), true)) {
+ update(getSelectedSMAArtifacts().toArray(), null);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ editChangeTypeAction = new Action("Edit Change Type", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ if (PromptChangeUtil.promptChangeType(getSelectedTeamWorkflowArtifacts(), true)) {
+ update(getSelectedArtifactItems().toArray(), null);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ editPriorityAction = new Action("Edit Priority", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ if (PromptChangeUtil.promptChangePriority(getSelectedTeamWorkflowArtifacts(), true)) {
+ update(getSelectedArtifactItems().toArray(), null);
+ }
+ }
+ };
+
+ editTargetVersionAction = new Action("Edit Targeted Version", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ if (PromptChangeUtil.promptChangeVersion(getSelectedTeamWorkflowArtifacts(),
+ (AtsUtil.isAtsAdmin() ? VersionReleaseType.Both : VersionReleaseType.UnReleased), true)) {
+ update(getSelectedArtifactItems().toArray(), null);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ editAssigneeAction = new Action("Edit Assignee", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ Set<StateMachineArtifact> artifacts = getSelectedSMAArtifacts();
+ if (PromptChangeUtil.promptChangeAssignees(artifacts, false)) {
+ Artifacts.persistInTransaction(artifacts);
+ update(getSelectedArtifactItems().toArray(), null);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ editActionableItemsAction = new Action("Edit Actionable Item(s)", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ if (getSelectedActionArtifacts().size() == 1) {
+ ActionArtifact actionArt = getSelectedActionArtifacts().iterator().next();
+ AtsUtil.editActionableItems(actionArt);
+ refresh(getSelectedArtifactItems().iterator().next());
+ } else {
+ TeamWorkFlowArtifact teamArt = getSelectedTeamWorkflowArtifacts().iterator().next();
+ AtsUtil.editActionableItems(teamArt);
+ refresh(getSelectedArtifactItems().toArray()[0]);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
+ openInAtsWorldEditorAction = new Action("Open in ATS World Editor", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ if (getSelectedArtifacts().isEmpty()) {
+ AWorkbench.popup("Error", "No items selected");
+ return;
+ }
+ WorldEditorInput worldEditorInput = null;
+ if (thisXViewer instanceof TaskXViewer) {
+ worldEditorInput =
+ new WorldEditorInput(new WorldEditorSimpleProvider("ATS World", getSelectedArtifacts(), null,
+ TableLoadOption.None));
+ } else {
+ worldEditorInput =
+ new WorldEditorInput(new WorldEditorSimpleProvider("ATS World", getSelectedArtifacts(),
+ getCustomizeMgr().generateCustDataFromTable(), TableLoadOption.None));
+ }
+ if (worldEditorInput != null) {
+ IWorkbenchPage page = AWorkbench.getActivePage();
+ try {
+ page.openEditor(worldEditorInput, WorldEditor.EDITOR_ID);
+ } catch (PartInitException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(AtsImage.GLOBE);
+ }
+
+ };
+
+ openInAtsTaskEditorAction = new Action("Open in ATS Task Editor", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ if (getSelectedTaskArtifacts().isEmpty()) {
+ AWorkbench.popup("Error", "No Tasks selected");
+ return;
+ }
+ try {
+ TaskEditor.open(new TaskEditorSimpleProvider("ATS Tasks", getSelectedTaskArtifacts()));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(AtsImage.TASK);
+ }
+
+ };
+
+ resetActionArtifactAction = new Action("Reset Action off Children", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ SkynetTransaction transaction;
+ try {
+ transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Reset Action off Children");
+ for (ActionArtifact actionArt : getSelectedActionArtifacts()) {
+ actionArt.resetAttributesOffChildren(transaction);
+ }
+ transaction.execute();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+
+ }
+ };
+ }
+
+ @Override
+ public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
+ handleColumnMultiEdit(treeColumn, treeItems, true);
+ }
+
+ public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems, final boolean persist) {
+ if (treeColumn.getData().equals(WorldXViewerFactory.Groups_Col)) {
+ try {
+ Set<StateMachineArtifact> smas = new HashSet<StateMachineArtifact>();
+ for (TreeItem item : treeItems) {
+ Artifact art = (Artifact) item.getData();
+ if (art instanceof TeamWorkFlowArtifact) {
+ smas.add((StateMachineArtifact) art);
+ }
+ }
+ PromptChangeUtil.promptChangeGroups(smas, true);
+ return;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } else if (treeColumn.getData().equals(WorldXViewerFactory.Goals_Col)) {
+ try {
+ Set<StateMachineArtifact> smas = new HashSet<StateMachineArtifact>();
+ for (TreeItem item : treeItems) {
+ Artifact art = (Artifact) item.getData();
+ if (art instanceof StateMachineArtifact) {
+ smas.add((StateMachineArtifact) art);
+ }
+ }
+ PromptChangeUtil.promptChangeGoals(smas, true);
+ return;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } else if (treeColumn.getData().equals(WorldXViewerFactory.Points_Col)) {
+ try {
+ Set<TeamWorkFlowArtifact> smas = new HashSet<TeamWorkFlowArtifact>();
+ for (TreeItem item : treeItems) {
+ Artifact art = (Artifact) item.getData();
+ if (art instanceof TeamWorkFlowArtifact) {
+ smas.add((TeamWorkFlowArtifact) art);
+ }
+ }
+ PromptChangeUtil.promptChangePoints(smas, true);
+ return;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ if (!(treeColumn.getData() instanceof XViewerAttributeColumn) && !(treeColumn.getData() instanceof XViewerAtsAttributeColumn)) {
+ AWorkbench.popup("ERROR", "Column is not attribute and thus not multi-editable " + treeColumn.getText());
+ return;
+ }
+
+ XResultData rData = new XResultData();
+ String attrName = null;
+ if (treeColumn.getData() instanceof XViewerAttributeColumn) {
+ final XViewerAttributeColumn xCol = (XViewerAttributeColumn) treeColumn.getData();
+ attrName = xCol.getAttributeTypeName();
+ }
+ if (treeColumn.getData() instanceof XViewerAtsAttributeColumn) {
+ final XViewerAtsAttributeColumn xCol = (XViewerAtsAttributeColumn) treeColumn.getData();
+ attrName = xCol.getAttributeTypeName();
+ }
+ if (attrName == null) {
+ AWorkbench.popup("ERROR", "Can't retrieve attribute name from attribute column " + treeColumn.getText());
+ return;
+ }
+ final Set<Artifact> useArts = new HashSet<Artifact>();
+ for (TreeItem item : treeItems) {
+ Artifact art = (Artifact) item.getData();
+ try {
+ if (art.isAttributeTypeValid(attrName)) {
+ useArts.add(art);
+ } else {
+ rData.logError(attrName + " not valid for artifact " + art.getGuid() + " - " + art.getName());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ rData.logError(ex.getLocalizedMessage());
+ }
+ }
+
+ try {
+ if (!rData.isEmpty()) {
+ rData.report("Column Multi Edit Errors");
+ return;
+ }
+ if (useArts.size() > 0) {
+ ArtifactPromptChange.promptChangeAttribute(attrName, attrName, useArts, persist);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public boolean isColumnMultiEditable(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
+ if (treeColumn.getData().equals(WorldXViewerFactory.Groups_Col)) {
+ return true;
+ }
+ if (!(treeColumn.getData() instanceof XViewerColumn)) {
+ return false;
+ }
+ if (!((XViewerColumn) treeColumn.getData()).isMultiColumnEditable()) {
+ return false;
+ }
+ String attrName = null;
+ // Currently don't know how to multi-edit anything but attribute
+ if (treeColumn.getData() instanceof XViewerAttributeColumn) {
+ XViewerAttributeColumn xCol = (XViewerAttributeColumn) treeColumn.getData();
+ attrName = xCol.getAttributeTypeName();
+ } else if (treeColumn.getData() instanceof XViewerAtsAttributeColumn) {
+ XViewerAtsAttributeColumn xCol = (XViewerAtsAttributeColumn) treeColumn.getData();
+ attrName = xCol.getAttributeTypeName();
+ } else {
+ return false;
+ }
+
+ if (attrName == null) {
+ AWorkbench.popup("ERROR", "Can't retrieve attribute name from attribute column " + treeColumn.getText());
+ return false;
+ }
+ for (TreeItem item : treeItems) {
+ if (item.getData() instanceof ActionArtifact) {
+ return false;
+ }
+ try {
+ if (!((Artifact) item.getData()).isAttributeTypeValid(attrName)) {
+ return false;
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isColumnMultiEditEnabled() {
+ return true;
+ }
+
+ public void handleEmailSelectedAtsObject() throws OseeCoreException {
+ Artifact art = getSelectedArtifacts().iterator().next();
+ if (art instanceof ActionArtifact) {
+ if (((ActionArtifact) art).getTeamWorkFlowArtifacts().size() > 1) {
+ art = AtsUtil.promptSelectTeamWorkflow((ActionArtifact) art);
+ if (art == null) {
+ return;
+ }
+ } else {
+ art = ((ActionArtifact) art).getTeamWorkFlowArtifacts().iterator().next();
+ }
+ }
+ if (art != null) {
+ ArtifactEmailWizard ew = new ArtifactEmailWizard((StateMachineArtifact) art);
+ WizardDialog dialog = new WizardDialog(Displays.getActiveShell(), ew);
+ dialog.create();
+ dialog.open();
+ }
+ }
+
+ public StateMachineArtifact getSelectedSMA() {
+ Object obj = null;
+ if (getSelectedArtifactItems().isEmpty()) {
+ return null;
+ }
+ obj = getTree().getSelection()[0].getData();
+ return obj != null && obj instanceof StateMachineArtifact ? (StateMachineArtifact) obj : null;
+ }
+
+ public void updateEditMenuActions() {
+ MenuManager mm = getMenuManager();
+
+ // EDIT MENU BLOCK
+ mm.insertBefore(MENU_GROUP_PRE, editChangeTypeAction);
+ editChangeTypeAction.setEnabled(getSelectedTeamWorkflowArtifacts().size() > 0);
+
+ mm.insertBefore(MENU_GROUP_PRE, editPriorityAction);
+ editPriorityAction.setEnabled(getSelectedTeamWorkflowArtifacts().size() > 0);
+
+ mm.insertBefore(MENU_GROUP_PRE, editTargetVersionAction);
+ editTargetVersionAction.setEnabled(getSelectedTeamWorkflowArtifacts().size() > 0);
+
+ mm.insertBefore(MENU_GROUP_PRE, editAssigneeAction);
+ editAssigneeAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
+
+ mm.insertBefore(MENU_GROUP_PRE, editStatusAction);
+ editStatusAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
+
+ mm.insertBefore(MENU_GROUP_PRE, editEstimateAction);
+ editEstimateAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
+
+ mm.insertBefore(MENU_GROUP_PRE, editResolutionAction);
+ editResolutionAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
+
+ mm.insertBefore(MENU_GROUP_PRE, editNotesAction);
+ editNotesAction.setEnabled(getSelectedSMAArtifacts().size() > 0);
+
+ mm.insertBefore(MENU_GROUP_PRE, editActionableItemsAction);
+ editActionableItemsAction.setEnabled(getSelectedActionArtifacts().size() == 1 || getSelectedTeamWorkflowArtifacts().size() == 1);
+
+ mm.insertBefore(MENU_GROUP_PRE, convertActionableItemsAction);
+ convertActionableItemsAction.updateEnablement();
+
+ }
+
+ @Override
+ public void updateMenuActionsForTable() {
+ MenuManager mm = getMenuManager();
+
+ mm.insertBefore(XViewer.MENU_GROUP_PRE, new GroupMarker(MENU_GROUP_ATS_WORLD_EDIT));
+ updateEditMenuActions();
+
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+
+ // OPEN MENU BLOCK
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+ mm.insertBefore(MENU_GROUP_PRE, openInAtsWorkflowEditorAction);
+ openInAtsWorkflowEditorAction.updateEnablement();
+
+ MenuManager openWithMenuManager = new MenuManager("Open With", "openwith");
+
+ openWithMenuManager.add(openInMassEditorAction);
+ openInMassEditorAction.updateEnablement();
+
+ openWithMenuManager.add(openInAtsWorldEditorAction);
+ openInAtsWorldEditorAction.setEnabled(getSelectedArtifacts() != null);
+ openWithMenuManager.add(openInAtsTaskEditorAction);
+ openInAtsTaskEditorAction.setEnabled(getSelectedTaskArtifacts() != null);
+ if (AtsUtil.isAtsAdmin()) {
+ openWithMenuManager.add(openInArtifactEditorAction);
+ openInArtifactEditorAction.updateEnablement();
+ }
+ mm.insertBefore(MENU_GROUP_PRE, openWithMenuManager);
+
+ if (AtsUtil.isAtsAdmin()) {
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+ mm.insertBefore(MENU_GROUP_PRE, deletePurgeAtsObjectAction);
+ deletePurgeAtsObjectAction.updateEnablement();
+ }
+
+ mm.insertBefore(XViewer.MENU_GROUP_PRE, new GroupMarker(MENU_GROUP_ATS_WORLD_OPEN));
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+
+ // OTHER MENU BLOCK
+ mm.insertBefore(MENU_GROUP_PRE, favoritesAction);
+ favoritesAction.updateEnablement();
+
+ mm.insertBefore(MENU_GROUP_PRE, subscribedAction);
+ subscribedAction.updateEnablement();
+
+ mm.insertBefore(MENU_GROUP_PRE, emailAction);
+ emailAction.updateEnablement();
+
+ mm.insertBefore(MENU_GROUP_PRE, resetActionArtifactAction);
+ resetActionArtifactAction.setEnabled(getSelectedActionArtifacts().size() > 0);
+
+ mm.insertAfter(XViewer.MENU_GROUP_PRE, new GroupMarker(MENU_GROUP_ATS_WORLD_OTHER));
+ mm.insertAfter(MENU_GROUP_PRE, new Separator());
+
+ }
+
+ @Override
+ public void handleDoubleClick() {
+ if (getSelectedArtifactItems().isEmpty()) {
+ return;
+ }
+ Artifact art = getSelectedArtifactItems().iterator().next();
+ AtsUtil.openATSAction(art, AtsOpenOption.OpenOneOrPopupSelect);
+ }
+
+ public ArrayList<Artifact> getLoadedArtifacts() {
+ ArrayList<Artifact> arts = new ArrayList<Artifact>();
+ if (getRoot() != null) {
+ for (Object artifact : (Collection<?>) getRoot()) {
+ if (artifact instanceof Artifact) {
+ arts.add((Artifact) artifact);
+ }
+ }
+ }
+ return arts;
+ }
+
+ public void clear(boolean forcePend) {
+ ((WorldContentProvider) getContentProvider()).clear(forcePend);
+ }
+
+ /**
+ * Release resources
+ */
+ @Override
+ public void dispose() {
+ // Dispose of the table objects is done through separate dispose listener off tree
+ // Tell the label provider to release its resources
+ getLabelProvider().dispose();
+ super.dispose();
+ }
+
+ public ArrayList<Artifact> getSelectedArtifacts() {
+ ArrayList<Artifact> arts = new ArrayList<Artifact>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ arts.add((Artifact) item.getData());
+ }
+ }
+ return arts;
+ }
+
+ public ArrayList<TaskArtifact> getSelectedTaskArtifacts() {
+ ArrayList<TaskArtifact> arts = new ArrayList<TaskArtifact>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ if (item.getData() instanceof TaskArtifact) {
+ arts.add((TaskArtifact) item.getData());
+ }
+ }
+ }
+ return arts;
+ }
+
+ /**
+ * @return true if all selected are Workflow OR are Actions with single workflow
+ */
+ public boolean isSelectedTeamWorkflowArtifacts() {
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ if (item.getData() instanceof ActionArtifact) {
+ try {
+ if (((ActionArtifact) item.getData()).getTeamWorkFlowArtifacts().size() != 1) {
+ return false;
+ }
+ } catch (OseeCoreException ex) {
+ // Do Nothing
+ }
+ } else if (!(item.getData() instanceof TeamWorkFlowArtifact)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @return all selected Workflow and any workflow that have Actions with single workflow
+ */
+ public Set<TeamWorkFlowArtifact> getSelectedTeamWorkflowArtifacts() {
+ Set<TeamWorkFlowArtifact> teamArts = new HashSet<TeamWorkFlowArtifact>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ if (item.getData() instanceof TeamWorkFlowArtifact) {
+ teamArts.add((TeamWorkFlowArtifact) item.getData());
+ }
+ if (item.getData() instanceof ActionArtifact) {
+ try {
+ if (((ActionArtifact) item.getData()).getTeamWorkFlowArtifacts().size() == 1) {
+ teamArts.addAll(((ActionArtifact) item.getData()).getTeamWorkFlowArtifacts());
+ }
+ } catch (OseeCoreException ex) {
+ // Do Nothing
+ }
+ }
+ }
+ }
+ return teamArts;
+ }
+
+ /**
+ * @return all selected Workflow and any workflow that have Actions with single workflow
+ */
+ public Set<StateMachineArtifact> getSelectedSMAArtifacts() {
+ Set<StateMachineArtifact> smaArts = new HashSet<StateMachineArtifact>();
+ try {
+ Iterator<?> i = ((IStructuredSelection) getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof StateMachineArtifact) {
+ smaArts.add((StateMachineArtifact) obj);
+ } else if (obj instanceof ActionArtifact) {
+ smaArts.addAll(((ActionArtifact) obj).getTeamWorkFlowArtifacts());
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ return smaArts;
+ }
+
+ public Set<ActionArtifact> getSelectedActionArtifacts() {
+ Set<ActionArtifact> actionArts = new HashSet<ActionArtifact>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ if (item.getData() instanceof ActionArtifact) {
+ actionArts.add((ActionArtifact) item.getData());
+ }
+ }
+ }
+ return actionArts;
+ }
+
+ public void setCancelledNotification() {
+ TreeItem item = getTree().getItem(0);
+ if (item.getData() instanceof String) {
+ item.setData(DefaultTeamState.Cancelled.name());
+ }
+ refresh(item.getData());
+ }
+
+ /**
+ * @param title string to be used in reporting
+ */
+ public void setReportingTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ @Override
+ public void load(Collection<Object> objects) {
+ Set<Artifact> arts = new HashSet<Artifact>();
+ for (Object obj : objects) {
+ if (obj instanceof IWorldViewArtifact) {
+ arts.add((Artifact) obj);
+ }
+ }
+
+ setInput(arts);
+ }
+
+ public ArrayList<Artifact> getSelectedArtifactItems() {
+ ArrayList<Artifact> arts = new ArrayList<Artifact>();
+ TreeItem items[] = getTree().getSelection();
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ arts.add((Artifact) item.getData());
+ }
+ }
+ return arts;
+ }
+
+ @Override
+ public String getStatusString() {
+ return extendedStatusString;
+ }
+
+ @Override
+ public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
+ return handleAltLeftClick(treeColumn, treeItem, true);
+ }
+
+ @Override
+ public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
+ try {
+ Artifact useArt = (Artifact) treeItem.getData();
+ boolean modified = false;
+ if (useArt instanceof ActionArtifact) {
+ if (((ActionArtifact) useArt).getTeamWorkFlowArtifacts().size() == 1) {
+ useArt = ((ActionArtifact) useArt).getTeamWorkFlowArtifacts().iterator().next();
+ } else {
+ return false;
+ }
+ }
+ if (modified) {
+ update(useArt, null);
+ return true;
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem, boolean persist) {
+ try {
+ super.handleAltLeftClick(treeColumn, treeItem);
+ if (!(treeColumn.getData() instanceof XViewerColumn)) {
+ return false;
+ }
+ Artifact useArt = (Artifact) treeItem.getData();
+ XViewerColumn xCol = (XViewerColumn) treeColumn.getData();
+ if (useArt instanceof IATSArtifact) {
+ boolean modified = false;
+ if (xCol.equals(WorldXViewerFactory.Goal_Order)) {
+ handleAltLeftClickGoalOrder(treeItem, (IATSArtifact) useArt);
+ return false;
+ } else if (xCol.equals(WorldXViewerFactory.Goal_Order_Vote_Col)) {
+ modified =
+ PromptChangeUtil.promptChangeAttribute((Artifact) useArt, ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE,
+ persist, true);
+ } else if (xCol.equals(WorldXViewerFactory.Goals_Col)) {
+ modified = PromptChangeUtil.promptChangeGoals((Artifact) useArt, persist);
+ }
+ if (modified) {
+ update(useArt, null);
+ return true;
+ }
+ }
+ if (useArt instanceof ActionArtifact) {
+ if (((ActionArtifact) useArt).getTeamWorkFlowArtifacts().size() == 1) {
+ useArt = ((ActionArtifact) useArt).getTeamWorkFlowArtifacts().iterator().next();
+ } else {
+ return false;
+ }
+ }
+ StateMachineArtifact sma = (StateMachineArtifact) useArt;
+ boolean modified = false;
+ if (xCol.equals(WorldXViewerFactory.Version_Target_Col)) {
+ modified =
+ PromptChangeUtil.promptChangeVersion(sma,
+ AtsUtil.isAtsAdmin() ? VersionReleaseType.Both : VersionReleaseType.UnReleased, true);
+ } else if (xCol.equals(WorldXViewerFactory.Notes_Col)) {
+ modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.SMA_NOTE_ATTRIBUTE, persist, true);
+ } else if (xCol.equals(WorldXViewerFactory.Percent_Rework_Col)) {
+ modified =
+ PromptChangeUtil.promptChangePercentAttribute(sma, ATSAttributes.PERCENT_REWORK_ATTRIBUTE, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Estimated_Hours_Col)) {
+ modified =
+ PromptChangeUtil.promptChangeFloatAttribute(sma, ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Weekly_Benefit_Hrs_Col)) {
+ modified =
+ PromptChangeUtil.promptChangeFloatAttribute(sma, ATSAttributes.WEEKLY_BENEFIT_ATTRIBUTE, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Estimated_Release_Date_Col)) {
+ modified = PromptChangeUtil.promptChangeEstimatedReleaseDate(sma);
+ } else if (xCol.equals(WorldXViewerFactory.Groups_Col)) {
+ modified = PromptChangeUtil.promptChangeGroups(sma, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Estimated_Completion_Date_Col)) {
+ modified =
+ PromptChangeUtil.promptChangeDate(sma, ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Deadline_Col)) {
+ modified = PromptChangeUtil.promptChangeDate(sma, ATSAttributes.NEED_BY_ATTRIBUTE, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Assignees_Col)) {
+ modified = PromptChangeUtil.promptChangeAssignees(sma, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Remaining_Hours_Col)) {
+ AWorkbench.popup("Calculated Field",
+ "Hours Remaining field is calculated.\nHour Estimate - (Hour Estimate * Percent Complete)");
+ return false;
+ } else if (xCol.equals(WorldXViewerFactory.Work_Days_Needed_Col)) {
+ AWorkbench.popup(
+ "Calculated Field",
+ "Work Days Needed field is calculated.\nRemaining Hours / Hours per Week (" + sma.getManHrsPerDayPreference() + ")");
+ return false;
+ } else if (xCol.equals(WorldXViewerFactory.Release_Date_Col)) {
+ modified = PromptChangeUtil.promptChangeReleaseDate(sma);
+ } else if (xCol.equals(WorldXViewerFactory.Work_Package_Col)) {
+ modified =
+ PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.WORK_PACKAGE_ATTRIBUTE, persist, false);
+ } else if (xCol.equals(WorldXViewerFactory.Points_Col)) {
+ modified = PromptChangeUtil.promptChangePoints(sma, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Numeric1_Col)) {
+ modified = PromptChangeUtil.promptChangeFloatAttribute(sma, ATSAttributes.NUMERIC1_ATTRIBUTE, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Numeric2_Col)) {
+ modified = PromptChangeUtil.promptChangeFloatAttribute(sma, ATSAttributes.NUMERIC2_ATTRIBUTE, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Category_Col)) {
+ modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.CATEGORY_ATTRIBUTE, persist, true);
+ } else if (xCol.equals(WorldXViewerFactory.Resolution_Col)) {
+ modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.RESOLUTION_ATTRIBUTE, persist, true);
+ } else if (xCol.equals(WorldXViewerFactory.Category2_Col)) {
+ modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.CATEGORY2_ATTRIBUTE, persist, true);
+ } else if (xCol.equals(WorldXViewerFactory.Category3_Col)) {
+ modified = PromptChangeUtil.promptChangeAttribute(sma, ATSAttributes.CATEGORY3_ATTRIBUTE, persist, true);
+ } else if (xCol.equals(WorldXViewerFactory.Change_Type_Col)) {
+ modified = PromptChangeUtil.promptChangeType(sma, persist);
+ } else if (xCol.equals(WorldXViewerFactory.Priority_Col)) {
+ modified = PromptChangeUtil.promptChangePriority(sma, persist);
+ }
+ if (modified) {
+ update(useArt, null);
+ return true;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+ private void handleAltLeftClickGoalOrder(TreeItem treeItem, IATSArtifact atsArt) throws OseeCoreException {
+
+ GoalArtifact parentGoalArtifact = null;
+ if (xViewerFactory instanceof GoalXViewerFactory) {
+ parentGoalArtifact = ((GoalXViewerFactory) xViewerFactory).getSoleGoalArtifact();
+ }
+ if (parentGoalArtifact == null) {
+ parentGoalArtifact = getParentGoalArtifact(treeItem);
+ }
+ GoalArtifact changedGoal = null;
+ if (parentGoalArtifact != null) {
+ changedGoal = GoalArtifact.promptChangeGoalOrder(parentGoalArtifact, (Artifact) treeItem.getData());
+ } else {
+ changedGoal = GoalArtifact.promptChangeGoalOrder((Artifact) treeItem.getData());
+ }
+ if (changedGoal != null) {
+ refresh(changedGoal);
+ update(atsArt, null);
+ }
+ }
+
+ public String getExtendedStatusString() {
+ return extendedStatusString;
+ }
+
+ public void setExtendedStatusString(String extendedStatusString) {
+ this.extendedStatusString = extendedStatusString;
+ updateStatusLabel();
+ }
+
+ @Override
+ public void handleReloadEvent(Sender sender, final Collection<? extends Artifact> artifacts) throws OseeCoreException {
+ if (!Widgets.isAccessible(getTree())) return;
+ if (!artifacts.iterator().next().getBranch().equals(AtsUtil.getAtsBranch())) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ for (Artifact art : artifacts) {
+ if (art instanceof IWorldViewArtifact) {
+ refresh(art);
+ // If parent is loaded and child changed, refresh parent
+ try {
+ if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ refresh(((StateMachineArtifact) art).getParentAtsArtifact());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ });
+
+ }
+
+ private GoalArtifact getParentGoalArtifact(TreeItem treeItem) {
+ if (Widgets.isAccessible(treeItem) && Widgets.isAccessible(treeItem.getParentItem()) && treeItem.getParentItem().getData() instanceof GoalArtifact) {
+ return (GoalArtifact) treeItem.getParentItem().getData();
+ }
+ return null;
+ }
+
+ /**
+ * store off parent goalItem in label provider so it can determine parent when providing order of goal member
+ */
+ protected void doUpdateItem(Item item, Object element) {
+ if (item instanceof TreeItem) {
+ GoalArtifact parentGoalArtifact = getParentGoalArtifact((TreeItem) item);
+ if (parentGoalArtifact != null) {
+ ((WorldLabelProvider) getLabelProvider()).setParentGoal(parentGoalArtifact);
+ }
+ }
+ super.doUpdateItem(item, element);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerEventManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerEventManager.java
index c52ae8fa754..d048e9d9eae 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerEventManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerEventManager.java
@@ -1,141 +1,141 @@
-/*
- * Created on Jun 30, 2010
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.ats.world;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-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.EventBasicGuidArtifact;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType;
-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.swt.Displays;
-
-/**
- * Common location for event handling for task and world composites in order to keep number of registrations and
- * processing to a minimum.
- *
- * @author Donald G. Dunne
- */
-public class WorldXViewerEventManager implements IArtifactEventListener {
-
- List<IWorldViewerEventHandler> handlers = new ArrayList<IWorldViewerEventHandler>();
- static WorldXViewerEventManager instance;
-
- public static void add(IWorldViewerEventHandler iWorldEventHandler) {
- if (instance == null) {
- instance = new WorldXViewerEventManager();
- OseeEventManager.addListener(instance);
- }
- instance.handlers.add(iWorldEventHandler);
- }
-
- public static void remove(IWorldViewerEventHandler iWorldEventHandler) {
- if (instance != null) {
- instance.handlers.remove(iWorldEventHandler);
- }
- }
-
- @Override
- public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
- for (IWorldViewerEventHandler handler : new CopyOnWriteArrayList<IWorldViewerEventHandler>(handlers)) {
- if (handler.isDisposed()) {
- handlers.remove(handler);
- }
- }
- try {
- if (artifactEvent.getBranchGuid() == null || !artifactEvent.getBranchGuid().equals(
- AtsUtil.getAtsBranch().getGuid())) {
- return;
- }
- } catch (OseeCoreException ex) {
- return;
- }
- final Collection<Artifact> modifiedArts =
- artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
- final Collection<Artifact> relModifiedArts = artifactEvent.getRelCacheArtifacts();
- final Collection<EventBasicGuidArtifact> deletedPurgedArts =
- artifactEvent.get(EventModType.Deleted, EventModType.Purged);
-
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!deletedPurgedArts.isEmpty()) {
- for (IWorldViewerEventHandler handler : handlers) {
- if (!handler.isDisposed()) {
- // allow handler to remove from model
- handler.removeItems(deletedPurgedArts);
- IContentProvider contentProvider = handler.getWorldXViewer().getContentProvider();
- // remove from UI
- if (contentProvider instanceof WorldContentProvider) {
- handler.getWorldXViewer().remove(
- deletedPurgedArts.toArray(new Object[deletedPurgedArts.size()]));
- }
- }
- }
- }
- for (IWorldViewerEventHandler handler : handlers) {
- if (!handler.isDisposed()) {
- for (Artifact artifact : modifiedArts) {
- try {
- // Don't refresh deleted artifacts
- if (artifact.isDeleted()) {
- continue;
- }
- if (artifact instanceof IWorldViewArtifact) {
- handler.getWorldXViewer().refresh(artifact);
- // If parent is loaded and child changed, refresh parent
- if (artifact instanceof StateMachineArtifact && ((StateMachineArtifact) artifact).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- handler.getWorldXViewer().refresh(
- ((StateMachineArtifact) artifact).getParentAtsArtifact());
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- for (Artifact art : relModifiedArts) {
- // Don't refresh deleted artifacts
- if (art.isDeleted()) {
- continue;
- }
- if (art instanceof IWorldViewArtifact) {
- handler.getWorldXViewer().refresh(art);
- // If parent is loaded and child changed, refresh parent
- try {
- if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- handler.getWorldXViewer().refresh(((StateMachineArtifact) art).getParentAtsArtifact());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- }
- }
- });
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return AtsUtil.getAtsObjectEventFilters();
- }
-
-}
+/*
+ * Created on Jun 30, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.ats.world;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+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.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType;
+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.swt.Displays;
+
+/**
+ * Common location for event handling for task and world composites in order to keep number of registrations and
+ * processing to a minimum.
+ *
+ * @author Donald G. Dunne
+ */
+public class WorldXViewerEventManager implements IArtifactEventListener {
+
+ List<IWorldViewerEventHandler> handlers = new ArrayList<IWorldViewerEventHandler>();
+ static WorldXViewerEventManager instance;
+
+ public static void add(IWorldViewerEventHandler iWorldEventHandler) {
+ if (instance == null) {
+ instance = new WorldXViewerEventManager();
+ OseeEventManager.addListener(instance);
+ }
+ instance.handlers.add(iWorldEventHandler);
+ }
+
+ public static void remove(IWorldViewerEventHandler iWorldEventHandler) {
+ if (instance != null) {
+ instance.handlers.remove(iWorldEventHandler);
+ }
+ }
+
+ @Override
+ public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
+ for (IWorldViewerEventHandler handler : new CopyOnWriteArrayList<IWorldViewerEventHandler>(handlers)) {
+ if (handler.isDisposed()) {
+ handlers.remove(handler);
+ }
+ }
+ try {
+ if (artifactEvent.getBranchGuid() == null || !artifactEvent.getBranchGuid().equals(
+ AtsUtil.getAtsBranch().getGuid())) {
+ return;
+ }
+ } catch (OseeCoreException ex) {
+ return;
+ }
+ final Collection<Artifact> modifiedArts =
+ artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
+ final Collection<Artifact> relModifiedArts = artifactEvent.getRelCacheArtifacts();
+ final Collection<EventBasicGuidArtifact> deletedPurgedArts =
+ artifactEvent.get(EventModType.Deleted, EventModType.Purged);
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (!deletedPurgedArts.isEmpty()) {
+ for (IWorldViewerEventHandler handler : handlers) {
+ if (!handler.isDisposed()) {
+ // allow handler to remove from model
+ handler.removeItems(deletedPurgedArts);
+ IContentProvider contentProvider = handler.getWorldXViewer().getContentProvider();
+ // remove from UI
+ if (contentProvider instanceof WorldContentProvider) {
+ handler.getWorldXViewer().remove(
+ deletedPurgedArts.toArray(new Object[deletedPurgedArts.size()]));
+ }
+ }
+ }
+ }
+ for (IWorldViewerEventHandler handler : handlers) {
+ if (!handler.isDisposed()) {
+ for (Artifact artifact : modifiedArts) {
+ try {
+ // Don't refresh deleted artifacts
+ if (artifact.isDeleted()) {
+ continue;
+ }
+ if (artifact instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(artifact);
+ // If parent is loaded and child changed, refresh parent
+ if (artifact instanceof StateMachineArtifact && ((StateMachineArtifact) artifact).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(
+ ((StateMachineArtifact) artifact).getParentAtsArtifact());
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ for (Artifact art : relModifiedArts) {
+ // Don't refresh deleted artifacts
+ if (art.isDeleted()) {
+ continue;
+ }
+ if (art instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(art);
+ // If parent is loaded and child changed, refresh parent
+ try {
+ if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(((StateMachineArtifact) art).getParentAtsArtifact());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return AtsUtil.getAtsObjectEventFilters();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerFactory.java
index 7ef691e1615..340072dd045 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerFactory.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewerFactory.java
@@ -1,328 +1,328 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.logging.Level;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.nebula.widgets.xviewer.XViewerSorter;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.GoalArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.xviewer.column.XViewerAtsAttributeColumn;
-import org.eclipse.osee.ats.util.xviewer.column.XViewerSmaCreatedDateColumn;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerArtifactNameColumn;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerArtifactTypeColumn;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerGuidColumn;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerHridColumn;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerLastModifiedByColumn;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerLastModifiedDateColumn;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldXViewerFactory extends SkynetXViewerFactory {
-
- public GoalArtifact soleGoalArtifact;
- public static String COLUMN_NAMESPACE = "ats.column";
- public static final XViewerColumn Type_Col =
- new XViewerColumn("ats.column.type", "Type", 150, SWT.LEFT, true, SortDataType.String, false, null);
- public static final XViewerColumn State_Col =
- new XViewerColumn("ats.column.state", "State", 75, SWT.LEFT, true, SortDataType.String, false, null);
- public static final XViewerColumn Priority_Col =
- new XViewerAtsAttributeColumn(ATSAttributes.PRIORITY_TYPE_ATTRIBUTE, 20, SWT.CENTER, true,
- SortDataType.String, false);
- public static final XViewerColumn Change_Type_Col =
- new XViewerAtsAttributeColumn(ATSAttributes.CHANGE_TYPE_ATTRIBUTE, 22, SWT.CENTER, true, SortDataType.String,
- false);
- public static final XViewerColumn Assignees_Col =
- new XViewerAtsAttributeColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".assignees",
- ATSAttributes.ASSIGNEE_ATTRIBUTE, 100, SWT.LEFT, true, SortDataType.String, false);
- public static final XViewerColumn Title_Col = new XViewerArtifactNameColumn("Title");
- public static final XViewerColumn Actionable_Items_Col =
- new XViewerAtsAttributeColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".actionableItems",
- ATSAttributes.ACTIONABLE_ITEM_GUID_ATTRIBUTE, 80, SWT.LEFT, true, SortDataType.String, false);
- public static final XViewerColumn User_Community_Col =
- new XViewerAtsAttributeColumn(ATSAttributes.USER_COMMUNITY_ATTRIBUTE, 60, SWT.LEFT, true, SortDataType.String,
- false);
- public static final XViewerColumn Parent_ID_Col =
- new XViewerColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".parenthrid", "Parent HRID", 75, SWT.LEFT, false,
- SortDataType.String, false, "Human Readable ID of Parent Action or Team Workflow");
- public static final XViewerColumn Parent_State_Col =
- new XViewerColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".parentstate", "Parent State", 75, SWT.LEFT, false,
- SortDataType.String, false, "State of the Parent Team Workflow or Action");
- public static final XViewerColumn Created_Date_Col = new XViewerSmaCreatedDateColumn();
- public static final XViewerColumn Version_Target_Col =
- new XViewerColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".versionTarget", "Version Target", 40, SWT.LEFT,
- true, SortDataType.String, false, "Date this workflow transitioned to the Completed state.");
- public static final XViewerColumn Team_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".team", "Team", 50, SWT.LEFT, true, SortDataType.String, false,
- "Team that has been assigned to work this Action.");
- public static final XViewerColumn Notes_Col =
- new XViewerAtsAttributeColumn(ATSAttributes.SMA_NOTE_ATTRIBUTE, 80, SWT.LEFT, true, SortDataType.String, true);
- public static final XViewerColumn Deadline_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".deadline", ATSAttributes.NEED_BY_ATTRIBUTE, 75, SWT.LEFT,
- true, SortDataType.Date, true, null);
-
- // Aren't shown by default
- public static final XViewerColumn Annual_Cost_Avoidance_Col =
- new XViewerColumn(
- COLUMN_NAMESPACE + ".annualCostAvoidance",
- "Annual Cost Avoidance",
- 50,
- SWT.LEFT,
- false,
- SortDataType.Float,
- false,
- "Hours that would be saved for the first year if this change were completed.\n\n" + "(Weekly Benefit Hours * 52 weeks) - Remaining Hours\n\n" + "If number is high, benefit is great given hours remaining.");
- public static final XViewerColumn Description_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".description", ATSAttributes.DESCRIPTION_ATTRIBUTE, 150,
- SWT.LEFT, false, SortDataType.String, true);
- public static XViewerColumn Legacy_PCR_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".legacyPcr", ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE, 40,
- SWT.LEFT, false, SortDataType.String, false);
- public static final XViewerColumn Decision_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".decision", ATSAttributes.DECISION_ATTRIBUTE, 150, SWT.LEFT,
- false, SortDataType.String, false);
- public static final XViewerColumn Resolution_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".resolution", ATSAttributes.RESOLUTION_ATTRIBUTE, 150,
- SWT.LEFT, false, SortDataType.String, true);
- public static XViewerColumn Estimated_Hours_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".estimatedHours", ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE,
- 40, SWT.CENTER, false, SortDataType.Float, true);
- public static XViewerColumn Estimated_Release_Date_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".estimatedReleaseDate",
- ATSAttributes.ESTIMATED_RELEASE_DATE_ATTRIBUTE, 80, SWT.LEFT, false, SortDataType.Date, true);
- public static XViewerColumn Estimated_Completion_Date_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".estimatedCompletionDate",
- ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE, 80, SWT.LEFT, false, SortDataType.Date, true);
- public static final XViewerColumn Release_Date_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".releaseDate", ATSAttributes.RELEASE_DATE_ATTRIBUTE, 80,
- SWT.LEFT, false, SortDataType.Date, false);
- public static final XViewerColumn Work_Package_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".workPackage", ATSAttributes.WORK_PACKAGE_ATTRIBUTE, 80,
- SWT.LEFT, false, SortDataType.String, true);
- public static final XViewerColumn Points_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".points", ATSAttributes.POINTS_ATTRIBUTE, 40, SWT.LEFT,
- false, SortDataType.Integer, true);
- public static final XViewerColumn Numeric1_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".numeric1", ATSAttributes.NUMERIC1_ATTRIBUTE, 40, SWT.LEFT,
- false, SortDataType.Float, true);
- public static final XViewerColumn Numeric2_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".numeric2", ATSAttributes.NUMERIC2_ATTRIBUTE, 40, SWT.LEFT,
- false, SortDataType.Float, true);
- public static final XViewerColumn Goal_Order =
- new XViewerColumn(COLUMN_NAMESPACE + ".goalOrder", "Goal Order", 40, SWT.LEFT, false, SortDataType.Integer,
- true, "Order of item within displayed goal. Editing this field changes order.");
- public static final XViewerColumn Goal_Order_Vote_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".goalOrderVote", ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE,
- 80, SWT.LEFT, false, SortDataType.String, true);
- public static final XViewerColumn Category_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".category", ATSAttributes.CATEGORY_ATTRIBUTE, 80, SWT.LEFT,
- false, SortDataType.String, true);
- public static final XViewerColumn Category2_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".category2", ATSAttributes.CATEGORY2_ATTRIBUTE, 80,
- SWT.LEFT, false, SortDataType.String, true);
- public static final XViewerColumn Category3_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".category3", ATSAttributes.CATEGORY3_ATTRIBUTE, 80,
- SWT.LEFT, false, SortDataType.String, true);
-
- public static XViewerAtsAttributeColumn Related_To_State_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".relatedToState", ATSAttributes.RELATED_TO_STATE_ATTRIBUTE,
- 80, SWT.LEFT, false, SortDataType.String, true);
- public static final XViewerColumn Weekly_Benefit_Hrs_Col =
- new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".weeklyBenefitHrs", ATSAttributes.WEEKLY_BENEFIT_ATTRIBUTE,
- 40, SWT.CENTER, false, SortDataType.Float, true);
- public static final XViewerColumn Remaining_Hours_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".remainingHours", "Remaining Hours", 40, SWT.CENTER, false,
- SortDataType.Float, false,
- "Hours that remain to complete the changes.\n\nEstimated Hours - (Estimated Hours * Percent Complete).");
-
- public static final XViewerColumn Percent_Complete_State_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".statePercentComplete", "State Percent Complete", 40, SWT.CENTER, false,
- SortDataType.Percent, false,
- "Percent Complete for the changes to the current state.\n\nAmount entered from user.");
- public static final XViewerColumn Percent_Complete_State_Task_Col =
- new XViewerColumn(
- COLUMN_NAMESPACE + ".stateTaskPercentComplete",
- "State Task Percent Complete",
- 40,
- SWT.CENTER,
- false,
- SortDataType.Percent,
- false,
- "Percent Complete for the tasks related to the current state.\n\nCalculation: total percent of all tasks related to state / number of tasks related to state");
- public static final XViewerColumn Percent_Complete_State_Review_Col =
- new XViewerColumn(
- COLUMN_NAMESPACE + ".stateReviewPercentComplete",
- "State Review Percent Complete",
- 40,
- SWT.CENTER,
- false,
- SortDataType.Percent,
- false,
- "Percent Complete for the reviews related to the current state.\n\nCalculation: total percent of all reviews related to state / number of reviews related to state");
- public static final XViewerColumn Percent_Complete_Total_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".totalPercentComplete", "Total Percent Complete", 40, SWT.CENTER, false,
- SortDataType.Percent, false, "Percent Complete for the reviews related to the current state.");
-
- public static final XViewerColumn Hours_Spent_State_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".stateHoursSpent", "State Hours Spent", 40, SWT.CENTER, false,
- SortDataType.Float, false, "Hours spent in performing the changes to the current state.");
- public static final XViewerColumn Hours_Spent_State_Task_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".stateTaskHoursSpent", "State Task Hours Spent", 40, SWT.CENTER, false,
- SortDataType.Float, false,
- "Hours spent in performing the changes for the tasks related to the current state.");
- public static final XViewerColumn Hours_Spent_State_Review_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".stateReviewHoursSpent", "State Review Hours Spent", 40, SWT.CENTER,
- false, SortDataType.Float, false,
- "Hours spent in performing the changes for the reveiws related to the current state.");
- public static final XViewerColumn Hours_Spent_Total_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".stateTotalHoursSpent", "State Total Hours Spent", 40, SWT.CENTER,
- false, SortDataType.Float, false, "Hours spent for all work related to the current state.");
-
- public static final XViewerColumn Total_Hours_Spent_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".totalHoursSpent", "Total Hours Spent", 40, SWT.CENTER, false,
- SortDataType.Float, false, "Hours spent for all work related to all states.");
-
- public static final XViewerColumn Originator_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".originator", "Originator", 80, SWT.LEFT, false, SortDataType.String,
- false, null);
- public static final XViewerColumn Implementor_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".implementer", "Implementer", 80, SWT.LEFT, false, SortDataType.String,
- false, "User assigned to the Implementation of the changes.");
- public static final XViewerColumn Review_Author_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".reviewAuthor", "Review Author", 100, SWT.LEFT, false,
- SortDataType.String, false, "Review Author(s)");
- public static final XViewerColumn Review_Moderator_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".reviewModerator", "Review Moderator", 100, SWT.LEFT, false,
- SortDataType.String, false, "Review Moderator(s)");
- public static final XViewerColumn Groups_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".groups", "Groups", 100, SWT.LEFT, false, SortDataType.String, true,
- "Groups");
- public static final XViewerColumn Goals_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".goals", "Goals", 100, SWT.LEFT, false, SortDataType.String, true,
- "Goals");
- public static final XViewerColumn Review_Reviewer_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".reviewReviewer", "Review Reviewer", 100, SWT.LEFT, false,
- SortDataType.String, false, "Review Reviewer(s)");
- public static final XViewerColumn Review_Decider_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".reviewDecider", "Review Decider", 100, SWT.LEFT, false,
- SortDataType.String, false, "Review Decider");
- public static final XViewerColumn Completed_Date_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".completedDate", "Completed Date", 80, SWT.CENTER, false,
- SortDataType.Date, false, null);
- public static final XViewerColumn Cancelled_Date_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".cancelledDate", "Cancelled Date", 80, SWT.CENTER, false,
- SortDataType.Date, false, null);
- public static final XViewerColumn Work_Days_Needed_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".workDaysNeeded", "Hours Per Work Day", 40, SWT.CENTER, false,
- SortDataType.Float, false, null);
- public static final XViewerColumn Days_In_Current_State =
- new XViewerColumn(COLUMN_NAMESPACE + ".daysInCurrState", "Days in Current State", 40, SWT.CENTER, false,
- SortDataType.Float, false, null);
- public static final XViewerColumn Percent_Rework_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".percentRework", "Percent Rework", 40, SWT.CENTER, false,
- SortDataType.Percent, false, null);
- public static final XViewerColumn Branch_Status_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".branchStatus", "Branch Status", 40, SWT.CENTER, false,
- SortDataType.String, false, null);
- public static final XViewerColumn Number_of_Tasks_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".numberOfTasks", "Number of Tasks", 40, SWT.CENTER, false,
- SortDataType.Integer, false, null);
- public static final XViewerColumn Number_of_Tasks_Remining_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".numberOfTasksRemain", "Number of Tasks Remaining", 40, SWT.CENTER,
- false, SortDataType.Integer, false, null);
- public static final XViewerColumn Last_Modified_By_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".lastModifiedBy", "Last Modified By", 40, SWT.CENTER, false,
- SortDataType.String, false, "Retrieves user of last attribute update of this artifact.");
- public static final XViewerColumn Last_Statused_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".lastStatused", "Last Statused", 40, SWT.CENTER, false,
- SortDataType.Date, false, "Retrieves timestamp of status (percent completed or hours spent).");
- public static final XViewerColumn Validation_Required_Col =
- new XViewerColumn(COLUMN_NAMESPACE + ".validationRequired", "Validation Required", 80, SWT.LEFT, false,
- SortDataType.String, false,
- "If set, Originator will be asked to perform a review to\nensure changes are as expected.");
- public static final XViewerColumn Review_Minor_Defects =
- new XViewerColumn(COLUMN_NAMESPACE + ".reviewMinorDefects", "Review Minor Defects", 40, SWT.CENTER, false,
- SortDataType.Integer, false, "Number of Minor Defects found in Review");
- public static final XViewerColumn Review_Major_Defects =
- new XViewerColumn(COLUMN_NAMESPACE + ".reviewMajorDefects", "Review Major Defects", 40, SWT.CENTER, false,
- SortDataType.Integer, false, "Number of Major Defects found in Review");
- public static final XViewerColumn Review_Issues =
- new XViewerColumn(COLUMN_NAMESPACE + ".reviewIssues", "Review Issues", 40, SWT.CENTER, false,
- SortDataType.Integer, false, "Number of Issues found in Review");
- public static final XViewerColumn Originating_Workflow =
- new XViewerColumn("ats.column.origWf", "Originating Workflow", 150, SWT.LEFT, false, SortDataType.String,
- false,
- "Team Workflow(s) that were created upon origination of this Action. Cancelled workflows not included.");
- public static final XViewerColumn Actions_Initiating_Workflow_Col =
- new XViewerColumn("ats.column.initWf", "Action's Initiating Workflow", 150, SWT.LEFT, false,
- SortDataType.String, false, "This is the first workflow(s) that created the initiation of the Action");
- public static final XViewerColumn Artifact_Type_Col = new XViewerArtifactTypeColumn(true);
- public static final XViewerColumn[] WorldViewColumns =
- new XViewerColumn[] {Type_Col, State_Col, Priority_Col, Change_Type_Col, Assignees_Col, Title_Col,
- Actionable_Items_Col, User_Community_Col, new XViewerHridColumn(), Created_Date_Col, Version_Target_Col,
- Team_Col, Notes_Col, Deadline_Col, Annual_Cost_Avoidance_Col, Description_Col, Legacy_PCR_Col,
- Decision_Col, Resolution_Col, Groups_Col, Goals_Col, Estimated_Release_Date_Col,
- Estimated_Completion_Date_Col, Release_Date_Col, Work_Package_Col, Category_Col, Category2_Col,
- Category3_Col, Goal_Order, Goal_Order_Vote_Col, Related_To_State_Col, Estimated_Hours_Col,
- Weekly_Benefit_Hrs_Col, Remaining_Hours_Col, Percent_Complete_State_Col,
- Percent_Complete_State_Task_Col, Percent_Complete_State_Review_Col, Percent_Complete_Total_Col,
- Hours_Spent_State_Col, Hours_Spent_State_Task_Col, Hours_Spent_State_Review_Col, Hours_Spent_Total_Col,
- Total_Hours_Spent_Col, Originator_Col, Implementor_Col, Review_Author_Col, Review_Moderator_Col,
- Review_Reviewer_Col, Review_Decider_Col, Completed_Date_Col, Cancelled_Date_Col, Work_Days_Needed_Col,
- Percent_Rework_Col, Branch_Status_Col, Number_of_Tasks_Col, Number_of_Tasks_Remining_Col,
- new XViewerLastModifiedByColumn(false), new XViewerLastModifiedDateColumn(false), Last_Statused_Col,
- Validation_Required_Col, Review_Major_Defects, Review_Minor_Defects, Review_Issues,
- Actions_Initiating_Workflow_Col, Artifact_Type_Col, Originating_Workflow, Parent_ID_Col,
- Days_In_Current_State, Parent_State_Col, Points_Col, Numeric1_Col, Numeric2_Col,
- new XViewerGuidColumn(false)};
- private static String NAMESPACE = "org.eclipse.osee.ats.WorldXViewer";
-
- public WorldXViewerFactory() {
- super(NAMESPACE);
- registerColumns(WorldViewColumns);
- // Register all ats.* attribute columns
- try {
- for (AttributeType attributeType : AttributeTypeManager.getAllTypes()) {
- if (attributeType.getName().startsWith("ats.")) {
- registerColumns(getAttributeColumn(attributeType));
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
-
- // Register any columns from other plugins
- try {
- for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
- for (XViewerColumn xCol : item.getXViewerColumns()) {
- registerColumns(xCol);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public XViewerSorter createNewXSorter(XViewer xViewer) {
- return new WorldXViewerSorter(xViewer);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world;
+
+import java.util.logging.Level;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.nebula.widgets.xviewer.XViewerSorter;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.GoalArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.xviewer.column.XViewerAtsAttributeColumn;
+import org.eclipse.osee.ats.util.xviewer.column.XViewerSmaCreatedDateColumn;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerArtifactNameColumn;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerArtifactTypeColumn;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerGuidColumn;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerHridColumn;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerLastModifiedByColumn;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerLastModifiedDateColumn;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldXViewerFactory extends SkynetXViewerFactory {
+
+ public GoalArtifact soleGoalArtifact;
+ public static String COLUMN_NAMESPACE = "ats.column";
+ public static final XViewerColumn Type_Col =
+ new XViewerColumn("ats.column.type", "Type", 150, SWT.LEFT, true, SortDataType.String, false, null);
+ public static final XViewerColumn State_Col =
+ new XViewerColumn("ats.column.state", "State", 75, SWT.LEFT, true, SortDataType.String, false, null);
+ public static final XViewerColumn Priority_Col =
+ new XViewerAtsAttributeColumn(ATSAttributes.PRIORITY_TYPE_ATTRIBUTE, 20, SWT.CENTER, true,
+ SortDataType.String, false);
+ public static final XViewerColumn Change_Type_Col =
+ new XViewerAtsAttributeColumn(ATSAttributes.CHANGE_TYPE_ATTRIBUTE, 22, SWT.CENTER, true, SortDataType.String,
+ false);
+ public static final XViewerColumn Assignees_Col =
+ new XViewerAtsAttributeColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".assignees",
+ ATSAttributes.ASSIGNEE_ATTRIBUTE, 100, SWT.LEFT, true, SortDataType.String, false);
+ public static final XViewerColumn Title_Col = new XViewerArtifactNameColumn("Title");
+ public static final XViewerColumn Actionable_Items_Col =
+ new XViewerAtsAttributeColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".actionableItems",
+ ATSAttributes.ACTIONABLE_ITEM_GUID_ATTRIBUTE, 80, SWT.LEFT, true, SortDataType.String, false);
+ public static final XViewerColumn User_Community_Col =
+ new XViewerAtsAttributeColumn(ATSAttributes.USER_COMMUNITY_ATTRIBUTE, 60, SWT.LEFT, true, SortDataType.String,
+ false);
+ public static final XViewerColumn Parent_ID_Col =
+ new XViewerColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".parenthrid", "Parent HRID", 75, SWT.LEFT, false,
+ SortDataType.String, false, "Human Readable ID of Parent Action or Team Workflow");
+ public static final XViewerColumn Parent_State_Col =
+ new XViewerColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".parentstate", "Parent State", 75, SWT.LEFT, false,
+ SortDataType.String, false, "State of the Parent Team Workflow or Action");
+ public static final XViewerColumn Created_Date_Col = new XViewerSmaCreatedDateColumn();
+ public static final XViewerColumn Version_Target_Col =
+ new XViewerColumn(WorldXViewerFactory.COLUMN_NAMESPACE + ".versionTarget", "Version Target", 40, SWT.LEFT,
+ true, SortDataType.String, false, "Date this workflow transitioned to the Completed state.");
+ public static final XViewerColumn Team_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".team", "Team", 50, SWT.LEFT, true, SortDataType.String, false,
+ "Team that has been assigned to work this Action.");
+ public static final XViewerColumn Notes_Col =
+ new XViewerAtsAttributeColumn(ATSAttributes.SMA_NOTE_ATTRIBUTE, 80, SWT.LEFT, true, SortDataType.String, true);
+ public static final XViewerColumn Deadline_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".deadline", ATSAttributes.NEED_BY_ATTRIBUTE, 75, SWT.LEFT,
+ true, SortDataType.Date, true, null);
+
+ // Aren't shown by default
+ public static final XViewerColumn Annual_Cost_Avoidance_Col =
+ new XViewerColumn(
+ COLUMN_NAMESPACE + ".annualCostAvoidance",
+ "Annual Cost Avoidance",
+ 50,
+ SWT.LEFT,
+ false,
+ SortDataType.Float,
+ false,
+ "Hours that would be saved for the first year if this change were completed.\n\n" + "(Weekly Benefit Hours * 52 weeks) - Remaining Hours\n\n" + "If number is high, benefit is great given hours remaining.");
+ public static final XViewerColumn Description_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".description", ATSAttributes.DESCRIPTION_ATTRIBUTE, 150,
+ SWT.LEFT, false, SortDataType.String, true);
+ public static XViewerColumn Legacy_PCR_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".legacyPcr", ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE, 40,
+ SWT.LEFT, false, SortDataType.String, false);
+ public static final XViewerColumn Decision_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".decision", ATSAttributes.DECISION_ATTRIBUTE, 150, SWT.LEFT,
+ false, SortDataType.String, false);
+ public static final XViewerColumn Resolution_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".resolution", ATSAttributes.RESOLUTION_ATTRIBUTE, 150,
+ SWT.LEFT, false, SortDataType.String, true);
+ public static XViewerColumn Estimated_Hours_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".estimatedHours", ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE,
+ 40, SWT.CENTER, false, SortDataType.Float, true);
+ public static XViewerColumn Estimated_Release_Date_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".estimatedReleaseDate",
+ ATSAttributes.ESTIMATED_RELEASE_DATE_ATTRIBUTE, 80, SWT.LEFT, false, SortDataType.Date, true);
+ public static XViewerColumn Estimated_Completion_Date_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".estimatedCompletionDate",
+ ATSAttributes.ESTIMATED_COMPLETION_DATE_ATTRIBUTE, 80, SWT.LEFT, false, SortDataType.Date, true);
+ public static final XViewerColumn Release_Date_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".releaseDate", ATSAttributes.RELEASE_DATE_ATTRIBUTE, 80,
+ SWT.LEFT, false, SortDataType.Date, false);
+ public static final XViewerColumn Work_Package_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".workPackage", ATSAttributes.WORK_PACKAGE_ATTRIBUTE, 80,
+ SWT.LEFT, false, SortDataType.String, true);
+ public static final XViewerColumn Points_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".points", ATSAttributes.POINTS_ATTRIBUTE, 40, SWT.LEFT,
+ false, SortDataType.Integer, true);
+ public static final XViewerColumn Numeric1_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".numeric1", ATSAttributes.NUMERIC1_ATTRIBUTE, 40, SWT.LEFT,
+ false, SortDataType.Float, true);
+ public static final XViewerColumn Numeric2_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".numeric2", ATSAttributes.NUMERIC2_ATTRIBUTE, 40, SWT.LEFT,
+ false, SortDataType.Float, true);
+ public static final XViewerColumn Goal_Order =
+ new XViewerColumn(COLUMN_NAMESPACE + ".goalOrder", "Goal Order", 40, SWT.LEFT, false, SortDataType.Integer,
+ true, "Order of item within displayed goal. Editing this field changes order.");
+ public static final XViewerColumn Goal_Order_Vote_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".goalOrderVote", ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE,
+ 80, SWT.LEFT, false, SortDataType.String, true);
+ public static final XViewerColumn Category_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".category", ATSAttributes.CATEGORY_ATTRIBUTE, 80, SWT.LEFT,
+ false, SortDataType.String, true);
+ public static final XViewerColumn Category2_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".category2", ATSAttributes.CATEGORY2_ATTRIBUTE, 80,
+ SWT.LEFT, false, SortDataType.String, true);
+ public static final XViewerColumn Category3_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".category3", ATSAttributes.CATEGORY3_ATTRIBUTE, 80,
+ SWT.LEFT, false, SortDataType.String, true);
+
+ public static XViewerAtsAttributeColumn Related_To_State_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".relatedToState", ATSAttributes.RELATED_TO_STATE_ATTRIBUTE,
+ 80, SWT.LEFT, false, SortDataType.String, true);
+ public static final XViewerColumn Weekly_Benefit_Hrs_Col =
+ new XViewerAtsAttributeColumn(COLUMN_NAMESPACE + ".weeklyBenefitHrs", ATSAttributes.WEEKLY_BENEFIT_ATTRIBUTE,
+ 40, SWT.CENTER, false, SortDataType.Float, true);
+ public static final XViewerColumn Remaining_Hours_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".remainingHours", "Remaining Hours", 40, SWT.CENTER, false,
+ SortDataType.Float, false,
+ "Hours that remain to complete the changes.\n\nEstimated Hours - (Estimated Hours * Percent Complete).");
+
+ public static final XViewerColumn Percent_Complete_State_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".statePercentComplete", "State Percent Complete", 40, SWT.CENTER, false,
+ SortDataType.Percent, false,
+ "Percent Complete for the changes to the current state.\n\nAmount entered from user.");
+ public static final XViewerColumn Percent_Complete_State_Task_Col =
+ new XViewerColumn(
+ COLUMN_NAMESPACE + ".stateTaskPercentComplete",
+ "State Task Percent Complete",
+ 40,
+ SWT.CENTER,
+ false,
+ SortDataType.Percent,
+ false,
+ "Percent Complete for the tasks related to the current state.\n\nCalculation: total percent of all tasks related to state / number of tasks related to state");
+ public static final XViewerColumn Percent_Complete_State_Review_Col =
+ new XViewerColumn(
+ COLUMN_NAMESPACE + ".stateReviewPercentComplete",
+ "State Review Percent Complete",
+ 40,
+ SWT.CENTER,
+ false,
+ SortDataType.Percent,
+ false,
+ "Percent Complete for the reviews related to the current state.\n\nCalculation: total percent of all reviews related to state / number of reviews related to state");
+ public static final XViewerColumn Percent_Complete_Total_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".totalPercentComplete", "Total Percent Complete", 40, SWT.CENTER, false,
+ SortDataType.Percent, false, "Percent Complete for the reviews related to the current state.");
+
+ public static final XViewerColumn Hours_Spent_State_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".stateHoursSpent", "State Hours Spent", 40, SWT.CENTER, false,
+ SortDataType.Float, false, "Hours spent in performing the changes to the current state.");
+ public static final XViewerColumn Hours_Spent_State_Task_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".stateTaskHoursSpent", "State Task Hours Spent", 40, SWT.CENTER, false,
+ SortDataType.Float, false,
+ "Hours spent in performing the changes for the tasks related to the current state.");
+ public static final XViewerColumn Hours_Spent_State_Review_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".stateReviewHoursSpent", "State Review Hours Spent", 40, SWT.CENTER,
+ false, SortDataType.Float, false,
+ "Hours spent in performing the changes for the reveiws related to the current state.");
+ public static final XViewerColumn Hours_Spent_Total_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".stateTotalHoursSpent", "State Total Hours Spent", 40, SWT.CENTER,
+ false, SortDataType.Float, false, "Hours spent for all work related to the current state.");
+
+ public static final XViewerColumn Total_Hours_Spent_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".totalHoursSpent", "Total Hours Spent", 40, SWT.CENTER, false,
+ SortDataType.Float, false, "Hours spent for all work related to all states.");
+
+ public static final XViewerColumn Originator_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".originator", "Originator", 80, SWT.LEFT, false, SortDataType.String,
+ false, null);
+ public static final XViewerColumn Implementor_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".implementer", "Implementer", 80, SWT.LEFT, false, SortDataType.String,
+ false, "User assigned to the Implementation of the changes.");
+ public static final XViewerColumn Review_Author_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".reviewAuthor", "Review Author", 100, SWT.LEFT, false,
+ SortDataType.String, false, "Review Author(s)");
+ public static final XViewerColumn Review_Moderator_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".reviewModerator", "Review Moderator", 100, SWT.LEFT, false,
+ SortDataType.String, false, "Review Moderator(s)");
+ public static final XViewerColumn Groups_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".groups", "Groups", 100, SWT.LEFT, false, SortDataType.String, true,
+ "Groups");
+ public static final XViewerColumn Goals_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".goals", "Goals", 100, SWT.LEFT, false, SortDataType.String, true,
+ "Goals");
+ public static final XViewerColumn Review_Reviewer_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".reviewReviewer", "Review Reviewer", 100, SWT.LEFT, false,
+ SortDataType.String, false, "Review Reviewer(s)");
+ public static final XViewerColumn Review_Decider_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".reviewDecider", "Review Decider", 100, SWT.LEFT, false,
+ SortDataType.String, false, "Review Decider");
+ public static final XViewerColumn Completed_Date_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".completedDate", "Completed Date", 80, SWT.CENTER, false,
+ SortDataType.Date, false, null);
+ public static final XViewerColumn Cancelled_Date_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".cancelledDate", "Cancelled Date", 80, SWT.CENTER, false,
+ SortDataType.Date, false, null);
+ public static final XViewerColumn Work_Days_Needed_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".workDaysNeeded", "Hours Per Work Day", 40, SWT.CENTER, false,
+ SortDataType.Float, false, null);
+ public static final XViewerColumn Days_In_Current_State =
+ new XViewerColumn(COLUMN_NAMESPACE + ".daysInCurrState", "Days in Current State", 40, SWT.CENTER, false,
+ SortDataType.Float, false, null);
+ public static final XViewerColumn Percent_Rework_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".percentRework", "Percent Rework", 40, SWT.CENTER, false,
+ SortDataType.Percent, false, null);
+ public static final XViewerColumn Branch_Status_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".branchStatus", "Branch Status", 40, SWT.CENTER, false,
+ SortDataType.String, false, null);
+ public static final XViewerColumn Number_of_Tasks_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".numberOfTasks", "Number of Tasks", 40, SWT.CENTER, false,
+ SortDataType.Integer, false, null);
+ public static final XViewerColumn Number_of_Tasks_Remining_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".numberOfTasksRemain", "Number of Tasks Remaining", 40, SWT.CENTER,
+ false, SortDataType.Integer, false, null);
+ public static final XViewerColumn Last_Modified_By_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".lastModifiedBy", "Last Modified By", 40, SWT.CENTER, false,
+ SortDataType.String, false, "Retrieves user of last attribute update of this artifact.");
+ public static final XViewerColumn Last_Statused_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".lastStatused", "Last Statused", 40, SWT.CENTER, false,
+ SortDataType.Date, false, "Retrieves timestamp of status (percent completed or hours spent).");
+ public static final XViewerColumn Validation_Required_Col =
+ new XViewerColumn(COLUMN_NAMESPACE + ".validationRequired", "Validation Required", 80, SWT.LEFT, false,
+ SortDataType.String, false,
+ "If set, Originator will be asked to perform a review to\nensure changes are as expected.");
+ public static final XViewerColumn Review_Minor_Defects =
+ new XViewerColumn(COLUMN_NAMESPACE + ".reviewMinorDefects", "Review Minor Defects", 40, SWT.CENTER, false,
+ SortDataType.Integer, false, "Number of Minor Defects found in Review");
+ public static final XViewerColumn Review_Major_Defects =
+ new XViewerColumn(COLUMN_NAMESPACE + ".reviewMajorDefects", "Review Major Defects", 40, SWT.CENTER, false,
+ SortDataType.Integer, false, "Number of Major Defects found in Review");
+ public static final XViewerColumn Review_Issues =
+ new XViewerColumn(COLUMN_NAMESPACE + ".reviewIssues", "Review Issues", 40, SWT.CENTER, false,
+ SortDataType.Integer, false, "Number of Issues found in Review");
+ public static final XViewerColumn Originating_Workflow =
+ new XViewerColumn("ats.column.origWf", "Originating Workflow", 150, SWT.LEFT, false, SortDataType.String,
+ false,
+ "Team Workflow(s) that were created upon origination of this Action. Cancelled workflows not included.");
+ public static final XViewerColumn Actions_Initiating_Workflow_Col =
+ new XViewerColumn("ats.column.initWf", "Action's Initiating Workflow", 150, SWT.LEFT, false,
+ SortDataType.String, false, "This is the first workflow(s) that created the initiation of the Action");
+ public static final XViewerColumn Artifact_Type_Col = new XViewerArtifactTypeColumn(true);
+ public static final XViewerColumn[] WorldViewColumns =
+ new XViewerColumn[] {Type_Col, State_Col, Priority_Col, Change_Type_Col, Assignees_Col, Title_Col,
+ Actionable_Items_Col, User_Community_Col, new XViewerHridColumn(), Created_Date_Col, Version_Target_Col,
+ Team_Col, Notes_Col, Deadline_Col, Annual_Cost_Avoidance_Col, Description_Col, Legacy_PCR_Col,
+ Decision_Col, Resolution_Col, Groups_Col, Goals_Col, Estimated_Release_Date_Col,
+ Estimated_Completion_Date_Col, Release_Date_Col, Work_Package_Col, Category_Col, Category2_Col,
+ Category3_Col, Goal_Order, Goal_Order_Vote_Col, Related_To_State_Col, Estimated_Hours_Col,
+ Weekly_Benefit_Hrs_Col, Remaining_Hours_Col, Percent_Complete_State_Col,
+ Percent_Complete_State_Task_Col, Percent_Complete_State_Review_Col, Percent_Complete_Total_Col,
+ Hours_Spent_State_Col, Hours_Spent_State_Task_Col, Hours_Spent_State_Review_Col, Hours_Spent_Total_Col,
+ Total_Hours_Spent_Col, Originator_Col, Implementor_Col, Review_Author_Col, Review_Moderator_Col,
+ Review_Reviewer_Col, Review_Decider_Col, Completed_Date_Col, Cancelled_Date_Col, Work_Days_Needed_Col,
+ Percent_Rework_Col, Branch_Status_Col, Number_of_Tasks_Col, Number_of_Tasks_Remining_Col,
+ new XViewerLastModifiedByColumn(false), new XViewerLastModifiedDateColumn(false), Last_Statused_Col,
+ Validation_Required_Col, Review_Major_Defects, Review_Minor_Defects, Review_Issues,
+ Actions_Initiating_Workflow_Col, Artifact_Type_Col, Originating_Workflow, Parent_ID_Col,
+ Days_In_Current_State, Parent_State_Col, Points_Col, Numeric1_Col, Numeric2_Col,
+ new XViewerGuidColumn(false)};
+ private static String NAMESPACE = "org.eclipse.osee.ats.WorldXViewer";
+
+ public WorldXViewerFactory() {
+ super(NAMESPACE);
+ registerColumns(WorldViewColumns);
+ // Register all ats.* attribute columns
+ try {
+ for (AttributeType attributeType : AttributeTypeManager.getAllTypes()) {
+ if (attributeType.getName().startsWith("ats.")) {
+ registerColumns(getAttributeColumn(attributeType));
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+
+ // Register any columns from other plugins
+ try {
+ for (IAtsWorldEditorItem item : AtsWorldEditorItems.getItems()) {
+ for (XViewerColumn xCol : item.getXViewerColumns()) {
+ registerColumns(xCol);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public XViewerSorter createNewXSorter(XViewer xViewer) {
+ return new WorldXViewerSorter(xViewer);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
index 6af66d42914..810edfc5f81 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
@@ -1,617 +1,617 @@
-/*******************************************************************************
- * 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.ats.world;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.ats.actions.NewAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorAction;
-import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorSelectedAction;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.GoalArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.SMAMetrics;
-import org.eclipse.osee.ats.util.widgets.ReviewManager;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.Jobs;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.action.CollapseAllAction;
-import org.eclipse.osee.framework.ui.skynet.action.ExpandAllAction;
-import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorldXWidgetActionPage extends AtsXWidgetActionFormPage {
-
- private final WorldEditor worldEditor;
- private WorldComposite worldComposite;
- private Action filterCompletedAction, filterMyAssigneeAction, selectionMetricsAction, toAction, toGoal, toReview,
- toWorkFlow, toTask;
- private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
- private WorldAssigneeFilter worldAssigneeFilter = null;
- protected Label showReleaseMetricsLabel;
-
- public WorldComposite getWorldComposite() {
- return worldComposite;
- }
-
- public WorldXWidgetActionPage(WorldEditor worldEditor) {
- super(worldEditor, "org.eclipse.osee.ats.actionPage", "Actions");
- this.worldEditor = worldEditor;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- scrolledForm.setImage(ImageManager.getImage(AtsImage.GLOBE));
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.widthHint = 200;
- parent.setLayoutData(gd);
-
- Result result = AtsPlugin.areOSEEServicesAvailable();
- if (result.isFalse()) {
- AWorkbench.popup("ERROR", "DB Connection Unavailable");
- return;
- }
-
- try {
- worldEditor.getWorldEditorProvider().run(worldEditor, SearchType.Search, false);
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- protected void createToolBar(IToolBarManager toolBarManager) {
-
- toolBarManager.add(worldComposite.getXViewer().getCustomizeAction());
- toolBarManager.add(new Separator());
- toolBarManager.add(new OpenNewAtsWorldEditorAction(worldComposite));
- toolBarManager.add(new OpenNewAtsWorldEditorSelectedAction(worldComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new ExpandAllAction(worldComposite.getXViewer()));
- toolBarManager.add(new CollapseAllAction(worldComposite.getXViewer()));
- toolBarManager.add(new RefreshAction(worldComposite));
- toolBarManager.add(new Separator());
- toolBarManager.add(new NewAction());
- toolBarManager.add(OseeUiActions.createBugAction(AtsPlugin.getInstance(), worldEditor, WorldEditor.EDITOR_ID,
- "ATS World"));
- toolBarManager.add(new Separator());
-
- createDropDownMenuActions();
- toolBarManager.add(new DropDownAction());
- }
-
- @Override
- public Section createResultsSection(Composite body) {
-
- resultsSection = toolkit.createSection(body, Section.NO_TITLE);
- resultsSection.setText("Results");
- resultsSection.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- resultsContainer = toolkit.createClientContainer(resultsSection, 1);
-
- showReleaseMetricsLabel = toolkit.createLabel(resultsContainer, "");
- showReleaseMetricsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- worldComposite = new WorldComposite(worldEditor, resultsContainer, SWT.BORDER);
- toolkit.adapt(worldComposite);
- return resultsSection;
- }
-
- @Override
- public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() throws OseeArgumentException {
- if (worldEditor.getWorldEditorProvider() instanceof IWorldEditorParameterProvider) {
- return ((IWorldEditorParameterProvider) worldEditor.getWorldEditorProvider()).getDynamicWidgetLayoutListener();
- }
- return null;
- }
-
- @Override
- public Result isResearchSearchValid() throws OseeCoreException {
- return worldEditor.isDirty() ? new Result("Changes un-saved. Save first.") : Result.TrueResult;
- }
-
- public void reSearch() throws OseeCoreException {
- Result result = isResearchSearchValid();
- if (result.isFalse()) {
- result.popup();
- return;
- }
- reSearch(false);
- }
-
- /*
- * Mainly for testing purposes
- */
- public void reSearch(boolean forcePend) throws OseeCoreException {
- worldEditor.getWorldEditorProvider().run(worldEditor, SearchType.ReSearch, forcePend);
- }
-
- @Override
- public String getXWidgetsXml() throws OseeCoreException {
- if (worldEditor.getWorldEditorProvider() instanceof IWorldEditorParameterProvider) {
- return ((IWorldEditorParameterProvider) worldEditor.getWorldEditorProvider()).getParameterXWidgetXml();
- }
- return null;
- }
-
- @Override
- public void handleSearchButtonPressed() {
- try {
- reSearch();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public class DropDownAction extends Action implements IMenuCreator {
- private Menu fMenu;
-
- public DropDownAction() {
- setText("Other");
- setMenuCreator(this);
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
- addKeyListener();
- addSelectionListener();
- }
-
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu = new Menu(parent);
- addActionToMenu(fMenu, selectionMetricsAction);
- addActionToMenu(fMenu, filterCompletedAction);
- addActionToMenu(fMenu, filterMyAssigneeAction);
- new MenuItem(fMenu, SWT.SEPARATOR);
- addActionToMenu(fMenu, toAction);
- addActionToMenu(fMenu, toGoal);
- addActionToMenu(fMenu, toWorkFlow);
- addActionToMenu(fMenu, toTask);
- addActionToMenu(fMenu, toReview);
-
- worldEditor.createToolBarPulldown(fMenu);
-
- return fMenu;
- }
-
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- fMenu = null;
- }
- }
-
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- @Override
- public void run() {
-
- }
-
- /**
- * Get's rid of the menu, because the menu hangs on to * the searches, etc.
- */
- void clear() {
- dispose();
- }
-
- private void addKeyListener() {
- Tree tree = worldComposite.getXViewer().getTree();
- GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL);
- gridData.heightHint = 100;
- gridData.widthHint = 100;
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- worldComposite.getXViewer().getTree().addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- }
-
- public void keyReleased(KeyEvent event) {
- // if CTRL key is already pressed
- if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
- if (event.keyCode == 'a') {
- worldComposite.getXViewer().getTree().setSelection(
- worldComposite.getXViewer().getTree().getItems());
- } else if (event.keyCode == 'x') {
- selectionMetricsAction.setChecked(!selectionMetricsAction.isChecked());
- selectionMetricsAction.run();
- } else if (event.keyCode == 'f') {
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- } else if (event.keyCode == 'g') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterMyAssigneeAction.run();
- } else if (event.keyCode == 'd') {
- filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
- filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
- filterCompletedAction.run();
- filterMyAssigneeAction.run();
- }
- }
-
- }
- });
- }
- }
-
- private void addSelectionListener() {
- worldComposite.getXViewer().getTree().addSelectionListener(new SelectionListener() {
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (selectionMetricsAction != null) {
- if (selectionMetricsAction.isChecked()) {
- selectionMetricsAction.run();
- } else {
- if (worldComposite != null) {
- showReleaseMetricsLabel.setText("");
- }
- }
- }
- }
- });
- }
-
- public void updateExtraInfoLine() throws OseeCoreException {
- if (selectionMetricsAction != null && selectionMetricsAction.isChecked()) {
- if (worldComposite.getXViewer() != null && worldComposite.getXViewer().getSelectedSMAArtifacts() != null && !worldComposite.getXViewer().getSelectedSMAArtifacts().isEmpty()) {
- showReleaseMetricsLabel.setText(SMAMetrics.getEstRemainMetrics(
- worldComposite.getXViewer().getSelectedSMAArtifacts(), null,
- worldComposite.getXViewer().getSelectedSMAArtifacts().iterator().next().getManHrsPerDayPreference(),
- null));
- } else {
- showReleaseMetricsLabel.setText("");
- }
- } else {
- showReleaseMetricsLabel.setText("");
- }
- showReleaseMetricsLabel.getParent().layout();
- }
-
- protected void createDropDownMenuActions() {
- try {
- worldAssigneeFilter = new WorldAssigneeFilter();
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- selectionMetricsAction = new Action("Show Release Metrics by Selection - Ctrl-X", Action.AS_CHECK_BOX) {
- @Override
- public void run() {
- try {
- updateExtraInfoLine();
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
- selectionMetricsAction.setToolTipText("Show Release Metrics by Selection - Ctrl-X");
- selectionMetricsAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PAGE));
-
- filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", Action.AS_CHECK_BOX) {
-
- @Override
- public void run() {
- if (filterCompletedAction.isChecked()) {
- worldComposite.getXViewer().addFilter(worldCompletedFilter);
- } else {
- worldComposite.getXViewer().removeFilter(worldCompletedFilter);
- }
- updateExtendedStatusString();
- worldComposite.getXViewer().refresh();
- }
- };
- filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
- filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
-
- filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", Action.AS_CHECK_BOX) {
-
- @Override
- public void run() {
- if (filterMyAssigneeAction.isChecked()) {
- worldComposite.getXViewer().addFilter(worldAssigneeFilter);
- } else {
- worldComposite.getXViewer().removeFilter(worldAssigneeFilter);
- }
- updateExtendedStatusString();
- worldComposite.getXViewer().refresh();
- }
- };
- filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
- filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
-
- toAction = new Action("Re-display as Actions", Action.AS_PUSH_BUTTON) {
-
- @Override
- public void run() {
- redisplayAsAction();
- }
- };
- toAction.setToolTipText("Re-display as Actions");
- toAction.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.ACTION));
-
- toGoal = new Action("Re-display as Goals", Action.AS_PUSH_BUTTON) {
-
- @Override
- public void run() {
- redisplayAsGoals();
- }
- };
- toGoal.setToolTipText("Re-display as Goals");
- toGoal.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.GOAL));
-
- toWorkFlow = new Action("Re-display as WorkFlows", Action.AS_PUSH_BUTTON) {
-
- @Override
- public void run() {
- redisplayAsWorkFlow();
- }
- };
- toWorkFlow.setToolTipText("Re-display as WorkFlows");
- toWorkFlow.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.WORKFLOW));
-
- toTask = new Action("Re-display as Tasks", Action.AS_PUSH_BUTTON) {
-
- @Override
- public void run() {
- redisplayAsTask();
- }
- };
- toTask.setToolTipText("Re-display as Tasks");
- toTask.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.TASK));
-
- toReview = new Action("Re-display as Reviews", Action.AS_PUSH_BUTTON) {
-
- @Override
- public void run() {
- redisplayAsReviews();
- }
- };
- toReview.setToolTipText("Re-display as Reviews");
- toReview.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.REVIEW));
-
- }
-
- public void redisplayAsAction() {
- final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
- Job job = new Job("Re-display as Actions") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- final Set<Artifact> arts = new HashSet<Artifact>();
- for (Artifact art : artifacts) {
- if (art instanceof ActionArtifact) {
- arts.add(art);
- } else if (art instanceof StateMachineArtifact) {
- Artifact parentArt = ((StateMachineArtifact) art).getParentActionArtifact();
- if (parentArt != null) {
- arts.add(parentArt);
- }
- }
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), arts);
- }
- });
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job, true);
- }
-
- public void redisplayAsGoals() {
- final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
- Job job = new Job("Re-display as Goals") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- final Set<Artifact> goals = new HashSet<Artifact>();
- GoalArtifact.getGoals(artifacts, goals, true);
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), goals);
- }
- });
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job, true);
- }
-
- public void redisplayAsWorkFlow() {
- final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
- Job job = new Job("Re-display as Workflows") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- final Set<Artifact> arts = new HashSet<Artifact>();
- for (Artifact art : artifacts) {
- if (art instanceof ActionArtifact) {
- arts.addAll(((ActionArtifact) art).getTeamWorkFlowArtifacts());
- } else if (art instanceof StateMachineArtifact) {
- Artifact parentArt = ((StateMachineArtifact) art).getParentTeamWorkflow();
- if (parentArt != null) {
- arts.add(parentArt);
- }
- }
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), arts);
- }
- });
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job, true);
- }
-
- public void redisplayAsTask() {
- final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
- Job job = new Job("Re-display as Tasks") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- final Set<Artifact> arts = new HashSet<Artifact>();
- for (Artifact art : artifacts) {
- if (art instanceof ActionArtifact) {
- for (TeamWorkFlowArtifact team : ((ActionArtifact) art).getTeamWorkFlowArtifacts()) {
- arts.addAll(team.getTaskArtifacts());
- }
- } else if (art instanceof TaskableStateMachineArtifact) {
- arts.addAll(((TaskableStateMachineArtifact) art).getTaskArtifacts());
- }
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), arts);
- }
- });
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job, true);
- }
-
- public void redisplayAsReviews() {
- final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
- Job job = new Job("Re-display as Reviews") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- final Set<Artifact> arts = new HashSet<Artifact>();
- for (Artifact art : artifacts) {
- if (art instanceof ActionArtifact) {
- for (TeamWorkFlowArtifact team : ((ActionArtifact) art).getTeamWorkFlowArtifacts()) {
- arts.addAll(ReviewManager.getReviews(team));
- }
- } else if (art instanceof TeamWorkFlowArtifact) {
- arts.addAll(ReviewManager.getReviews((TeamWorkFlowArtifact) art));
- }
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), arts);
- }
- });
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job, true);
- }
-
- public void updateExtendedStatusString() {
- worldComposite.getXViewer().setExtendedStatusString(
- //
- (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
- //
- (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
- }
-
- @Override
- public void handleSaveButtonPressed() {
- try {
- if (isSaveButtonAvailable() && (worldEditor.getWorldEditorProvider() instanceof IWorldEditorParameterProvider)) {
- ((IWorldEditorParameterProvider) worldEditor.getWorldEditorProvider()).handleSaveButtonPressed();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public boolean isSaveButtonAvailable() {
- try {
- if (worldEditor.getWorldEditorProvider() instanceof IWorldEditorParameterProvider) {
- return ((IWorldEditorParameterProvider) worldEditor.getWorldEditorProvider()).isSaveButtonAvailable();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.world;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.actions.NewAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorAction;
+import org.eclipse.osee.ats.actions.OpenNewAtsWorldEditorSelectedAction;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.GoalArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.SMAMetrics;
+import org.eclipse.osee.ats.util.widgets.ReviewManager;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.action.CollapseAllAction;
+import org.eclipse.osee.framework.ui.skynet.action.ExpandAllAction;
+import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorldXWidgetActionPage extends AtsXWidgetActionFormPage {
+
+ private final WorldEditor worldEditor;
+ private WorldComposite worldComposite;
+ private Action filterCompletedAction, filterMyAssigneeAction, selectionMetricsAction, toAction, toGoal, toReview,
+ toWorkFlow, toTask;
+ private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
+ private WorldAssigneeFilter worldAssigneeFilter = null;
+ protected Label showReleaseMetricsLabel;
+
+ public WorldComposite getWorldComposite() {
+ return worldComposite;
+ }
+
+ public WorldXWidgetActionPage(WorldEditor worldEditor) {
+ super(worldEditor, "org.eclipse.osee.ats.actionPage", "Actions");
+ this.worldEditor = worldEditor;
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
+ scrolledForm.setImage(ImageManager.getImage(AtsImage.GLOBE));
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = 200;
+ parent.setLayoutData(gd);
+
+ Result result = AtsPlugin.areOSEEServicesAvailable();
+ if (result.isFalse()) {
+ AWorkbench.popup("ERROR", "DB Connection Unavailable");
+ return;
+ }
+
+ try {
+ worldEditor.getWorldEditorProvider().run(worldEditor, SearchType.Search, false);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ protected void createToolBar(IToolBarManager toolBarManager) {
+
+ toolBarManager.add(worldComposite.getXViewer().getCustomizeAction());
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new OpenNewAtsWorldEditorAction(worldComposite));
+ toolBarManager.add(new OpenNewAtsWorldEditorSelectedAction(worldComposite));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new ExpandAllAction(worldComposite.getXViewer()));
+ toolBarManager.add(new CollapseAllAction(worldComposite.getXViewer()));
+ toolBarManager.add(new RefreshAction(worldComposite));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new NewAction());
+ toolBarManager.add(OseeUiActions.createBugAction(AtsPlugin.getInstance(), worldEditor, WorldEditor.EDITOR_ID,
+ "ATS World"));
+ toolBarManager.add(new Separator());
+
+ createDropDownMenuActions();
+ toolBarManager.add(new DropDownAction());
+ }
+
+ @Override
+ public Section createResultsSection(Composite body) {
+
+ resultsSection = toolkit.createSection(body, Section.NO_TITLE);
+ resultsSection.setText("Results");
+ resultsSection.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ resultsContainer = toolkit.createClientContainer(resultsSection, 1);
+
+ showReleaseMetricsLabel = toolkit.createLabel(resultsContainer, "");
+ showReleaseMetricsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ worldComposite = new WorldComposite(worldEditor, resultsContainer, SWT.BORDER);
+ toolkit.adapt(worldComposite);
+ return resultsSection;
+ }
+
+ @Override
+ public IDynamicWidgetLayoutListener getDynamicWidgetLayoutListener() throws OseeArgumentException {
+ if (worldEditor.getWorldEditorProvider() instanceof IWorldEditorParameterProvider) {
+ return ((IWorldEditorParameterProvider) worldEditor.getWorldEditorProvider()).getDynamicWidgetLayoutListener();
+ }
+ return null;
+ }
+
+ @Override
+ public Result isResearchSearchValid() throws OseeCoreException {
+ return worldEditor.isDirty() ? new Result("Changes un-saved. Save first.") : Result.TrueResult;
+ }
+
+ public void reSearch() throws OseeCoreException {
+ Result result = isResearchSearchValid();
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ reSearch(false);
+ }
+
+ /*
+ * Mainly for testing purposes
+ */
+ public void reSearch(boolean forcePend) throws OseeCoreException {
+ worldEditor.getWorldEditorProvider().run(worldEditor, SearchType.ReSearch, forcePend);
+ }
+
+ @Override
+ public String getXWidgetsXml() throws OseeCoreException {
+ if (worldEditor.getWorldEditorProvider() instanceof IWorldEditorParameterProvider) {
+ return ((IWorldEditorParameterProvider) worldEditor.getWorldEditorProvider()).getParameterXWidgetXml();
+ }
+ return null;
+ }
+
+ @Override
+ public void handleSearchButtonPressed() {
+ try {
+ reSearch();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public class DropDownAction extends Action implements IMenuCreator {
+ private Menu fMenu;
+
+ public DropDownAction() {
+ setText("Other");
+ setMenuCreator(this);
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
+ addKeyListener();
+ addSelectionListener();
+ }
+
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fMenu = new Menu(parent);
+ addActionToMenu(fMenu, selectionMetricsAction);
+ addActionToMenu(fMenu, filterCompletedAction);
+ addActionToMenu(fMenu, filterMyAssigneeAction);
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ addActionToMenu(fMenu, toAction);
+ addActionToMenu(fMenu, toGoal);
+ addActionToMenu(fMenu, toWorkFlow);
+ addActionToMenu(fMenu, toTask);
+ addActionToMenu(fMenu, toReview);
+
+ worldEditor.createToolBarPulldown(fMenu);
+
+ return fMenu;
+ }
+
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ @Override
+ public void run() {
+
+ }
+
+ /**
+ * Get's rid of the menu, because the menu hangs on to * the searches, etc.
+ */
+ void clear() {
+ dispose();
+ }
+
+ private void addKeyListener() {
+ Tree tree = worldComposite.getXViewer().getTree();
+ GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL);
+ gridData.heightHint = 100;
+ gridData.widthHint = 100;
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ worldComposite.getXViewer().getTree().addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent event) {
+ }
+
+ public void keyReleased(KeyEvent event) {
+ // if CTRL key is already pressed
+ if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
+ if (event.keyCode == 'a') {
+ worldComposite.getXViewer().getTree().setSelection(
+ worldComposite.getXViewer().getTree().getItems());
+ } else if (event.keyCode == 'x') {
+ selectionMetricsAction.setChecked(!selectionMetricsAction.isChecked());
+ selectionMetricsAction.run();
+ } else if (event.keyCode == 'f') {
+ filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
+ filterCompletedAction.run();
+ } else if (event.keyCode == 'g') {
+ filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
+ filterMyAssigneeAction.run();
+ } else if (event.keyCode == 'd') {
+ filterMyAssigneeAction.setChecked(!filterMyAssigneeAction.isChecked());
+ filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
+ filterCompletedAction.run();
+ filterMyAssigneeAction.run();
+ }
+ }
+
+ }
+ });
+ }
+ }
+
+ private void addSelectionListener() {
+ worldComposite.getXViewer().getTree().addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (selectionMetricsAction != null) {
+ if (selectionMetricsAction.isChecked()) {
+ selectionMetricsAction.run();
+ } else {
+ if (worldComposite != null) {
+ showReleaseMetricsLabel.setText("");
+ }
+ }
+ }
+ }
+ });
+ }
+
+ public void updateExtraInfoLine() throws OseeCoreException {
+ if (selectionMetricsAction != null && selectionMetricsAction.isChecked()) {
+ if (worldComposite.getXViewer() != null && worldComposite.getXViewer().getSelectedSMAArtifacts() != null && !worldComposite.getXViewer().getSelectedSMAArtifacts().isEmpty()) {
+ showReleaseMetricsLabel.setText(SMAMetrics.getEstRemainMetrics(
+ worldComposite.getXViewer().getSelectedSMAArtifacts(), null,
+ worldComposite.getXViewer().getSelectedSMAArtifacts().iterator().next().getManHrsPerDayPreference(),
+ null));
+ } else {
+ showReleaseMetricsLabel.setText("");
+ }
+ } else {
+ showReleaseMetricsLabel.setText("");
+ }
+ showReleaseMetricsLabel.getParent().layout();
+ }
+
+ protected void createDropDownMenuActions() {
+ try {
+ worldAssigneeFilter = new WorldAssigneeFilter();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ selectionMetricsAction = new Action("Show Release Metrics by Selection - Ctrl-X", Action.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ try {
+ updateExtraInfoLine();
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+ selectionMetricsAction.setToolTipText("Show Release Metrics by Selection - Ctrl-X");
+ selectionMetricsAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PAGE));
+
+ filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", Action.AS_CHECK_BOX) {
+
+ @Override
+ public void run() {
+ if (filterCompletedAction.isChecked()) {
+ worldComposite.getXViewer().addFilter(worldCompletedFilter);
+ } else {
+ worldComposite.getXViewer().removeFilter(worldCompletedFilter);
+ }
+ updateExtendedStatusString();
+ worldComposite.getXViewer().refresh();
+ }
+ };
+ filterCompletedAction.setToolTipText("Filter Out Completed/Cancelled - Ctrl-F");
+ filterCompletedAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GREEN_PLUS));
+
+ filterMyAssigneeAction = new Action("Filter My Assignee - Ctrl-G", Action.AS_CHECK_BOX) {
+
+ @Override
+ public void run() {
+ if (filterMyAssigneeAction.isChecked()) {
+ worldComposite.getXViewer().addFilter(worldAssigneeFilter);
+ } else {
+ worldComposite.getXViewer().removeFilter(worldAssigneeFilter);
+ }
+ updateExtendedStatusString();
+ worldComposite.getXViewer().refresh();
+ }
+ };
+ filterMyAssigneeAction.setToolTipText("Filter My Assignee - Ctrl-G");
+ filterMyAssigneeAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.USER));
+
+ toAction = new Action("Re-display as Actions", Action.AS_PUSH_BUTTON) {
+
+ @Override
+ public void run() {
+ redisplayAsAction();
+ }
+ };
+ toAction.setToolTipText("Re-display as Actions");
+ toAction.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.ACTION));
+
+ toGoal = new Action("Re-display as Goals", Action.AS_PUSH_BUTTON) {
+
+ @Override
+ public void run() {
+ redisplayAsGoals();
+ }
+ };
+ toGoal.setToolTipText("Re-display as Goals");
+ toGoal.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.GOAL));
+
+ toWorkFlow = new Action("Re-display as WorkFlows", Action.AS_PUSH_BUTTON) {
+
+ @Override
+ public void run() {
+ redisplayAsWorkFlow();
+ }
+ };
+ toWorkFlow.setToolTipText("Re-display as WorkFlows");
+ toWorkFlow.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.WORKFLOW));
+
+ toTask = new Action("Re-display as Tasks", Action.AS_PUSH_BUTTON) {
+
+ @Override
+ public void run() {
+ redisplayAsTask();
+ }
+ };
+ toTask.setToolTipText("Re-display as Tasks");
+ toTask.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.TASK));
+
+ toReview = new Action("Re-display as Reviews", Action.AS_PUSH_BUTTON) {
+
+ @Override
+ public void run() {
+ redisplayAsReviews();
+ }
+ };
+ toReview.setToolTipText("Re-display as Reviews");
+ toReview.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.REVIEW));
+
+ }
+
+ public void redisplayAsAction() {
+ final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
+ Job job = new Job("Re-display as Actions") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final Set<Artifact> arts = new HashSet<Artifact>();
+ for (Artifact art : artifacts) {
+ if (art instanceof ActionArtifact) {
+ arts.add(art);
+ } else if (art instanceof StateMachineArtifact) {
+ Artifact parentArt = ((StateMachineArtifact) art).getParentActionArtifact();
+ if (parentArt != null) {
+ arts.add(parentArt);
+ }
+ }
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), arts);
+ }
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job, true);
+ }
+
+ public void redisplayAsGoals() {
+ final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
+ Job job = new Job("Re-display as Goals") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final Set<Artifact> goals = new HashSet<Artifact>();
+ GoalArtifact.getGoals(artifacts, goals, true);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), goals);
+ }
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job, true);
+ }
+
+ public void redisplayAsWorkFlow() {
+ final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
+ Job job = new Job("Re-display as Workflows") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final Set<Artifact> arts = new HashSet<Artifact>();
+ for (Artifact art : artifacts) {
+ if (art instanceof ActionArtifact) {
+ arts.addAll(((ActionArtifact) art).getTeamWorkFlowArtifacts());
+ } else if (art instanceof StateMachineArtifact) {
+ Artifact parentArt = ((StateMachineArtifact) art).getParentTeamWorkflow();
+ if (parentArt != null) {
+ arts.add(parentArt);
+ }
+ }
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), arts);
+ }
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job, true);
+ }
+
+ public void redisplayAsTask() {
+ final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
+ Job job = new Job("Re-display as Tasks") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final Set<Artifact> arts = new HashSet<Artifact>();
+ for (Artifact art : artifacts) {
+ if (art instanceof ActionArtifact) {
+ for (TeamWorkFlowArtifact team : ((ActionArtifact) art).getTeamWorkFlowArtifacts()) {
+ arts.addAll(team.getTaskArtifacts());
+ }
+ } else if (art instanceof TaskableStateMachineArtifact) {
+ arts.addAll(((TaskableStateMachineArtifact) art).getTaskArtifacts());
+ }
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), arts);
+ }
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job, true);
+ }
+
+ public void redisplayAsReviews() {
+ final ArrayList<Artifact> artifacts = worldComposite.getXViewer().getLoadedArtifacts();
+ Job job = new Job("Re-display as Reviews") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ final Set<Artifact> arts = new HashSet<Artifact>();
+ for (Artifact art : artifacts) {
+ if (art instanceof ActionArtifact) {
+ for (TeamWorkFlowArtifact team : ((ActionArtifact) art).getTeamWorkFlowArtifacts()) {
+ arts.addAll(ReviewManager.getReviews(team));
+ }
+ } else if (art instanceof TeamWorkFlowArtifact) {
+ arts.addAll(ReviewManager.getReviews((TeamWorkFlowArtifact) art));
+ }
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ worldComposite.load(worldEditor.getWorldXWidgetActionPage().getCurrentTitleLabel(), arts);
+ }
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job, true);
+ }
+
+ public void updateExtendedStatusString() {
+ worldComposite.getXViewer().setExtendedStatusString(
+ //
+ (filterCompletedAction.isChecked() ? "[Complete/Cancel Filter]" : "") +
+ //
+ (filterMyAssigneeAction.isChecked() ? "[My Assignee Filter]" : ""));
+ }
+
+ @Override
+ public void handleSaveButtonPressed() {
+ try {
+ if (isSaveButtonAvailable() && (worldEditor.getWorldEditorProvider() instanceof IWorldEditorParameterProvider)) {
+ ((IWorldEditorParameterProvider) worldEditor.getWorldEditorProvider()).handleSaveButtonPressed();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public boolean isSaveButtonAvailable() {
+ try {
+ if (worldEditor.getWorldEditorProvider() instanceof IWorldEditorParameterProvider) {
+ return ((IWorldEditorParameterProvider) worldEditor.getWorldEditorProvider()).isSaveButtonAvailable();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java
index 3c910783bd2..011587df37b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/ActionableItemWorldSearchItem.java
@@ -1,228 +1,228 @@
-/*******************************************************************************
- * 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.ats.world.search;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.config.AtsCacheManager;
-import org.eclipse.osee.ats.util.AtsArtifactTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.widgets.dialog.ActionActionableItemListDialog;
-import org.eclipse.osee.framework.core.enums.Active;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-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.AbstractArtifactSearchCriteria;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.artifact.search.AttributeCriteria;
-import org.eclipse.osee.framework.skynet.core.artifact.search.Operator;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-
-/**
- * @author Donald G. Dunne
- */
-public class ActionableItemWorldSearchItem extends WorldUISearchItem {
-
- private Collection<ActionableItemArtifact> actionItems;
- private Set<ActionableItemArtifact> selectedActionItems;
- private boolean recurseChildren;
- private boolean selectedRecurseChildren; // Used to not corrupt original values
- private boolean showFinished;
- private boolean selectedShowFinished; // Used to not corrupt original values
- private boolean showAction;
- private boolean selectedShowAction; // Used to not corrupt original values
- private final Collection<String> actionItemNames;
-
- public ActionableItemWorldSearchItem(Collection<String> actionItemNames, String displayName, boolean showFinished, boolean recurseChildren, boolean showAction) {
- super(displayName, AtsImage.ACTIONABLE_ITEM);
- this.actionItemNames = actionItemNames;
- this.showFinished = showFinished;
- this.selectedShowFinished = showFinished; // Set as default in case UI is not used
- this.recurseChildren = recurseChildren;
- this.selectedRecurseChildren = recurseChildren; // Set as default in case UI is not used
- this.showAction = showAction;
- this.selectedShowAction = showAction;
- }
-
- public ActionableItemWorldSearchItem(String displayName, Collection<ActionableItemArtifact> actionItems, boolean showFinished, boolean recurseChildren, boolean showAction) {
- super(displayName, AtsImage.ACTIONABLE_ITEM);
- this.actionItemNames = null;
- this.actionItems = actionItems;
- this.showFinished = showFinished;
- this.recurseChildren = recurseChildren;
- this.showAction = showAction;
- }
-
- public ActionableItemWorldSearchItem(ActionableItemWorldSearchItem item) {
- super(item, AtsImage.ACTIONABLE_ITEM);
- this.actionItemNames = item.actionItemNames;
- this.actionItems = item.actionItems;
- this.showFinished = item.showFinished;
- this.recurseChildren = item.recurseChildren;
- this.showAction = item.showAction;
- }
-
- public Collection<String> getProductSearchName() {
- if (actionItemNames != null)
- return actionItemNames;
- else if (actionItems != null)
- return Artifacts.artNames(actionItems);
- else if (selectedActionItems != null) return Artifacts.artNames(selectedActionItems);
- return new ArrayList<String>();
- }
-
- @Override
- public String getSelectedName(SearchType searchType) throws OseeCoreException {
- return String.format("%s - %s", super.getSelectedName(searchType), getProductSearchName());
- }
-
- public void getActionableItems() throws OseeCoreException {
- if (actionItemNames != null && actionItems == null) {
- actionItems = new HashSet<ActionableItemArtifact>();
- for (String actionItemName : actionItemNames) {
- ActionableItemArtifact aia =
- (ActionableItemArtifact) AtsCacheManager.getSoleArtifactByName(
- ArtifactTypeManager.getType(AtsArtifactTypes.ActionableItem), actionItemName);
- if (aia != null) {
- actionItems.add(aia);
- }
- }
- }
- }
-
- /**
- * @return All directly specified teamDefs plus if recurse, will get all children
- */
- private Set<ActionableItemArtifact> getSearchActionableItems() throws OseeCoreException {
- getActionableItems();
- Set<ActionableItemArtifact> srchTeamDefs = new HashSet<ActionableItemArtifact>();
- for (ActionableItemArtifact actionableItem : (actionItems != null ? actionItems : selectedActionItems))
- srchTeamDefs.add(actionableItem);
- if (selectedRecurseChildren) {
- for (ActionableItemArtifact actionableItem : (actionItems != null ? actionItems : selectedActionItems)) {
- Artifacts.getChildrenOfType(actionableItem, srchTeamDefs, ActionableItemArtifact.class, true);
- }
- }
- return srchTeamDefs;
- }
-
- @Override
- public Collection<Artifact> performSearch(SearchType searchType) throws OseeCoreException {
- Set<ActionableItemArtifact> items = getSearchActionableItems();
- List<String> actionItemGuids = new ArrayList<String>(items.size());
- for (ActionableItemArtifact ai : items) {
- actionItemGuids.add(ai.getGuid());
- }
- List<AbstractArtifactSearchCriteria> criteria = new ArrayList<AbstractArtifactSearchCriteria>();
-
- criteria.add(new AttributeCriteria(ATSAttributes.ACTIONABLE_ITEM_GUID_ATTRIBUTE.getStoreName(), actionItemGuids));
- // exclude completed or canceled
- if (!selectedShowFinished) {
- List<String> cancelOrComplete = new ArrayList<String>(2);
- cancelOrComplete.add(DefaultTeamState.Cancelled.name() + ";;;");
- cancelOrComplete.add(DefaultTeamState.Completed.name() + ";;;");
- criteria.add(new AttributeCriteria(ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName(), cancelOrComplete,
- Operator.NOT_EQUAL));
- }
- Collection<Artifact> artifacts =
- ArtifactQuery.getArtifactListFromCriteria(AtsUtil.getAtsBranch(), 1000, criteria);
- // show as actions
- if (selectedShowAction) {
- Set<Artifact> arts = new HashSet<Artifact>();
- for (Artifact art : artifacts) {
- if (art instanceof ActionArtifact) {
- arts.add(art);
- } else if (art instanceof StateMachineArtifact) {
- Artifact parentArt = ((StateMachineArtifact) art).getParentActionArtifact();
- if (parentArt != null) {
- arts.add(parentArt);
- }
- }
- }
- return arts;
- } else
- return artifacts;
- }
-
- @Override
- public void performUI(SearchType searchType) throws OseeCoreException {
- super.performUI(searchType);
- if (actionItemNames != null) return;
- if (actionItems != null) return;
- if (searchType == SearchType.ReSearch && selectedActionItems != null) return;
- ActionActionableItemListDialog diag = new ActionActionableItemListDialog(Active.Both);
- diag.setShowFinished(showFinished);
- diag.setRecurseChildren(recurseChildren);
- diag.setShowAction(showAction);
- int result = diag.open();
- if (result == 0) {
- selectedShowFinished = diag.isShowFinished();
- selectedRecurseChildren = diag.isRecurseChildren();
- selectedShowAction = diag.isShowAction();
- if (selectedActionItems == null)
- selectedActionItems = new HashSet<ActionableItemArtifact>();
- else
- selectedActionItems.clear();
- for (Object obj : diag.getResult())
- selectedActionItems.add((ActionableItemArtifact) obj);
- return;
- }
- cancelled = true;
- }
-
- /**
- * @param showFinished The showFinished to set.
- */
- public void setShowFinished(boolean showFinished) {
- this.showFinished = showFinished;
- }
-
- /**
- * @return the recurseChildren
- */
- public boolean isRecurseChildren() {
- return recurseChildren;
- }
-
- /**
- * @param recurseChildren the recurseChildren to set
- */
- public void setRecurseChildren(boolean recurseChildren) {
- this.recurseChildren = recurseChildren;
- }
-
- public void setShowAction(boolean showAction) {
- this.showAction = showAction;
- }
-
- /**
- * @param selectedActionItems the selectedActionItems to set
- */
- public void setSelectedActionItems(Set<ActionableItemArtifact> selectedActionItems) {
- this.selectedActionItems = selectedActionItems;
- }
-
- @Override
- public WorldUISearchItem copy() {
- return new ActionableItemWorldSearchItem(this);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world.search;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.config.AtsCacheManager;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.widgets.dialog.ActionActionableItemListDialog;
+import org.eclipse.osee.framework.core.enums.Active;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+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.AbstractArtifactSearchCriteria;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.artifact.search.AttributeCriteria;
+import org.eclipse.osee.framework.skynet.core.artifact.search.Operator;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ActionableItemWorldSearchItem extends WorldUISearchItem {
+
+ private Collection<ActionableItemArtifact> actionItems;
+ private Set<ActionableItemArtifact> selectedActionItems;
+ private boolean recurseChildren;
+ private boolean selectedRecurseChildren; // Used to not corrupt original values
+ private boolean showFinished;
+ private boolean selectedShowFinished; // Used to not corrupt original values
+ private boolean showAction;
+ private boolean selectedShowAction; // Used to not corrupt original values
+ private final Collection<String> actionItemNames;
+
+ public ActionableItemWorldSearchItem(Collection<String> actionItemNames, String displayName, boolean showFinished, boolean recurseChildren, boolean showAction) {
+ super(displayName, AtsImage.ACTIONABLE_ITEM);
+ this.actionItemNames = actionItemNames;
+ this.showFinished = showFinished;
+ this.selectedShowFinished = showFinished; // Set as default in case UI is not used
+ this.recurseChildren = recurseChildren;
+ this.selectedRecurseChildren = recurseChildren; // Set as default in case UI is not used
+ this.showAction = showAction;
+ this.selectedShowAction = showAction;
+ }
+
+ public ActionableItemWorldSearchItem(String displayName, Collection<ActionableItemArtifact> actionItems, boolean showFinished, boolean recurseChildren, boolean showAction) {
+ super(displayName, AtsImage.ACTIONABLE_ITEM);
+ this.actionItemNames = null;
+ this.actionItems = actionItems;
+ this.showFinished = showFinished;
+ this.recurseChildren = recurseChildren;
+ this.showAction = showAction;
+ }
+
+ public ActionableItemWorldSearchItem(ActionableItemWorldSearchItem item) {
+ super(item, AtsImage.ACTIONABLE_ITEM);
+ this.actionItemNames = item.actionItemNames;
+ this.actionItems = item.actionItems;
+ this.showFinished = item.showFinished;
+ this.recurseChildren = item.recurseChildren;
+ this.showAction = item.showAction;
+ }
+
+ public Collection<String> getProductSearchName() {
+ if (actionItemNames != null)
+ return actionItemNames;
+ else if (actionItems != null)
+ return Artifacts.artNames(actionItems);
+ else if (selectedActionItems != null) return Artifacts.artNames(selectedActionItems);
+ return new ArrayList<String>();
+ }
+
+ @Override
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
+ return String.format("%s - %s", super.getSelectedName(searchType), getProductSearchName());
+ }
+
+ public void getActionableItems() throws OseeCoreException {
+ if (actionItemNames != null && actionItems == null) {
+ actionItems = new HashSet<ActionableItemArtifact>();
+ for (String actionItemName : actionItemNames) {
+ ActionableItemArtifact aia =
+ (ActionableItemArtifact) AtsCacheManager.getSoleArtifactByName(
+ ArtifactTypeManager.getType(AtsArtifactTypes.ActionableItem), actionItemName);
+ if (aia != null) {
+ actionItems.add(aia);
+ }
+ }
+ }
+ }
+
+ /**
+ * @return All directly specified teamDefs plus if recurse, will get all children
+ */
+ private Set<ActionableItemArtifact> getSearchActionableItems() throws OseeCoreException {
+ getActionableItems();
+ Set<ActionableItemArtifact> srchTeamDefs = new HashSet<ActionableItemArtifact>();
+ for (ActionableItemArtifact actionableItem : (actionItems != null ? actionItems : selectedActionItems))
+ srchTeamDefs.add(actionableItem);
+ if (selectedRecurseChildren) {
+ for (ActionableItemArtifact actionableItem : (actionItems != null ? actionItems : selectedActionItems)) {
+ Artifacts.getChildrenOfType(actionableItem, srchTeamDefs, ActionableItemArtifact.class, true);
+ }
+ }
+ return srchTeamDefs;
+ }
+
+ @Override
+ public Collection<Artifact> performSearch(SearchType searchType) throws OseeCoreException {
+ Set<ActionableItemArtifact> items = getSearchActionableItems();
+ List<String> actionItemGuids = new ArrayList<String>(items.size());
+ for (ActionableItemArtifact ai : items) {
+ actionItemGuids.add(ai.getGuid());
+ }
+ List<AbstractArtifactSearchCriteria> criteria = new ArrayList<AbstractArtifactSearchCriteria>();
+
+ criteria.add(new AttributeCriteria(ATSAttributes.ACTIONABLE_ITEM_GUID_ATTRIBUTE.getStoreName(), actionItemGuids));
+ // exclude completed or canceled
+ if (!selectedShowFinished) {
+ List<String> cancelOrComplete = new ArrayList<String>(2);
+ cancelOrComplete.add(DefaultTeamState.Cancelled.name() + ";;;");
+ cancelOrComplete.add(DefaultTeamState.Completed.name() + ";;;");
+ criteria.add(new AttributeCriteria(ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName(), cancelOrComplete,
+ Operator.NOT_EQUAL));
+ }
+ Collection<Artifact> artifacts =
+ ArtifactQuery.getArtifactListFromCriteria(AtsUtil.getAtsBranch(), 1000, criteria);
+ // show as actions
+ if (selectedShowAction) {
+ Set<Artifact> arts = new HashSet<Artifact>();
+ for (Artifact art : artifacts) {
+ if (art instanceof ActionArtifact) {
+ arts.add(art);
+ } else if (art instanceof StateMachineArtifact) {
+ Artifact parentArt = ((StateMachineArtifact) art).getParentActionArtifact();
+ if (parentArt != null) {
+ arts.add(parentArt);
+ }
+ }
+ }
+ return arts;
+ } else
+ return artifacts;
+ }
+
+ @Override
+ public void performUI(SearchType searchType) throws OseeCoreException {
+ super.performUI(searchType);
+ if (actionItemNames != null) return;
+ if (actionItems != null) return;
+ if (searchType == SearchType.ReSearch && selectedActionItems != null) return;
+ ActionActionableItemListDialog diag = new ActionActionableItemListDialog(Active.Both);
+ diag.setShowFinished(showFinished);
+ diag.setRecurseChildren(recurseChildren);
+ diag.setShowAction(showAction);
+ int result = diag.open();
+ if (result == 0) {
+ selectedShowFinished = diag.isShowFinished();
+ selectedRecurseChildren = diag.isRecurseChildren();
+ selectedShowAction = diag.isShowAction();
+ if (selectedActionItems == null)
+ selectedActionItems = new HashSet<ActionableItemArtifact>();
+ else
+ selectedActionItems.clear();
+ for (Object obj : diag.getResult())
+ selectedActionItems.add((ActionableItemArtifact) obj);
+ return;
+ }
+ cancelled = true;
+ }
+
+ /**
+ * @param showFinished The showFinished to set.
+ */
+ public void setShowFinished(boolean showFinished) {
+ this.showFinished = showFinished;
+ }
+
+ /**
+ * @return the recurseChildren
+ */
+ public boolean isRecurseChildren() {
+ return recurseChildren;
+ }
+
+ /**
+ * @param recurseChildren the recurseChildren to set
+ */
+ public void setRecurseChildren(boolean recurseChildren) {
+ this.recurseChildren = recurseChildren;
+ }
+
+ public void setShowAction(boolean showAction) {
+ this.showAction = showAction;
+ }
+
+ /**
+ * @param selectedActionItems the selectedActionItems to set
+ */
+ public void setSelectedActionItems(Set<ActionableItemArtifact> selectedActionItems) {
+ this.selectedActionItems = selectedActionItems;
+ }
+
+ @Override
+ public WorldUISearchItem copy() {
+ return new ActionableItemWorldSearchItem(this);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GroupWorldSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GroupWorldSearchItem.java
index cf1e7509e9a..ff855edcae4 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GroupWorldSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/GroupWorldSearchItem.java
@@ -1,123 +1,123 @@
-/*******************************************************************************
- * 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.ats.world.search;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.UniversalGroup;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.GroupListDialog;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Donald G. Dunne
- */
-public class GroupWorldSearchItem extends WorldUISearchItem {
-
- private Artifact group;
- private Artifact selectedGroup;
- private String groupName;
- private final Branch branch;
-
- public GroupWorldSearchItem(String displayName, String groupName, Branch branch) {
- super(displayName, FrameworkImage.GROUP);
- this.groupName = groupName;
- this.branch = branch;
- }
-
- public GroupWorldSearchItem(Artifact group) {
- super("Group Search", FrameworkImage.GROUP);
- this.group = group;
- this.branch = group.getBranch();
- }
-
- public GroupWorldSearchItem(Branch branch) {
- this("Group Search", null, branch);
- }
-
- public GroupWorldSearchItem(GroupWorldSearchItem groupWorldSearchItem, int toDifferentiateFromBranch) {
- super(groupWorldSearchItem, FrameworkImage.GROUP);
- this.group = groupWorldSearchItem.group;
- this.groupName = groupWorldSearchItem.groupName;
- this.selectedGroup = groupWorldSearchItem.selectedGroup;
- this.branch = groupWorldSearchItem.branch;
- }
-
- public String getGroupSearchName() {
- if (group != null)
- return group.getName();
- else if (selectedGroup != null)
- return selectedGroup.getName();
- else if (groupName != null) return groupName;
- return "";
- }
-
- @Override
- public String getSelectedName(SearchType searchType) throws OseeCoreException {
- return String.format("Group Search - %s", getGroupSearchName());
- }
-
- public void getProduct() throws OseeCoreException {
- if (groupName == null) return;
- if (group == null && branch != null) group = UniversalGroup.getGroups(groupName, branch).iterator().next();
- if (group == null) throw new OseeArgumentException("Can't Find Universal Group for " + getName());
- }
-
- @Override
- public Collection<Artifact> performSearch(SearchType searchType) throws OseeCoreException {
- getProduct();
- if (getSearchGroup() == null) return EMPTY_SET;
- Collection<Artifact> arts =
- getSearchGroup().getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members);
- if (cancelled) return EMPTY_SET;
- return arts;
- }
-
- private Artifact getSearchGroup() {
- if (group != null) return group;
- if (selectedGroup != null) return selectedGroup;
- return null;
- }
-
- @Override
- public void performUI(SearchType searchType) throws OseeCoreException {
- super.performUI(searchType);
- if (groupName != null) return;
- if (group != null) return;
- if (searchType == SearchType.ReSearch && selectedGroup != null) return;
- GroupListDialog gld = new GroupListDialog(Displays.getActiveShell());
- int result = gld.open();
- if (result == 0) {
- selectedGroup = gld.getSelection();
- return;
- } else {
- selectedGroup = null;
- cancelled = true;
- }
- }
-
- /**
- * @param selectedGroup the selectedGroup to set
- */
- public void setSelectedGroup(Artifact selectedGroup) {
- this.selectedGroup = selectedGroup;
- }
-
- @Override
- public WorldUISearchItem copy() {
- return new GroupWorldSearchItem(this, 0);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world.search;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.UniversalGroup;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.GroupListDialog;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class GroupWorldSearchItem extends WorldUISearchItem {
+
+ private Artifact group;
+ private Artifact selectedGroup;
+ private String groupName;
+ private final Branch branch;
+
+ public GroupWorldSearchItem(String displayName, String groupName, Branch branch) {
+ super(displayName, FrameworkImage.GROUP);
+ this.groupName = groupName;
+ this.branch = branch;
+ }
+
+ public GroupWorldSearchItem(Artifact group) {
+ super("Group Search", FrameworkImage.GROUP);
+ this.group = group;
+ this.branch = group.getBranch();
+ }
+
+ public GroupWorldSearchItem(Branch branch) {
+ this("Group Search", null, branch);
+ }
+
+ public GroupWorldSearchItem(GroupWorldSearchItem groupWorldSearchItem, int toDifferentiateFromBranch) {
+ super(groupWorldSearchItem, FrameworkImage.GROUP);
+ this.group = groupWorldSearchItem.group;
+ this.groupName = groupWorldSearchItem.groupName;
+ this.selectedGroup = groupWorldSearchItem.selectedGroup;
+ this.branch = groupWorldSearchItem.branch;
+ }
+
+ public String getGroupSearchName() {
+ if (group != null)
+ return group.getName();
+ else if (selectedGroup != null)
+ return selectedGroup.getName();
+ else if (groupName != null) return groupName;
+ return "";
+ }
+
+ @Override
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
+ return String.format("Group Search - %s", getGroupSearchName());
+ }
+
+ public void getProduct() throws OseeCoreException {
+ if (groupName == null) return;
+ if (group == null && branch != null) group = UniversalGroup.getGroups(groupName, branch).iterator().next();
+ if (group == null) throw new OseeArgumentException("Can't Find Universal Group for " + getName());
+ }
+
+ @Override
+ public Collection<Artifact> performSearch(SearchType searchType) throws OseeCoreException {
+ getProduct();
+ if (getSearchGroup() == null) return EMPTY_SET;
+ Collection<Artifact> arts =
+ getSearchGroup().getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members);
+ if (cancelled) return EMPTY_SET;
+ return arts;
+ }
+
+ private Artifact getSearchGroup() {
+ if (group != null) return group;
+ if (selectedGroup != null) return selectedGroup;
+ return null;
+ }
+
+ @Override
+ public void performUI(SearchType searchType) throws OseeCoreException {
+ super.performUI(searchType);
+ if (groupName != null) return;
+ if (group != null) return;
+ if (searchType == SearchType.ReSearch && selectedGroup != null) return;
+ GroupListDialog gld = new GroupListDialog(Displays.getActiveShell());
+ int result = gld.open();
+ if (result == 0) {
+ selectedGroup = gld.getSelection();
+ return;
+ } else {
+ selectedGroup = null;
+ cancelled = true;
+ }
+ }
+
+ /**
+ * @param selectedGroup the selectedGroup to set
+ */
+ public void setSelectedGroup(Artifact selectedGroup) {
+ this.selectedGroup = selectedGroup;
+ }
+
+ @Override
+ public WorldUISearchItem copy() {
+ return new GroupWorldSearchItem(this, 0);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/MultipleHridSearchData.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/MultipleHridSearchData.java
index ef874218ddc..bf10302470c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/MultipleHridSearchData.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/MultipleHridSearchData.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.world.search;
-
+package org.eclipse.osee.ats.world.search;
+
import java.util.ArrayList;
import java.util.List;
import org.eclipse.osee.ats.util.AtsEditor;
@@ -17,95 +17,95 @@ import org.eclipse.osee.ats.world.IWorldEditorConsumer;
import org.eclipse.osee.ats.world.WorldEditor;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Donald G. Dunne
- */
-public class MultipleHridSearchData implements IWorldEditorConsumer {
- private String enteredIds = "";
- private List<String> ids = new ArrayList<String>();
- private boolean includeArtIds;
- private Branch branch;
- private String name;
- private WorldEditor worldEditor;
- private AtsEditor atsEditor;
-
- public MultipleHridSearchData(String name, AtsEditor atsEditor) {
- this.name = name;
- this.atsEditor = atsEditor;
- }
-
- public MultipleHridSearchData(String name, AtsEditor atsEditor, String enteredIds, List<String> ids, boolean includeArtIds, Branch branch) {
- this(name, atsEditor);
- this.ids = ids;
- this.includeArtIds = includeArtIds;
- this.branch = branch;
- name = enteredIds;
- }
-
- public boolean hasValidInput() {
- return Strings.isValid(enteredIds);
- }
-
- public boolean isIncludeArtIds() {
- return includeArtIds;
- }
-
- public String getEnteredIds() {
- return enteredIds;
- }
-
- public List<String> getIds() {
- return ids;
- }
-
- public Branch getBranchForIncludeArtIds() {
- return branch;
- }
-
- public Branch getBranch() {
- return branch;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public void setWorldEditor(WorldEditor worldEditor) {
- this.worldEditor = worldEditor;
- }
-
- public WorldEditor getWorldEditor() {
- return worldEditor;
- }
-
- public void setEnteredIds(String enteredIds) {
- this.enteredIds = enteredIds;
- }
-
- public void setIds(List<String> ids) {
- this.ids = ids;
- }
-
- public void setIncludeArtIds(boolean includeArtIds) {
- this.includeArtIds = includeArtIds;
- }
-
- public void setBranch(Branch branch) {
- this.branch = branch;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public AtsEditor getAtsEditor() {
- return atsEditor;
- }
-
- public void setAtsEditor(AtsEditor atsEditor) {
- this.atsEditor = atsEditor;
- }
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class MultipleHridSearchData implements IWorldEditorConsumer {
+ private String enteredIds = "";
+ private List<String> ids = new ArrayList<String>();
+ private boolean includeArtIds;
+ private Branch branch;
+ private String name;
+ private WorldEditor worldEditor;
+ private AtsEditor atsEditor;
+
+ public MultipleHridSearchData(String name, AtsEditor atsEditor) {
+ this.name = name;
+ this.atsEditor = atsEditor;
+ }
+
+ public MultipleHridSearchData(String name, AtsEditor atsEditor, String enteredIds, List<String> ids, boolean includeArtIds, Branch branch) {
+ this(name, atsEditor);
+ this.ids = ids;
+ this.includeArtIds = includeArtIds;
+ this.branch = branch;
+ name = enteredIds;
+ }
+
+ public boolean hasValidInput() {
+ return Strings.isValid(enteredIds);
+ }
+
+ public boolean isIncludeArtIds() {
+ return includeArtIds;
+ }
+
+ public String getEnteredIds() {
+ return enteredIds;
+ }
+
+ public List<String> getIds() {
+ return ids;
+ }
+
+ public Branch getBranchForIncludeArtIds() {
+ return branch;
+ }
+
+ public Branch getBranch() {
+ return branch;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setWorldEditor(WorldEditor worldEditor) {
+ this.worldEditor = worldEditor;
+ }
+
+ public WorldEditor getWorldEditor() {
+ return worldEditor;
+ }
+
+ public void setEnteredIds(String enteredIds) {
+ this.enteredIds = enteredIds;
+ }
+
+ public void setIds(List<String> ids) {
+ this.ids = ids;
+ }
+
+ public void setIncludeArtIds(boolean includeArtIds) {
+ this.includeArtIds = includeArtIds;
+ }
+
+ public void setBranch(Branch branch) {
+ this.branch = branch;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public AtsEditor getAtsEditor() {
+ return atsEditor;
+ }
+
+ public void setAtsEditor(AtsEditor atsEditor) {
+ this.atsEditor = atsEditor;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/NextVersionSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/NextVersionSearchItem.java
index 3e844a66e6b..0d94a9f2bdb 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/NextVersionSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/NextVersionSearchItem.java
@@ -1,140 +1,140 @@
-/*******************************************************************************
- * 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.ats.world.search;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.AtsRelationTypes;
-import org.eclipse.osee.ats.util.widgets.dialog.TeamDefinitionDialog;
-import org.eclipse.osee.framework.core.enums.Active;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-
-/**
- * @author Donald G. Dunne
- */
-public class NextVersionSearchItem extends WorldUISearchItem {
-
- private final TeamDefinitionArtifact teamDefHoldingVersions;
- private TeamDefinitionArtifact selectedTeamDef;
- private VersionArtifact selectedVersionArt;
-
- public NextVersionSearchItem(TeamDefinitionArtifact teamDefHoldingVersions, LoadView loadView) {
- this(null, teamDefHoldingVersions, loadView);
- }
-
- public NextVersionSearchItem(String name, TeamDefinitionArtifact teamDefHoldingVersions, LoadView loadView) {
- super(name != null ? name : "Workflows Targeted-For Next Version", loadView, FrameworkImage.VERSION);
- this.teamDefHoldingVersions = teamDefHoldingVersions;
- }
-
- public NextVersionSearchItem(NextVersionSearchItem nextVersionSearchItem) {
- super(nextVersionSearchItem, FrameworkImage.VERSION);
- this.teamDefHoldingVersions = nextVersionSearchItem.teamDefHoldingVersions;
- this.selectedTeamDef = nextVersionSearchItem.selectedTeamDef;
- }
-
- @Override
- public String getSelectedName(SearchType searchType) throws OseeCoreException {
- String name = super.getName();
- TeamDefinitionArtifact teamDef = getTeamDefinition(searchType);
- try {
- if (teamDef != null) {
- name += " - " + teamDef.getName();
- selectedVersionArt = teamDef.getNextReleaseVersion();
- name += selectedVersionArt != null ? " - " + selectedVersionArt.getName() : "";
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return "Exception Occurred - See Log - " + ex.getLocalizedMessage();
- }
- return name;
- }
-
- private TeamDefinitionArtifact getTeamDefinition(SearchType searchType) {
- if (teamDefHoldingVersions != null) {
- return teamDefHoldingVersions;
- }
- return selectedTeamDef;
- }
-
- @Override
- public Collection<Artifact> performSearch(SearchType searchType) throws OseeCoreException {
- if (isCancelled()) {
- return EMPTY_SET;
- }
- if (getTeamDefinition(searchType).getNextReleaseVersion() == null) {
- AWorkbench.popup("ERROR", "No version marked as Next Release for \"" + getTeamDefinition(searchType) + "\"");
- return EMPTY_SET;
- }
- List<Artifact> arts =
- getTeamDefinition(searchType).getNextReleaseVersion().getRelatedArtifacts(
- AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow);
- if (isCancelled()) {
- return EMPTY_SET;
- }
- return arts;
- }
-
- @Override
- public void performUI(SearchType searchType) throws OseeCoreException {
- super.performUI(searchType);
- if (teamDefHoldingVersions != null) {
- return;
- }
- if (searchType == SearchType.ReSearch && selectedTeamDef != null) {
- return;
- }
- try {
- TeamDefinitionDialog ld = new TeamDefinitionDialog("Select Team", "Select Team");
- ld.setInput(TeamDefinitionArtifact.getTeamReleaseableDefinitions(Active.Active));
- int result = ld.open();
- if (result == 0) {
- selectedTeamDef = (TeamDefinitionArtifact) ld.getResult()[0];
- return;
- } else {
- cancelled = true;
- }
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- cancelled = true;
- }
-
- /**
- * @param selectedTeamDef the selectedTeamDef to set
- */
- public void setSelectedTeamDef(TeamDefinitionArtifact selectedTeamDef) {
- this.selectedTeamDef = selectedTeamDef;
- }
-
- @Override
- public WorldUISearchItem copy() {
- return new NextVersionSearchItem(this);
- }
-
- /**
- * @return the selectedVersionArt
- */
- public VersionArtifact getSelectedVersionArt() {
- return selectedVersionArt;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world.search;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsRelationTypes;
+import org.eclipse.osee.ats.util.widgets.dialog.TeamDefinitionDialog;
+import org.eclipse.osee.framework.core.enums.Active;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NextVersionSearchItem extends WorldUISearchItem {
+
+ private final TeamDefinitionArtifact teamDefHoldingVersions;
+ private TeamDefinitionArtifact selectedTeamDef;
+ private VersionArtifact selectedVersionArt;
+
+ public NextVersionSearchItem(TeamDefinitionArtifact teamDefHoldingVersions, LoadView loadView) {
+ this(null, teamDefHoldingVersions, loadView);
+ }
+
+ public NextVersionSearchItem(String name, TeamDefinitionArtifact teamDefHoldingVersions, LoadView loadView) {
+ super(name != null ? name : "Workflows Targeted-For Next Version", loadView, FrameworkImage.VERSION);
+ this.teamDefHoldingVersions = teamDefHoldingVersions;
+ }
+
+ public NextVersionSearchItem(NextVersionSearchItem nextVersionSearchItem) {
+ super(nextVersionSearchItem, FrameworkImage.VERSION);
+ this.teamDefHoldingVersions = nextVersionSearchItem.teamDefHoldingVersions;
+ this.selectedTeamDef = nextVersionSearchItem.selectedTeamDef;
+ }
+
+ @Override
+ public String getSelectedName(SearchType searchType) throws OseeCoreException {
+ String name = super.getName();
+ TeamDefinitionArtifact teamDef = getTeamDefinition(searchType);
+ try {
+ if (teamDef != null) {
+ name += " - " + teamDef.getName();
+ selectedVersionArt = teamDef.getNextReleaseVersion();
+ name += selectedVersionArt != null ? " - " + selectedVersionArt.getName() : "";
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return "Exception Occurred - See Log - " + ex.getLocalizedMessage();
+ }
+ return name;
+ }
+
+ private TeamDefinitionArtifact getTeamDefinition(SearchType searchType) {
+ if (teamDefHoldingVersions != null) {
+ return teamDefHoldingVersions;
+ }
+ return selectedTeamDef;
+ }
+
+ @Override
+ public Collection<Artifact> performSearch(SearchType searchType) throws OseeCoreException {
+ if (isCancelled()) {
+ return EMPTY_SET;
+ }
+ if (getTeamDefinition(searchType).getNextReleaseVersion() == null) {
+ AWorkbench.popup("ERROR", "No version marked as Next Release for \"" + getTeamDefinition(searchType) + "\"");
+ return EMPTY_SET;
+ }
+ List<Artifact> arts =
+ getTeamDefinition(searchType).getNextReleaseVersion().getRelatedArtifacts(
+ AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow);
+ if (isCancelled()) {
+ return EMPTY_SET;
+ }
+ return arts;
+ }
+
+ @Override
+ public void performUI(SearchType searchType) throws OseeCoreException {
+ super.performUI(searchType);
+ if (teamDefHoldingVersions != null) {
+ return;
+ }
+ if (searchType == SearchType.ReSearch && selectedTeamDef != null) {
+ return;
+ }
+ try {
+ TeamDefinitionDialog ld = new TeamDefinitionDialog("Select Team", "Select Team");
+ ld.setInput(TeamDefinitionArtifact.getTeamReleaseableDefinitions(Active.Active));
+ int result = ld.open();
+ if (result == 0) {
+ selectedTeamDef = (TeamDefinitionArtifact) ld.getResult()[0];
+ return;
+ } else {
+ cancelled = true;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ cancelled = true;
+ }
+
+ /**
+ * @param selectedTeamDef the selectedTeamDef to set
+ */
+ public void setSelectedTeamDef(TeamDefinitionArtifact selectedTeamDef) {
+ this.selectedTeamDef = selectedTeamDef;
+ }
+
+ @Override
+ public WorldUISearchItem copy() {
+ return new NextVersionSearchItem(this);
+ }
+
+ /**
+ * @return the selectedVersionArt
+ */
+ public VersionArtifact getSelectedVersionArt() {
+ return selectedVersionArt;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java
index 039a2feecc4..24ecf63cf17 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/TaskSearchWorldSearchItem.java
@@ -1,373 +1,373 @@
-/*******************************************************************************
- * 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.ats.world.search;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact.VersionReleaseType;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.task.ITaskEditorProvider;
-import org.eclipse.osee.ats.task.TaskEditor;
-import org.eclipse.osee.ats.task.TaskEditorParameterSearchItem;
-import org.eclipse.osee.ats.util.AtsRelationTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.widgets.XHyperlabelTeamDefinitionSelection;
-import org.eclipse.osee.ats.world.search.TeamWorldSearchItem.ReleasedOption;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
-import org.eclipse.osee.framework.ui.skynet.widgets.XCombo;
-import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlabelGroupSelection;
-import org.eclipse.osee.framework.ui.skynet.widgets.XMembersCombo;
-import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Donald G. Dunne
- */
-public class TaskSearchWorldSearchItem extends TaskEditorParameterSearchItem {
-
- private XMembersCombo assigneeCombo;
- private XCheckBox includeCompletedCancelledCheckbox;
- private XHyperlabelTeamDefinitionSelection teamCombo = null;
- private XHyperlabelGroupSelection groupWidget = null;
- private XCombo versionCombo = null;
-
- /**
- * @param worldSearchItem
- */
- public TaskSearchWorldSearchItem(WorldSearchItem worldSearchItem) {
- super(worldSearchItem);
- }
-
- /**
- * @param name
- * @param loadView
- */
- public TaskSearchWorldSearchItem() {
- super("Task Search");
- }
-
- @Override
- public String getParameterXWidgetXml() throws OseeCoreException {
- return "<xWidgets>" +
- //
- "<XWidget xwidgetType=\"XHyperlabelTeamDefinitionSelection\" displayName=\"Team Definitions(s)\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget xwidgetType=\"XCombo()\" beginComposite=\"8\" displayName=\"Version\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget xwidgetType=\"XCheckBox\" displayName=\"Include Completed/Cancelled\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget xwidgetType=\"XHyperlabelGroupSelection\" displayName=\"Group(s)\" horizontalLabel=\"true\"/>" +
- //
- "<XWidget xwidgetType=\"XMembersCombo\" displayName=\"Assignee\" horizontalLabel=\"true\"/>" +
- //
- "</xWidgets>";
- }
-
- @Override
- public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
- List<Artifact> workflows = new ArrayList<Artifact>();
- Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
- VersionArtifact verArt = getSelectedVersionArtifact();
- Collection<Artifact> groups = getSelectedGroups();
- User user = getSelectedUser();
-
- // If only user selected, handle that case separately
- if (verArt == null && teamDefs.isEmpty() && user != null) {
- return handleOnlyUserSelected();
- } // If version specified, get workflows from targeted relation
- if (verArt != null) {
- for (Artifact art : verArt.getRelatedArtifacts(AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow)) {
- if (teamDefs.isEmpty()) {
- workflows.add(art);
- }
- // Filter by team def if specified
- else if (teamDefs.contains((((TeamWorkFlowArtifact) art).getTeamDefinition()))) {
- workflows.add(art);
- }
- }
- }
- // Else, get workflows from teamdefs
- else if (teamDefs.size() > 0) {
- TeamWorldSearchItem teamWorldSearchItem =
- new TeamWorldSearchItem("", teamDefs, true, false, false, null, null, ReleasedOption.Both);
- workflows.addAll(teamWorldSearchItem.performSearchGetResults(false, SearchType.Search));
- } else if (groups.size() > 0) {
- Set<TaskArtifact> taskArts = new HashSet<TaskArtifact>();
- for (Artifact groupArt : groups) {
- for (Artifact art : groupArt.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members)) {
- if (art instanceof TaskArtifact) {
- taskArts.add((TaskArtifact) art);
- } else if (art instanceof TaskableStateMachineArtifact) {
- taskArts.addAll(((TaskableStateMachineArtifact) art).getTaskArtifacts());
- }
- }
- }
- return filterByCompletedAndSelectedUser(taskArts);
- }
-
- // Bulk load tasks related to workflows
- Collection<Artifact> artifacts =
- RelationManager.getRelatedArtifacts(workflows, 1, AtsRelationTypes.SmaToTask_Task);
-
- // Apply the remaining criteria
- return filterByCompletedAndSelectedUser(artifacts);
- }
-
- private Collection<TaskArtifact> handleOnlyUserSelected() throws OseeCoreException {
- return filterByCompletedAndSelectedUser(getUserAssignedTaskArtifacts());
- }
-
- private Collection<TaskArtifact> getUserAssignedTaskArtifacts() throws OseeCoreException {
- Set<TaskArtifact> tasks = new HashSet<TaskArtifact>();
- for (Artifact art : AtsUtil.getAssigned(getSelectedUser(), TaskArtifact.class)) {
- tasks.add((TaskArtifact) art);
- }
- return tasks;
- }
-
- private Collection<TaskArtifact> filterByCompletedAndSelectedUser(Collection<? extends Artifact> artifacts) throws OseeCoreException {
- Set<TaskArtifact> tasks = new HashSet<TaskArtifact>();
- for (Artifact art : artifacts) {
- TaskArtifact taskArt = (TaskArtifact) art;
- // If not include completed and task is such, skip this task
- if (!isIncludeCompletedCancelledCheckbox() && taskArt.isCancelledOrCompleted()) {
- continue;
- }
- // If include completed and task is such and user not implementer, skip this task
- if (isIncludeCompletedCancelledCheckbox() && taskArt.isCancelledOrCompleted() && getSelectedUser() != null && taskArt.getImplementers().contains(
- getSelectedUser())) {
- tasks.add(taskArt);
- continue;
- }
- // If user is selected and not user is assigned, skip this task
- else if (getSelectedUser() != null && !taskArt.getStateMgr().getAssignees().contains(getSelectedUser())) {
- continue;
- }
- tasks.add(taskArt);
- }
- return tasks;
- }
-
- @Override
- public Result isParameterSelectionValid() throws OseeCoreException {
- if (getSelectedUser() != null && isIncludeCompletedCancelledCheckbox() && getSelectedVersionArtifact() == null && getSelectedTeamDefinitions().isEmpty()) {
- // This case is unsupported and should be filtered out prior to this point
- throw new OseeArgumentException("Unsupported User and Include Completed selected.");
- }
-
- // If only user selected, handle that case separately
- if (getSelectedVersionArtifact() == null && getSelectedTeamDefinitions().isEmpty() && getSelectedUser() != null) {
- return Result.TrueResult;
- }
-
- if (getSelectedGroups().size() > 0 && (getSelectedVersionArtifact() != null || getSelectedTeamDefinitions().size() > 0)) {
- // This case is unsupported and should be filtered out prior to this point
- throw new OseeArgumentException("Unsupported Groups selection with Version or Team(s).");
- }
- return Result.TrueResult;
- }
-
- @Override
- public Collection<TableLoadOption> getTableLoadOptions() throws OseeCoreException {
- return null;
- }
-
- @Override
- public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException {
- StringBuffer sb = new StringBuffer();
- Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
- if (teamDefs.size() > 0) {
- sb.append(" - Teams: " + org.eclipse.osee.framework.jdk.core.util.Collections.toString(",", teamDefs));
- }
- if (getSelectedVersionArtifact() != null) {
- sb.append(" - Version: " + getSelectedVersionArtifact());
- }
- if (getSelectedGroups().size() > 0) {
- sb.append(" - Groups: " + Collections.toString(",", getSelectedGroups()));
- }
- if (getSelectedUser() != null) {
- sb.append(" - Assignee: " + getSelectedUser());
- }
- if (isIncludeCompletedCancelledCheckbox()) {
- sb.append(" - Include Completed/Cancelled");
- }
- return Strings.truncate("Tasks" + sb.toString(), TaskEditor.TITLE_MAX_LENGTH, true);
- }
-
- @Override
- public void createXWidgetLayoutData(DynamicXWidgetLayoutData layoutData, XWidget widget, FormToolkit toolkit, Artifact art, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
- }
-
- @Override
- public void widgetCreating(XWidget widget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
- }
-
- @Override
- public void widgetCreated(XWidget widget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
- if (widget.getLabel().equals("Group(s)")) {
- groupWidget = (XHyperlabelGroupSelection) widget;
- }
- if (widget.getLabel().equals("Assignee")) {
- assigneeCombo = (XMembersCombo) widget;
- }
- if (widget.getLabel().equals("Include Completed/Cancelled")) {
- includeCompletedCancelledCheckbox = (XCheckBox) widget;
- }
- if (widget.getLabel().equals("Version")) {
- versionCombo = (XCombo) widget;
- versionCombo.getComboBox().setVisibleItemCount(25);
- widget.setToolTip("Select Team to populate Version list");
- }
- if (widget.getLabel().equals("Team Definitions(s)")) {
- teamCombo = (XHyperlabelTeamDefinitionSelection) widget;
- teamCombo.addXModifiedListener(new XModifiedListener() {
- @Override
- public void widgetModified(XWidget widget) {
- if (versionCombo != null) {
- try {
- Collection<TeamDefinitionArtifact> teamDefArts = getSelectedTeamDefinitions();
- if (teamDefArts.isEmpty()) {
- versionCombo.setDataStrings(new String[] {});
- return;
- }
- TeamDefinitionArtifact teamDefHoldingVersions =
- teamDefArts.iterator().next().getTeamDefinitionHoldingVersions();
- if (teamDefHoldingVersions == null) {
- versionCombo.setDataStrings(new String[] {});
- return;
- }
- Collection<String> names =
- Artifacts.artNames(teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both));
- if (names.isEmpty()) {
- versionCombo.setDataStrings(new String[] {});
- return;
- }
- versionCombo.setDataStrings(names.toArray(new String[names.size()]));
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- });
- }
- }
-
- private User getSelectedUser() {
- if (assigneeCombo == null) return null;
- return assigneeCombo.getUser();
- }
-
- public void setSelectedUser(User user) {
- if (assigneeCombo != null) assigneeCombo.set(user);
- }
-
- private boolean isIncludeCompletedCancelledCheckbox() {
- if (includeCompletedCancelledCheckbox == null) return false;
- return includeCompletedCancelledCheckbox.isSelected();
- }
-
- public void setIncludeCompletedCancelledCheckbox(boolean selected) {
- if (includeCompletedCancelledCheckbox != null) includeCompletedCancelledCheckbox.set(selected);
- }
-
- private VersionArtifact getSelectedVersionArtifact() throws OseeCoreException {
- if (versionCombo == null) return null;
- String versionStr = versionCombo.get();
- if (versionStr == null || versionStr.equals("")) return null;
- Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
- if (teamDefs.size() > 0) {
- TeamDefinitionArtifact teamDefHoldingVersions = teamDefs.iterator().next().getTeamDefinitionHoldingVersions();
- if (teamDefHoldingVersions == null) return null;
- for (VersionArtifact versionArtifact : teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both)) {
- if (versionArtifact.getName().equals(versionStr)) {
- return versionArtifact;
- }
- }
- }
- return null;
- }
-
- public void setVersion(String versionStr) {
- if (versionCombo != null && versionCombo.getInDataStrings() != null) {
- // should check if the version combo was populated
- if (versionCombo.getInDataStrings().length > 0) {
- versionCombo.set(versionStr);
- }
- }
- }
-
- private Collection<TeamDefinitionArtifact> getSelectedTeamDefinitions() throws OseeCoreException {
- return teamCombo.getSelectedTeamDefintions();
- }
-
- public void setSelectedTeamDefinitions(Collection<TeamDefinitionArtifact> selectedTeamDefs) {
- if (teamCombo != null) {
- teamCombo.setSelectedTeamDefs(selectedTeamDefs);
- teamCombo.notifyXModifiedListeners();
- }
- }
-
- private Collection<Artifact> getSelectedGroups() throws OseeCoreException {
- return groupWidget.getSelectedGroups();
- }
-
- public void setSelectedGroups(Set<Artifact> selectedUsers) {
- if (groupWidget != null) groupWidget.setSelectedGroups(selectedUsers);
- }
-
- public void handleSelectedGroupsClear() {
- if (groupWidget != null) groupWidget.handleClear();
- }
-
- @Override
- public TaskSearchWorldSearchItem copy() {
- return new TaskSearchWorldSearchItem(this);
- }
-
- @Override
- public ITaskEditorProvider copyProvider() {
- return null;
- }
-
- @Override
- public void setCustomizeData(CustomizeData customizeData) {
- }
-
- @Override
- public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world.search;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact.VersionReleaseType;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.task.ITaskEditorProvider;
+import org.eclipse.osee.ats.task.TaskEditor;
+import org.eclipse.osee.ats.task.TaskEditorParameterSearchItem;
+import org.eclipse.osee.ats.util.AtsRelationTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.widgets.XHyperlabelTeamDefinitionSelection;
+import org.eclipse.osee.ats.world.search.TeamWorldSearchItem.ReleasedOption;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
+import org.eclipse.osee.framework.ui.skynet.widgets.XCombo;
+import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlabelGroupSelection;
+import org.eclipse.osee.framework.ui.skynet.widgets.XMembersCombo;
+import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TaskSearchWorldSearchItem extends TaskEditorParameterSearchItem {
+
+ private XMembersCombo assigneeCombo;
+ private XCheckBox includeCompletedCancelledCheckbox;
+ private XHyperlabelTeamDefinitionSelection teamCombo = null;
+ private XHyperlabelGroupSelection groupWidget = null;
+ private XCombo versionCombo = null;
+
+ /**
+ * @param worldSearchItem
+ */
+ public TaskSearchWorldSearchItem(WorldSearchItem worldSearchItem) {
+ super(worldSearchItem);
+ }
+
+ /**
+ * @param name
+ * @param loadView
+ */
+ public TaskSearchWorldSearchItem() {
+ super("Task Search");
+ }
+
+ @Override
+ public String getParameterXWidgetXml() throws OseeCoreException {
+ return "<xWidgets>" +
+ //
+ "<XWidget xwidgetType=\"XHyperlabelTeamDefinitionSelection\" displayName=\"Team Definitions(s)\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget xwidgetType=\"XCombo()\" beginComposite=\"8\" displayName=\"Version\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget xwidgetType=\"XCheckBox\" displayName=\"Include Completed/Cancelled\" defaultValue=\"false\" labelAfter=\"true\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget xwidgetType=\"XHyperlabelGroupSelection\" displayName=\"Group(s)\" horizontalLabel=\"true\"/>" +
+ //
+ "<XWidget xwidgetType=\"XMembersCombo\" displayName=\"Assignee\" horizontalLabel=\"true\"/>" +
+ //
+ "</xWidgets>";
+ }
+
+ @Override
+ public Collection<? extends Artifact> getTaskEditorTaskArtifacts() throws OseeCoreException {
+ List<Artifact> workflows = new ArrayList<Artifact>();
+ Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
+ VersionArtifact verArt = getSelectedVersionArtifact();
+ Collection<Artifact> groups = getSelectedGroups();
+ User user = getSelectedUser();
+
+ // If only user selected, handle that case separately
+ if (verArt == null && teamDefs.isEmpty() && user != null) {
+ return handleOnlyUserSelected();
+ } // If version specified, get workflows from targeted relation
+ if (verArt != null) {
+ for (Artifact art : verArt.getRelatedArtifacts(AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow)) {
+ if (teamDefs.isEmpty()) {
+ workflows.add(art);
+ }
+ // Filter by team def if specified
+ else if (teamDefs.contains((((TeamWorkFlowArtifact) art).getTeamDefinition()))) {
+ workflows.add(art);
+ }
+ }
+ }
+ // Else, get workflows from teamdefs
+ else if (teamDefs.size() > 0) {
+ TeamWorldSearchItem teamWorldSearchItem =
+ new TeamWorldSearchItem("", teamDefs, true, false, false, null, null, ReleasedOption.Both);
+ workflows.addAll(teamWorldSearchItem.performSearchGetResults(false, SearchType.Search));
+ } else if (groups.size() > 0) {
+ Set<TaskArtifact> taskArts = new HashSet<TaskArtifact>();
+ for (Artifact groupArt : groups) {
+ for (Artifact art : groupArt.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members)) {
+ if (art instanceof TaskArtifact) {
+ taskArts.add((TaskArtifact) art);
+ } else if (art instanceof TaskableStateMachineArtifact) {
+ taskArts.addAll(((TaskableStateMachineArtifact) art).getTaskArtifacts());
+ }
+ }
+ }
+ return filterByCompletedAndSelectedUser(taskArts);
+ }
+
+ // Bulk load tasks related to workflows
+ Collection<Artifact> artifacts =
+ RelationManager.getRelatedArtifacts(workflows, 1, AtsRelationTypes.SmaToTask_Task);
+
+ // Apply the remaining criteria
+ return filterByCompletedAndSelectedUser(artifacts);
+ }
+
+ private Collection<TaskArtifact> handleOnlyUserSelected() throws OseeCoreException {
+ return filterByCompletedAndSelectedUser(getUserAssignedTaskArtifacts());
+ }
+
+ private Collection<TaskArtifact> getUserAssignedTaskArtifacts() throws OseeCoreException {
+ Set<TaskArtifact> tasks = new HashSet<TaskArtifact>();
+ for (Artifact art : AtsUtil.getAssigned(getSelectedUser(), TaskArtifact.class)) {
+ tasks.add((TaskArtifact) art);
+ }
+ return tasks;
+ }
+
+ private Collection<TaskArtifact> filterByCompletedAndSelectedUser(Collection<? extends Artifact> artifacts) throws OseeCoreException {
+ Set<TaskArtifact> tasks = new HashSet<TaskArtifact>();
+ for (Artifact art : artifacts) {
+ TaskArtifact taskArt = (TaskArtifact) art;
+ // If not include completed and task is such, skip this task
+ if (!isIncludeCompletedCancelledCheckbox() && taskArt.isCancelledOrCompleted()) {
+ continue;
+ }
+ // If include completed and task is such and user not implementer, skip this task
+ if (isIncludeCompletedCancelledCheckbox() && taskArt.isCancelledOrCompleted() && getSelectedUser() != null && taskArt.getImplementers().contains(
+ getSelectedUser())) {
+ tasks.add(taskArt);
+ continue;
+ }
+ // If user is selected and not user is assigned, skip this task
+ else if (getSelectedUser() != null && !taskArt.getStateMgr().getAssignees().contains(getSelectedUser())) {
+ continue;
+ }
+ tasks.add(taskArt);
+ }
+ return tasks;
+ }
+
+ @Override
+ public Result isParameterSelectionValid() throws OseeCoreException {
+ if (getSelectedUser() != null && isIncludeCompletedCancelledCheckbox() && getSelectedVersionArtifact() == null && getSelectedTeamDefinitions().isEmpty()) {
+ // This case is unsupported and should be filtered out prior to this point
+ throw new OseeArgumentException("Unsupported User and Include Completed selected.");
+ }
+
+ // If only user selected, handle that case separately
+ if (getSelectedVersionArtifact() == null && getSelectedTeamDefinitions().isEmpty() && getSelectedUser() != null) {
+ return Result.TrueResult;
+ }
+
+ if (getSelectedGroups().size() > 0 && (getSelectedVersionArtifact() != null || getSelectedTeamDefinitions().size() > 0)) {
+ // This case is unsupported and should be filtered out prior to this point
+ throw new OseeArgumentException("Unsupported Groups selection with Version or Team(s).");
+ }
+ return Result.TrueResult;
+ }
+
+ @Override
+ public Collection<TableLoadOption> getTableLoadOptions() throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException {
+ StringBuffer sb = new StringBuffer();
+ Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
+ if (teamDefs.size() > 0) {
+ sb.append(" - Teams: " + org.eclipse.osee.framework.jdk.core.util.Collections.toString(",", teamDefs));
+ }
+ if (getSelectedVersionArtifact() != null) {
+ sb.append(" - Version: " + getSelectedVersionArtifact());
+ }
+ if (getSelectedGroups().size() > 0) {
+ sb.append(" - Groups: " + Collections.toString(",", getSelectedGroups()));
+ }
+ if (getSelectedUser() != null) {
+ sb.append(" - Assignee: " + getSelectedUser());
+ }
+ if (isIncludeCompletedCancelledCheckbox()) {
+ sb.append(" - Include Completed/Cancelled");
+ }
+ return Strings.truncate("Tasks" + sb.toString(), TaskEditor.TITLE_MAX_LENGTH, true);
+ }
+
+ @Override
+ public void createXWidgetLayoutData(DynamicXWidgetLayoutData layoutData, XWidget widget, FormToolkit toolkit, Artifact art, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
+ }
+
+ @Override
+ public void widgetCreating(XWidget widget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
+ }
+
+ @Override
+ public void widgetCreated(XWidget widget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException {
+ if (widget.getLabel().equals("Group(s)")) {
+ groupWidget = (XHyperlabelGroupSelection) widget;
+ }
+ if (widget.getLabel().equals("Assignee")) {
+ assigneeCombo = (XMembersCombo) widget;
+ }
+ if (widget.getLabel().equals("Include Completed/Cancelled")) {
+ includeCompletedCancelledCheckbox = (XCheckBox) widget;
+ }
+ if (widget.getLabel().equals("Version")) {
+ versionCombo = (XCombo) widget;
+ versionCombo.getComboBox().setVisibleItemCount(25);
+ widget.setToolTip("Select Team to populate Version list");
+ }
+ if (widget.getLabel().equals("Team Definitions(s)")) {
+ teamCombo = (XHyperlabelTeamDefinitionSelection) widget;
+ teamCombo.addXModifiedListener(new XModifiedListener() {
+ @Override
+ public void widgetModified(XWidget widget) {
+ if (versionCombo != null) {
+ try {
+ Collection<TeamDefinitionArtifact> teamDefArts = getSelectedTeamDefinitions();
+ if (teamDefArts.isEmpty()) {
+ versionCombo.setDataStrings(new String[] {});
+ return;
+ }
+ TeamDefinitionArtifact teamDefHoldingVersions =
+ teamDefArts.iterator().next().getTeamDefinitionHoldingVersions();
+ if (teamDefHoldingVersions == null) {
+ versionCombo.setDataStrings(new String[] {});
+ return;
+ }
+ Collection<String> names =
+ Artifacts.artNames(teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both));
+ if (names.isEmpty()) {
+ versionCombo.setDataStrings(new String[] {});
+ return;
+ }
+ versionCombo.setDataStrings(names.toArray(new String[names.size()]));
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ private User getSelectedUser() {
+ if (assigneeCombo == null) return null;
+ return assigneeCombo.getUser();
+ }
+
+ public void setSelectedUser(User user) {
+ if (assigneeCombo != null) assigneeCombo.set(user);
+ }
+
+ private boolean isIncludeCompletedCancelledCheckbox() {
+ if (includeCompletedCancelledCheckbox == null) return false;
+ return includeCompletedCancelledCheckbox.isSelected();
+ }
+
+ public void setIncludeCompletedCancelledCheckbox(boolean selected) {
+ if (includeCompletedCancelledCheckbox != null) includeCompletedCancelledCheckbox.set(selected);
+ }
+
+ private VersionArtifact getSelectedVersionArtifact() throws OseeCoreException {
+ if (versionCombo == null) return null;
+ String versionStr = versionCombo.get();
+ if (versionStr == null || versionStr.equals("")) return null;
+ Collection<TeamDefinitionArtifact> teamDefs = getSelectedTeamDefinitions();
+ if (teamDefs.size() > 0) {
+ TeamDefinitionArtifact teamDefHoldingVersions = teamDefs.iterator().next().getTeamDefinitionHoldingVersions();
+ if (teamDefHoldingVersions == null) return null;
+ for (VersionArtifact versionArtifact : teamDefHoldingVersions.getVersionsArtifacts(VersionReleaseType.Both)) {
+ if (versionArtifact.getName().equals(versionStr)) {
+ return versionArtifact;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void setVersion(String versionStr) {
+ if (versionCombo != null && versionCombo.getInDataStrings() != null) {
+ // should check if the version combo was populated
+ if (versionCombo.getInDataStrings().length > 0) {
+ versionCombo.set(versionStr);
+ }
+ }
+ }
+
+ private Collection<TeamDefinitionArtifact> getSelectedTeamDefinitions() throws OseeCoreException {
+ return teamCombo.getSelectedTeamDefintions();
+ }
+
+ public void setSelectedTeamDefinitions(Collection<TeamDefinitionArtifact> selectedTeamDefs) {
+ if (teamCombo != null) {
+ teamCombo.setSelectedTeamDefs(selectedTeamDefs);
+ teamCombo.notifyXModifiedListeners();
+ }
+ }
+
+ private Collection<Artifact> getSelectedGroups() throws OseeCoreException {
+ return groupWidget.getSelectedGroups();
+ }
+
+ public void setSelectedGroups(Set<Artifact> selectedUsers) {
+ if (groupWidget != null) groupWidget.setSelectedGroups(selectedUsers);
+ }
+
+ public void handleSelectedGroupsClear() {
+ if (groupWidget != null) groupWidget.handleClear();
+ }
+
+ @Override
+ public TaskSearchWorldSearchItem copy() {
+ return new TaskSearchWorldSearchItem(this);
+ }
+
+ @Override
+ public ITaskEditorProvider copyProvider() {
+ return null;
+ }
+
+ @Override
+ public void setCustomizeData(CustomizeData customizeData) {
+ }
+
+ @Override
+ public void setTableLoadOptions(TableLoadOption... tableLoadOptions) {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/UserWorldSearchItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/UserWorldSearchItem.java
index 7a96172c013..a4269a577a8 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/UserWorldSearchItem.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/search/UserWorldSearchItem.java
@@ -1,142 +1,142 @@
-/*******************************************************************************
- * 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.ats.world.search;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.util.AtsRelationTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.SMAUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-
-/**
- * @author Donald G. Dunne
- */
-public class UserWorldSearchItem {
-
- private final Collection<TeamDefinitionArtifact> teamDefs;
- private final Collection<VersionArtifact> versions;
- private final Collection<UserSearchOption> options;
- private final User user;
-
- public static enum UserSearchOption {
- None,
- Assignee,
- Favorites,
- Subscribed,
- Originator,
- IncludeCompleted,
- IncludeCancelled,
- IncludeTeamWorkflows,
- IncludeReviews,
- IncludeTasks
- };
-
- public UserWorldSearchItem(User user, Collection<TeamDefinitionArtifact> teamDefs, Collection<VersionArtifact> versions, UserSearchOption... userSearchOption) {
- this.user = user;
- this.teamDefs = teamDefs;
- this.versions = versions;
- this.options = Collections.getAggregate(userSearchOption);
- }
-
- public Collection<StateMachineArtifact> performSearch() throws OseeCoreException {
- Set<StateMachineArtifact> searchArts = new HashSet<StateMachineArtifact>();
- if (options.contains(UserSearchOption.Originator)) {
- searchArts.addAll(getOriginatorArtifacts());
- } else if (options.contains(UserSearchOption.Subscribed)) {
- searchArts.addAll(getSubscribedArtifacts());
- } else if (options.contains(UserSearchOption.Favorites)) {
- searchArts.addAll(getFavoritesArtifacts());
- } else if (options.contains(UserSearchOption.Assignee)) {
- searchArts.addAll(Collections.castMatching(StateMachineArtifact.class, AtsUtil.getAssigned(user)));
- // If include cancelled or completed, need to perform extra search
- // Note: Don't need to do this for Originator, Subscribed or Favorites, cause it does completed canceled in it's own searches
- if (options.contains(UserSearchOption.IncludeCancelled) || options.contains(UserSearchOption.IncludeCompleted)) {
- searchArts.addAll(SMAUtil.getSMAs(ArtifactQuery.getArtifactListFromAttribute(
- ATSAttributes.STATE_ATTRIBUTE.getStoreName(), "%<" + user.getUserId() + ">%", AtsUtil.getAtsBranch())));
- }
- }
-
- Collection<Class<?>> filterClasses = new ArrayList<Class<?>>();
- if (!options.contains(UserSearchOption.IncludeReviews)) {
- filterClasses.add(ReviewSMArtifact.class);
- }
- if (!options.contains(UserSearchOption.IncludeTeamWorkflows)) {
- filterClasses.add(TeamWorkFlowArtifact.class);
- }
- if (!options.contains(UserSearchOption.IncludeTasks)) {
- filterClasses.add(TaskArtifact.class);
- }
-
- Collection<StateMachineArtifact> filteredArts = SMAUtil.filterOutTypes(searchArts, filterClasses);
-
- if (teamDefs != null && teamDefs.size() > 0) {
- filteredArts = SMAUtil.getTeamDefinitionWorkflows(filteredArts, teamDefs);
- }
-
- if (versions != null && versions.size() > 0) {
- filteredArts = SMAUtil.getVersionWorkflows(filteredArts, versions);
- }
-
- // Handle include completed/cancelled option
- if (options.contains(UserSearchOption.IncludeCompleted) && options.contains(UserSearchOption.IncludeCancelled)) {
- return filteredArts;
- }
-
- if (!options.contains(UserSearchOption.IncludeCancelled)) {
- filteredArts =
- SMAUtil.filterOutState(filteredArts, java.util.Collections.singleton(DefaultTeamState.Cancelled.name()));
- }
-
- if (!options.contains(UserSearchOption.IncludeCompleted)) {
- filteredArts =
- SMAUtil.filterOutState(filteredArts, java.util.Collections.singleton(DefaultTeamState.Completed.name()));
- }
-
- return filteredArts;
- }
-
- private Collection<StateMachineArtifact> getOriginatorArtifacts() throws OseeCoreException {
- Collection<StateMachineArtifact> originators = new ArrayList<StateMachineArtifact>();
- Collection<StateMachineArtifact> artifacts =
- Collections.castAll(ArtifactQuery.getArtifactListFromAttribute(ATSAttributes.LOG_ATTRIBUTE.getStoreName(),
- "%type=\"Originated\" userId=\"" + user.getUserId() + "\"%", AtsUtil.getAtsBranch()));
- // omit historical originators; list current originators
- for (StateMachineArtifact art : artifacts) {
- if (art.getWorldViewOriginator().equals(user.getName())) {
- originators.add(art);
- }
- }
- return originators;
- }
-
- private Collection<StateMachineArtifact> getSubscribedArtifacts() throws OseeCoreException {
- return user.getRelatedArtifactsOfType(AtsRelationTypes.SubscribedUser_Artifact, StateMachineArtifact.class);
- }
-
- private Collection<StateMachineArtifact> getFavoritesArtifacts() throws OseeCoreException {
- return user.getRelatedArtifactsOfType(AtsRelationTypes.FavoriteUser_Artifact, StateMachineArtifact.class);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.world.search;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.util.AtsRelationTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.SMAUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class UserWorldSearchItem {
+
+ private final Collection<TeamDefinitionArtifact> teamDefs;
+ private final Collection<VersionArtifact> versions;
+ private final Collection<UserSearchOption> options;
+ private final User user;
+
+ public static enum UserSearchOption {
+ None,
+ Assignee,
+ Favorites,
+ Subscribed,
+ Originator,
+ IncludeCompleted,
+ IncludeCancelled,
+ IncludeTeamWorkflows,
+ IncludeReviews,
+ IncludeTasks
+ };
+
+ public UserWorldSearchItem(User user, Collection<TeamDefinitionArtifact> teamDefs, Collection<VersionArtifact> versions, UserSearchOption... userSearchOption) {
+ this.user = user;
+ this.teamDefs = teamDefs;
+ this.versions = versions;
+ this.options = Collections.getAggregate(userSearchOption);
+ }
+
+ public Collection<StateMachineArtifact> performSearch() throws OseeCoreException {
+ Set<StateMachineArtifact> searchArts = new HashSet<StateMachineArtifact>();
+ if (options.contains(UserSearchOption.Originator)) {
+ searchArts.addAll(getOriginatorArtifacts());
+ } else if (options.contains(UserSearchOption.Subscribed)) {
+ searchArts.addAll(getSubscribedArtifacts());
+ } else if (options.contains(UserSearchOption.Favorites)) {
+ searchArts.addAll(getFavoritesArtifacts());
+ } else if (options.contains(UserSearchOption.Assignee)) {
+ searchArts.addAll(Collections.castMatching(StateMachineArtifact.class, AtsUtil.getAssigned(user)));
+ // If include cancelled or completed, need to perform extra search
+ // Note: Don't need to do this for Originator, Subscribed or Favorites, cause it does completed canceled in it's own searches
+ if (options.contains(UserSearchOption.IncludeCancelled) || options.contains(UserSearchOption.IncludeCompleted)) {
+ searchArts.addAll(SMAUtil.getSMAs(ArtifactQuery.getArtifactListFromAttribute(
+ ATSAttributes.STATE_ATTRIBUTE.getStoreName(), "%<" + user.getUserId() + ">%", AtsUtil.getAtsBranch())));
+ }
+ }
+
+ Collection<Class<?>> filterClasses = new ArrayList<Class<?>>();
+ if (!options.contains(UserSearchOption.IncludeReviews)) {
+ filterClasses.add(ReviewSMArtifact.class);
+ }
+ if (!options.contains(UserSearchOption.IncludeTeamWorkflows)) {
+ filterClasses.add(TeamWorkFlowArtifact.class);
+ }
+ if (!options.contains(UserSearchOption.IncludeTasks)) {
+ filterClasses.add(TaskArtifact.class);
+ }
+
+ Collection<StateMachineArtifact> filteredArts = SMAUtil.filterOutTypes(searchArts, filterClasses);
+
+ if (teamDefs != null && teamDefs.size() > 0) {
+ filteredArts = SMAUtil.getTeamDefinitionWorkflows(filteredArts, teamDefs);
+ }
+
+ if (versions != null && versions.size() > 0) {
+ filteredArts = SMAUtil.getVersionWorkflows(filteredArts, versions);
+ }
+
+ // Handle include completed/cancelled option
+ if (options.contains(UserSearchOption.IncludeCompleted) && options.contains(UserSearchOption.IncludeCancelled)) {
+ return filteredArts;
+ }
+
+ if (!options.contains(UserSearchOption.IncludeCancelled)) {
+ filteredArts =
+ SMAUtil.filterOutState(filteredArts, java.util.Collections.singleton(DefaultTeamState.Cancelled.name()));
+ }
+
+ if (!options.contains(UserSearchOption.IncludeCompleted)) {
+ filteredArts =
+ SMAUtil.filterOutState(filteredArts, java.util.Collections.singleton(DefaultTeamState.Completed.name()));
+ }
+
+ return filteredArts;
+ }
+
+ private Collection<StateMachineArtifact> getOriginatorArtifacts() throws OseeCoreException {
+ Collection<StateMachineArtifact> originators = new ArrayList<StateMachineArtifact>();
+ Collection<StateMachineArtifact> artifacts =
+ Collections.castAll(ArtifactQuery.getArtifactListFromAttribute(ATSAttributes.LOG_ATTRIBUTE.getStoreName(),
+ "%type=\"Originated\" userId=\"" + user.getUserId() + "\"%", AtsUtil.getAtsBranch()));
+ // omit historical originators; list current originators
+ for (StateMachineArtifact art : artifacts) {
+ if (art.getWorldViewOriginator().equals(user.getName())) {
+ originators.add(art);
+ }
+ }
+ return originators;
+ }
+
+ private Collection<StateMachineArtifact> getSubscribedArtifacts() throws OseeCoreException {
+ return user.getRelatedArtifactsOfType(AtsRelationTypes.SubscribedUser_Artifact, StateMachineArtifact.class);
+ }
+
+ private Collection<StateMachineArtifact> getFavoritesArtifacts() throws OseeCoreException {
+ return user.getRelatedArtifactsOfType(AtsRelationTypes.FavoriteUser_Artifact, StateMachineArtifact.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee b/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
index 6782c97c3dc..25940199193 100644
--- a/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
+++ b/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
@@ -1,777 +1,777 @@
-import
-"platform:/plugin/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee"
-abstract artifactType "ats.Release Artifact" extends "Artifact" {
- guid "ABMZAdJpQi01iAbMBjgA"
- attribute "ats.Released"
-}
-
-abstract artifactType "ats.Ats Artifact" extends "Artifact" {
- guid "ABMaLS0jvw92SE+4ZJQA"
- attribute "ats.Description"
-}
-
-artifactType "ats.Review" extends "ats.Ats Artifact" {
- guid "ABMa6P4TwzXA1b8K3RAA"
- attribute "ats.Actionable Item"
- attribute "ats.Blocking Review"
- attribute "ats.Current State"
- attribute "ats.Estimated Completion Date"
- attribute "ats.Estimated Hours"
- attribute "ats.Estimated Release Date"
- attribute "ats.Legacy PCR Id"
- attribute "ats.Log"
- attribute "ats.Need By"
- attribute "ats.Related To State"
- attribute "ats.Resolution"
- attribute "ats.Review Blocks"
- attribute "ats.Role"
- attribute "ats.SMA Note"
- attribute "ats.State Notes"
- attribute "ats.State"
-}
-
-artifactType "PeerToPeer Review" extends "ats.Review" {
- guid "AAMFDhh_300dpgmNtRAA"
- attribute "ats.Authors"
- attribute "ats.Location"
- attribute "ats.Review Defect"
-}
-
-artifactType "Decision Review" extends "ats.Review" {
- guid "AAMFDhfrdR7BGTL7H_wA"
- attribute "ats.Decision Review Options"
- attribute "ats.Decision"
-}
-
-artifactType "Action" extends "ats.Ats Artifact" {
- guid "AAMFDhY_rns71KvX14QA"
- attribute "ats.User Community"
- attribute "ats.Actionable Item"
- attribute "ats.Change Type"
- attribute "ats.Need By"
- attribute "ats.Priority"
- attribute "ats.Validation Required"
-}
-
-artifactType "Team Definition" extends "ats.Ats Artifact" {
- guid "AAMFDhUrlytusKbaQGAA"
- attribute "ats.Hours Per Work Day"
- attribute "ats.Full Name"
- attribute "ats.Team Uses Versions"
- attribute "ats.Require Targeted Version"
- attribute "ats.Baseline Branch Guid"
- attribute "ats.Active"
- attribute "ats.Actionable"
- attribute "ats.Allow Create Branch"
- attribute "ats.Allow Commit Branch"
-}
-
-artifactType "Actionable Item" extends "ats.Ats Artifact" {
- guid "AAMFDhW2LmhtRFsVyzwA"
- attribute "ats.Active"
- attribute "ats.Actionable"
-}
-
-artifactType "Version" extends "ats.Ats Artifact" {
- guid "AAMFDhder0oETnv14xQA"
- attribute "ats.Allow Commit Branch"
- attribute "ats.Allow Create Branch"
- attribute "ats.Estimated Release Date"
- attribute "ats.Full Name"
- attribute "ats.Next Version"
- attribute "ats.Baseline Branch Guid"
- attribute "ats.Release Date"
- attribute "ats.Released"
- attribute "ats.Version Locked"
-}
-
-abstract artifactType "ats.State Machine" extends "ats.Ats Artifact" {
- guid "ABMfXC+LFBn31ZZbvjAA"
- attribute "ats.Work Package"
- attribute "ats.Category"
- attribute "ats.Category2"
- attribute "ats.Category3"
- attribute "ats.Points"
- attribute "ats.Numeric1"
- attribute "ats.Numeric2"
- attribute "ats.Current State"
- attribute "ats.Estimated Completion Date"
- attribute "ats.Estimated Hours"
- attribute "ats.Estimated Release Date"
- attribute "ats.Log"
- attribute "ats.Release Date"
- attribute "ats.Resolution"
- attribute "ats.SMA Note"
- attribute "ats.State Notes"
- attribute "ats.State"
-}
-
-artifactType "Goal" extends "ats.State Machine" {
- guid "ABMgU119UjI_Q23Yu+gA"
- attribute "ats.Change Type"
- attribute "ats.Need By"
- attribute "ats.Priority"
- attribute "ats.Goal Order Vote"
-}
-
-artifactType "Team Workflow" extends "ats.State Machine" {
- guid "AAMFDhSiF2OD+wiUqugA"
- attribute "ats.Actionable Item"
- attribute "ats.Branch Metrics"
- attribute "ats.Baseline Branch Guid"
- attribute "ats.Validation Required"
- attribute "ats.Weekly Benefit"
- attribute "ats.Change Type"
- attribute "ats.Legacy PCR Id"
- attribute "ats.Need By"
- attribute "ats.Percent Rework"
- attribute "ats.Priority"
- attribute "ats.Problem"
- attribute "ats.Proposed Resolution"
- attribute "ats.Team Definition"
- attribute "ats.User Community"
-}
-
-artifactType "Task" extends "ats.State Machine" {
- guid "AAMFDhbTAAB6h+06fuAA"
- attribute "ats.Related To State"
- attribute "ats.Uses Resolution Options"
-}
-
-attributeType "ats.Baseline Branch Guid" extends StringAttribute {
- guid "AAMFEdIjJ2za2fblEVgA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.Validation Required" extends BooleanAttribute {
- guid "AAMFEcjT0TwkD2R4w1QA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "no"
-}
-
-attributeType "ats.Active" extends BooleanAttribute {
- guid "AAMFEclQOVmzkIvzyWwA"
- dataProvider DefaultAttributeDataProvider
- min 1
- max 1
- defaultValue "yes"
-}
-
-attributeType "ats.Uses Resolution Options" extends BooleanAttribute {
- guid "AAMFEPuOzltN1+Ze1kQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "no"
-}
-
-attributeType "ats.Released" extends BooleanAttribute {
- guid "AAMFEcnMoUZMLA2zB1AA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "no"
-}
-
-attributeType "ats.Version Locked" extends BooleanAttribute {
- guid "AAzRtEJXbjzR5jySOZgA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "no"
-}
-
-attributeType "ats.Next Version" extends BooleanAttribute {
- guid "AAMFEcpH8Xb72hsF5AwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "no"
-}
-
-attributeType "ats.Team Uses Versions" extends BooleanAttribute {
- guid "AAMFEcrHnzPxQ7w3ligA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "no"
-}
-
-attributeType "ats.Require Targeted Version" extends BooleanAttribute {
- guid "AAMFEQUBDxMJ67lodTQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "no"
-}
-
-attributeType "ats.Blocking Review" extends BooleanAttribute {
- guid "AAMFEctKkjMRrIy1C7gA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "no"
-}
-
-attributeType "ats.Actionable" extends BooleanAttribute {
- guid "AAMFEcvDtBiaJ3TMatAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "yes"
-}
-
-attributeType "ats.Allow Create Branch" extends BooleanAttribute {
- guid "AAMFEbARuQEvi6rtY5gA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "yes"
-}
-
-attributeType "ats.Allow Commit Branch" extends BooleanAttribute {
- guid "AAMFEbCZCkwgj73BsQgA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "yes"
-}
-
-attributeType "ats.Need By" extends DateAttribute {
- guid "AAMFEcxAGzHAKfDNAIwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.Estimated Release Date" extends DateAttribute {
- guid "AAMFEcy6VB7Ble5SP1QA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.Estimated Completion Date" extends DateAttribute {
- guid "AAMFEc18k3Gh+GP7zqAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.Release Date" extends DateAttribute {
- guid "AAMFEc3+cGcMDOCdmdAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-oseeEnumType "enum.ats.review.blocks" {
- guid "ABbjHDeufSNcLOtj78wA"
- entry "None" entryGuid "CArJmR2JDn5DXT9FGPQA"
- entry "Transition" entryGuid "CArJmR3xrEmbw7zbyqgA"
- entry "Commit" entryGuid "CArJmR5WzHmG_n_OKhQA"
-}
-
-attributeType "ats.Review Blocks" extends EnumeratedAttribute {
- guid "AAMFEc6G2A8jmRWJgagA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- enumType "enum.ats.review.blocks"
-}
-
-oseeEnumType "enum.ats.point" {
- guid "AYyqLF5WrgvoWwAJhbAA"
- entry "1" entryGuid "AYyqLF5WrgvoWwAJhbAA"
- entry "2" entryGuid "AYyqLWfS+S+58gmCmOQA"
- entry "4" entryGuid "AYyqLY8_ChxManvFc6QA"
- entry "8" entryGuid "AYyqLbRYXECHjlLzQ+QA"
- entry "13" entryGuid "AYyqLdkSvmy0XZECrRwA"
- entry "20" entryGuid "AYyqLfzfO20iUkZSilgA"
- entry "40" entryGuid "AYyqLiFHxD1XUanPXBwA"
- entry "80" entryGuid "AYyqLkUSERzIljDD4agA"
- entry "150" entryGuid "AYyqLmlTUi3u7Eg8CdgA"
- entry "Epic" entryGuid "AYyqLo2M7zr1nj1mFfQA"
-}
-attributeType "ats.Points" extends EnumeratedAttribute {
- guid "AY2EeqhzcDEGtXtREkAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- enumType "enum.ats.point"
-}
-
-oseeEnumType "enum.ats.priority" {
- guid "ABbjHDlSoUHxQqPfkQAA"
- entry "1" entryGuid "CArJmPvK7mXFU4cMY3gA"
- entry "2" entryGuid "CArJmR7LQUYx7XRMnwQA"
- entry "3" entryGuid "CArJmR82AgY40rzzjagA"
- entry "4" entryGuid "CArJmR+dqR2jW6eRU1AA"
- entry "5" entryGuid "CArJmSAGIB9IRKqlKuAA"
-}
-
-attributeType "ats.Priority" extends EnumeratedAttribute {
- guid "AAMFEc8JzH1U6XGD59QA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- enumType "enum.ats.priority"
-}
-
-oseeEnumType "enum.ats.change.type" {
- guid "ABbjHDsCxWD6TscnY4AA"
- entry "Improvement" entryGuid "CArJmSBzfx4jvQ5vEtAA"
- entry "Problem" entryGuid "CArJmPw6F3bP1V5B59gA"
- entry "Support" entryGuid "CArJmSDgGAG4aKsU+KAA"
-}
-
-attributeType "ats.Change Type" extends EnumeratedAttribute {
- guid "AAMFEc+MwGHnPCv7HlgA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- enumType "enum.ats.change.type"
-}
-
-oseeEnumType "enum.ats.user.community" {
- guid "ABbjHDyl0m_BTHf+IdgA"
- entry "Program_1" entryGuid "AHcuApVCczNvC7AP52QA"
- entry "Program_2" entryGuid "AHcuBuS3JDdeZZ1mSxQA"
- entry "Tools" entryGuid "AHcuBuWaNFeVCgjNfwAA"
- entry "Processes" entryGuid "AHcuBuaJ0UGsRf0+WqAA"
- entry "Other" entryGuid "AHcuBud8JBLfUo3PK5AA"
-}
-
-attributeType "ats.User Community" extends EnumeratedAttribute {
- guid "AAMFEdAPtAq1IEwiCQAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max unlimited
- enumType "enum.ats.user.community"
-}
-
-attributeType "ats.Estimated Hours" extends FloatingPointAttribute {
- guid "AAMFEdCSqBh+cPyadiwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "0.0"
-}
-
-attributeType "ats.Numeric1" extends FloatingPointAttribute {
- guid "AABY2xxQsDm811kCViwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "0.0"
-}
-
-attributeType "ats.Numeric2" extends FloatingPointAttribute {
- guid "AABiRtvZsAEkU4BS9qwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "0.0"
-}
-
-attributeType "ats.Weekly Benefit" extends FloatingPointAttribute {
- guid "AAMFEdEnEU9AecOHMOwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "0"
-}
-
-attributeType "ats.Hours Per Work Day" extends FloatingPointAttribute {
- guid "AAMFEdGlqFsZp22RMdAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- defaultValue "0.0"
-}
-
-attributeType "ats.Percent Rework" extends IntegerAttribute {
- guid "AAMFEdKfjl2TII9+tuwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.Branch Metrics" extends StringAttribute {
- guid "AAMFEQc7yxE0jUqVA7wA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.State" extends StringAttribute {
- guid "AAMFEdMa3wzVvp60xLQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max unlimited
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Current State" extends StringAttribute {
- guid "AAMFEdOWL3u6hmX2VbwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Problem" extends StringAttribute {
- guid "AAMFEdQUxRyevvTu+bwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
- fileExtension "txt"
-}
-
-attributeType "ats.Proposed Resolution" extends StringAttribute {
- guid "AAMFEdSSRDGgBQ5tctAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Resolution" extends StringAttribute {
- guid "AAMFEdUMfV1KdbQNaKwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
- fileExtension "txt"
-}
-
-attributeType "ats.Description" extends StringAttribute {
- guid "AAMFEdWJ_ChxX6+YKbwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
- fileExtension "txt"
-}
-
-attributeType "ats.Full Name" extends StringAttribute {
- guid "AAMFEdZI9XLT34cTonAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Actionable Item" extends StringAttribute {
- guid "AAMFEdbcR2zpGzFOLOQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max unlimited
-}
-
-attributeType "ats.Team Definition" extends StringAttribute {
- guid "AAMFEdd5bFEe18bd0lQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.Log" extends StringAttribute {
- guid "AAMFEdgB1DX3eJSZb0wA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
- fileExtension "xml"
-}
-
-attributeType "ats.State Notes" extends StringAttribute {
- guid "AAMFEdiWPm7M_xV1EswA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- fileExtension "xml"
-}
-
-attributeType "ats.Related To State" extends StringAttribute {
- guid "AAMFEdkwHULOmHbMbGgA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.SMA Note" extends StringAttribute {
- guid "AAMFEdm7ywte8qayfbAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Work Package" extends StringAttribute {
- guid "AAMFEdpJqRp2wvA2qvAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Goal Order Vote" extends StringAttribute {
- guid "Aiecsz9pP1CRoQdaYRAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Category" extends StringAttribute {
- guid "AAMFEdrYniOQYrYUKKQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Category2" extends StringAttribute {
- guid "AAMFEdthBkolbJKLXuAA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Category3" extends StringAttribute {
- guid "AAMFEd06oxr8LMzZxdgA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Legacy PCR Id" extends StringAttribute {
- guid "AAMFEd3TakphMtQX1zgA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Decision Review Options" extends StringAttribute {
- guid "AAMFEd5hRy1+SRJRqfwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.Decision" extends StringAttribute {
- guid "AAMFEd7uDXcmqq_FrCQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
-}
-
-attributeType "ats.Review Defect" extends StringAttribute {
- guid "AAMFEd+MSVAb8JQ6f5gA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max unlimited
-}
-
-attributeType "ats.Location" extends StringAttribute {
- guid "AAMFEeAW4QBlesdfacwA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
- taggerId DefaultAttributeTaggerProvider
- fileExtension "txt"
-}
-
-attributeType "ats.Authors" extends StringAttribute {
- guid "AAMFEQmzoyhG0QNbstQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-attributeType "ats.Role" extends StringAttribute {
- guid "AAMFEeCqMz0XCSBJ+IQA"
- dataProvider DefaultAttributeDataProvider
- min 0
- max 1
-}
-
-relationType "TeamLead" {
- guid "AAMFE90HyTZPyHuQWOQA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "User"
- sideBArtifactType "User"
- defaultOrderType Unordered
- multiplicity MANY_TO_MANY
-}
-
-relationType "TeamMember" {
- guid "AAMFE92A6gCO9WJ2ijQA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "User"
- sideBArtifactType "User"
- defaultOrderType Unordered
- multiplicity MANY_TO_MANY
-}
-
-relationType "PrivilegedMember" {
- guid "AAMFE9XfiibyK1x2FiwA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "User"
- sideBArtifactType "User"
- defaultOrderType Unordered
- multiplicity MANY_TO_MANY
-}
-
-relationType "TeamActionableItem" {
- guid "AAMFE939Ul9Oenq9wWgA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "Actionable Item"
- sideBArtifactType "Actionable Item"
- defaultOrderType Unordered
- multiplicity ONE_TO_MANY
-}
-
-relationType "ActionToWorkflow" {
- guid "AAMFE953ixQThusHUPwA"
- sideAName "Action"
- sideAArtifactType "Action"
- sideBName "Team Workflow"
- sideBArtifactType "Team Workflow"
- defaultOrderType Unordered
- multiplicity ONE_TO_MANY
-}
-
-relationType "SmaToTask" {
- guid "AAMFE97xw1BM5l+GxKAA"
- sideAName "State Machine Artifact"
- sideAArtifactType "ats.Ats Artifact"
- sideBName "Task"
- sideBArtifactType "Task"
- defaultOrderType Lexicographical_Ascending
- multiplicity ONE_TO_MANY
-}
-
-relationType "TeamWorkflowTargetedForVersion" {
- guid "AAMFE99pzm4zSibDT9gA"
- sideAName "Team Workflow"
- sideAArtifactType "Team Workflow"
- sideBName "Version"
- sideBArtifactType "Version"
- defaultOrderType Unordered
- multiplicity MANY_TO_ONE
-}
-
-relationType "TeamDefinitionToVersion" {
- guid "AAMFE9_i7zG3lR1kGWQA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "Version"
- sideBArtifactType "Version"
- defaultOrderType Lexicographical_Ascending
- multiplicity ONE_TO_MANY
-}
-
-relationType "TeamDefinitionToWorkflowDiagram" {
- guid "AAMFE+BpKTGewbN8c3gA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "General Document"
- sideBArtifactType "General Document"
- defaultOrderType Unordered
- multiplicity MANY_TO_ONE
-}
-
-relationType "TeamDefinitionToTaskWorkflowDiagram" {
- guid "AAMFE+DkeQ9mRBPca0QA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "General Document"
- sideBArtifactType "General Document"
- defaultOrderType Unordered
- multiplicity MANY_TO_ONE
-}
-
-relationType "TeamDefinitionToDecisionReviewWorkflowDiagram" {
- guid "AAMFE+Fg4RmKrda_jJQA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "General Document"
- sideBArtifactType "General Document"
- defaultOrderType Unordered
- multiplicity MANY_TO_ONE
-}
-
-relationType "TeamDefinitionToPeerToPeerReviewWorkflowDiagram" {
- guid "AAMFE+HqYUG262IxMFwA"
- sideAName "Team Definition"
- sideAArtifactType "Team Definition"
- sideBName "General Document"
- sideBArtifactType "General Document"
- defaultOrderType Unordered
- multiplicity MANY_TO_ONE
-}
-
-relationType "TeamWorkflowToReview" {
- guid "AAMFE+JqDz+8tuRDdIwA"
- sideAName "Team Workflow"
- sideAArtifactType "Team Workflow"
- sideBName "Review"
- sideBArtifactType "ats.Review"
- defaultOrderType Unordered
- multiplicity MANY_TO_MANY
-}
-
-relationType "SubscribedUser" {
- guid "AAMFE+LkSAkfUWoTHdwA"
- sideAName "Artifact"
- sideAArtifactType "Artifact"
- sideBName "User"
- sideBArtifactType "User"
- defaultOrderType Unordered
- multiplicity MANY_TO_MANY
-}
-
-relationType "FavoriteUser" {
- guid "AAMFE+NegDLK1g2ph+AA"
- sideAName "Artifact"
- sideAArtifactType "Artifact"
- sideBName "User"
- sideBArtifactType "User"
- defaultOrderType Unordered
- multiplicity MANY_TO_MANY
-}
-
-relationType "ParallelVersion" {
- guid "AAMFE_EJHSBGb9msPXQA"
- sideAName "Parent"
- sideAArtifactType "Version"
- sideBName "Child"
- sideBArtifactType "Version"
- defaultOrderType Lexicographical_Ascending
- multiplicity MANY_TO_MANY
-}
-
-relationType "Goal" {
- guid "ABMn0wPKdyN+Mfo5nwgA"
- sideAName "Goal"
- sideAArtifactType "Goal"
- sideBName "Member"
- sideBArtifactType "ats.Ats Artifact"
- defaultOrderType Lexicographical_Ascending
- multiplicity MANY_TO_MANY
+import
+"platform:/plugin/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee"
+abstract artifactType "ats.Release Artifact" extends "Artifact" {
+ guid "ABMZAdJpQi01iAbMBjgA"
+ attribute "ats.Released"
+}
+
+abstract artifactType "ats.Ats Artifact" extends "Artifact" {
+ guid "ABMaLS0jvw92SE+4ZJQA"
+ attribute "ats.Description"
+}
+
+artifactType "ats.Review" extends "ats.Ats Artifact" {
+ guid "ABMa6P4TwzXA1b8K3RAA"
+ attribute "ats.Actionable Item"
+ attribute "ats.Blocking Review"
+ attribute "ats.Current State"
+ attribute "ats.Estimated Completion Date"
+ attribute "ats.Estimated Hours"
+ attribute "ats.Estimated Release Date"
+ attribute "ats.Legacy PCR Id"
+ attribute "ats.Log"
+ attribute "ats.Need By"
+ attribute "ats.Related To State"
+ attribute "ats.Resolution"
+ attribute "ats.Review Blocks"
+ attribute "ats.Role"
+ attribute "ats.SMA Note"
+ attribute "ats.State Notes"
+ attribute "ats.State"
+}
+
+artifactType "PeerToPeer Review" extends "ats.Review" {
+ guid "AAMFDhh_300dpgmNtRAA"
+ attribute "ats.Authors"
+ attribute "ats.Location"
+ attribute "ats.Review Defect"
+}
+
+artifactType "Decision Review" extends "ats.Review" {
+ guid "AAMFDhfrdR7BGTL7H_wA"
+ attribute "ats.Decision Review Options"
+ attribute "ats.Decision"
+}
+
+artifactType "Action" extends "ats.Ats Artifact" {
+ guid "AAMFDhY_rns71KvX14QA"
+ attribute "ats.User Community"
+ attribute "ats.Actionable Item"
+ attribute "ats.Change Type"
+ attribute "ats.Need By"
+ attribute "ats.Priority"
+ attribute "ats.Validation Required"
+}
+
+artifactType "Team Definition" extends "ats.Ats Artifact" {
+ guid "AAMFDhUrlytusKbaQGAA"
+ attribute "ats.Hours Per Work Day"
+ attribute "ats.Full Name"
+ attribute "ats.Team Uses Versions"
+ attribute "ats.Require Targeted Version"
+ attribute "ats.Baseline Branch Guid"
+ attribute "ats.Active"
+ attribute "ats.Actionable"
+ attribute "ats.Allow Create Branch"
+ attribute "ats.Allow Commit Branch"
+}
+
+artifactType "Actionable Item" extends "ats.Ats Artifact" {
+ guid "AAMFDhW2LmhtRFsVyzwA"
+ attribute "ats.Active"
+ attribute "ats.Actionable"
+}
+
+artifactType "Version" extends "ats.Ats Artifact" {
+ guid "AAMFDhder0oETnv14xQA"
+ attribute "ats.Allow Commit Branch"
+ attribute "ats.Allow Create Branch"
+ attribute "ats.Estimated Release Date"
+ attribute "ats.Full Name"
+ attribute "ats.Next Version"
+ attribute "ats.Baseline Branch Guid"
+ attribute "ats.Release Date"
+ attribute "ats.Released"
+ attribute "ats.Version Locked"
+}
+
+abstract artifactType "ats.State Machine" extends "ats.Ats Artifact" {
+ guid "ABMfXC+LFBn31ZZbvjAA"
+ attribute "ats.Work Package"
+ attribute "ats.Category"
+ attribute "ats.Category2"
+ attribute "ats.Category3"
+ attribute "ats.Points"
+ attribute "ats.Numeric1"
+ attribute "ats.Numeric2"
+ attribute "ats.Current State"
+ attribute "ats.Estimated Completion Date"
+ attribute "ats.Estimated Hours"
+ attribute "ats.Estimated Release Date"
+ attribute "ats.Log"
+ attribute "ats.Release Date"
+ attribute "ats.Resolution"
+ attribute "ats.SMA Note"
+ attribute "ats.State Notes"
+ attribute "ats.State"
+}
+
+artifactType "Goal" extends "ats.State Machine" {
+ guid "ABMgU119UjI_Q23Yu+gA"
+ attribute "ats.Change Type"
+ attribute "ats.Need By"
+ attribute "ats.Priority"
+ attribute "ats.Goal Order Vote"
+}
+
+artifactType "Team Workflow" extends "ats.State Machine" {
+ guid "AAMFDhSiF2OD+wiUqugA"
+ attribute "ats.Actionable Item"
+ attribute "ats.Branch Metrics"
+ attribute "ats.Baseline Branch Guid"
+ attribute "ats.Validation Required"
+ attribute "ats.Weekly Benefit"
+ attribute "ats.Change Type"
+ attribute "ats.Legacy PCR Id"
+ attribute "ats.Need By"
+ attribute "ats.Percent Rework"
+ attribute "ats.Priority"
+ attribute "ats.Problem"
+ attribute "ats.Proposed Resolution"
+ attribute "ats.Team Definition"
+ attribute "ats.User Community"
+}
+
+artifactType "Task" extends "ats.State Machine" {
+ guid "AAMFDhbTAAB6h+06fuAA"
+ attribute "ats.Related To State"
+ attribute "ats.Uses Resolution Options"
+}
+
+attributeType "ats.Baseline Branch Guid" extends StringAttribute {
+ guid "AAMFEdIjJ2za2fblEVgA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.Validation Required" extends BooleanAttribute {
+ guid "AAMFEcjT0TwkD2R4w1QA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "no"
+}
+
+attributeType "ats.Active" extends BooleanAttribute {
+ guid "AAMFEclQOVmzkIvzyWwA"
+ dataProvider DefaultAttributeDataProvider
+ min 1
+ max 1
+ defaultValue "yes"
+}
+
+attributeType "ats.Uses Resolution Options" extends BooleanAttribute {
+ guid "AAMFEPuOzltN1+Ze1kQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "no"
+}
+
+attributeType "ats.Released" extends BooleanAttribute {
+ guid "AAMFEcnMoUZMLA2zB1AA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "no"
+}
+
+attributeType "ats.Version Locked" extends BooleanAttribute {
+ guid "AAzRtEJXbjzR5jySOZgA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "no"
+}
+
+attributeType "ats.Next Version" extends BooleanAttribute {
+ guid "AAMFEcpH8Xb72hsF5AwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "no"
+}
+
+attributeType "ats.Team Uses Versions" extends BooleanAttribute {
+ guid "AAMFEcrHnzPxQ7w3ligA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "no"
+}
+
+attributeType "ats.Require Targeted Version" extends BooleanAttribute {
+ guid "AAMFEQUBDxMJ67lodTQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "no"
+}
+
+attributeType "ats.Blocking Review" extends BooleanAttribute {
+ guid "AAMFEctKkjMRrIy1C7gA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "no"
+}
+
+attributeType "ats.Actionable" extends BooleanAttribute {
+ guid "AAMFEcvDtBiaJ3TMatAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "yes"
+}
+
+attributeType "ats.Allow Create Branch" extends BooleanAttribute {
+ guid "AAMFEbARuQEvi6rtY5gA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "yes"
+}
+
+attributeType "ats.Allow Commit Branch" extends BooleanAttribute {
+ guid "AAMFEbCZCkwgj73BsQgA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "yes"
+}
+
+attributeType "ats.Need By" extends DateAttribute {
+ guid "AAMFEcxAGzHAKfDNAIwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.Estimated Release Date" extends DateAttribute {
+ guid "AAMFEcy6VB7Ble5SP1QA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.Estimated Completion Date" extends DateAttribute {
+ guid "AAMFEc18k3Gh+GP7zqAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.Release Date" extends DateAttribute {
+ guid "AAMFEc3+cGcMDOCdmdAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+oseeEnumType "enum.ats.review.blocks" {
+ guid "ABbjHDeufSNcLOtj78wA"
+ entry "None" entryGuid "CArJmR2JDn5DXT9FGPQA"
+ entry "Transition" entryGuid "CArJmR3xrEmbw7zbyqgA"
+ entry "Commit" entryGuid "CArJmR5WzHmG_n_OKhQA"
+}
+
+attributeType "ats.Review Blocks" extends EnumeratedAttribute {
+ guid "AAMFEc6G2A8jmRWJgagA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ enumType "enum.ats.review.blocks"
+}
+
+oseeEnumType "enum.ats.point" {
+ guid "AYyqLF5WrgvoWwAJhbAA"
+ entry "1" entryGuid "AYyqLF5WrgvoWwAJhbAA"
+ entry "2" entryGuid "AYyqLWfS+S+58gmCmOQA"
+ entry "4" entryGuid "AYyqLY8_ChxManvFc6QA"
+ entry "8" entryGuid "AYyqLbRYXECHjlLzQ+QA"
+ entry "13" entryGuid "AYyqLdkSvmy0XZECrRwA"
+ entry "20" entryGuid "AYyqLfzfO20iUkZSilgA"
+ entry "40" entryGuid "AYyqLiFHxD1XUanPXBwA"
+ entry "80" entryGuid "AYyqLkUSERzIljDD4agA"
+ entry "150" entryGuid "AYyqLmlTUi3u7Eg8CdgA"
+ entry "Epic" entryGuid "AYyqLo2M7zr1nj1mFfQA"
+}
+attributeType "ats.Points" extends EnumeratedAttribute {
+ guid "AY2EeqhzcDEGtXtREkAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ enumType "enum.ats.point"
+}
+
+oseeEnumType "enum.ats.priority" {
+ guid "ABbjHDlSoUHxQqPfkQAA"
+ entry "1" entryGuid "CArJmPvK7mXFU4cMY3gA"
+ entry "2" entryGuid "CArJmR7LQUYx7XRMnwQA"
+ entry "3" entryGuid "CArJmR82AgY40rzzjagA"
+ entry "4" entryGuid "CArJmR+dqR2jW6eRU1AA"
+ entry "5" entryGuid "CArJmSAGIB9IRKqlKuAA"
+}
+
+attributeType "ats.Priority" extends EnumeratedAttribute {
+ guid "AAMFEc8JzH1U6XGD59QA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ enumType "enum.ats.priority"
+}
+
+oseeEnumType "enum.ats.change.type" {
+ guid "ABbjHDsCxWD6TscnY4AA"
+ entry "Improvement" entryGuid "CArJmSBzfx4jvQ5vEtAA"
+ entry "Problem" entryGuid "CArJmPw6F3bP1V5B59gA"
+ entry "Support" entryGuid "CArJmSDgGAG4aKsU+KAA"
+}
+
+attributeType "ats.Change Type" extends EnumeratedAttribute {
+ guid "AAMFEc+MwGHnPCv7HlgA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ enumType "enum.ats.change.type"
+}
+
+oseeEnumType "enum.ats.user.community" {
+ guid "ABbjHDyl0m_BTHf+IdgA"
+ entry "Program_1" entryGuid "AHcuApVCczNvC7AP52QA"
+ entry "Program_2" entryGuid "AHcuBuS3JDdeZZ1mSxQA"
+ entry "Tools" entryGuid "AHcuBuWaNFeVCgjNfwAA"
+ entry "Processes" entryGuid "AHcuBuaJ0UGsRf0+WqAA"
+ entry "Other" entryGuid "AHcuBud8JBLfUo3PK5AA"
+}
+
+attributeType "ats.User Community" extends EnumeratedAttribute {
+ guid "AAMFEdAPtAq1IEwiCQAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max unlimited
+ enumType "enum.ats.user.community"
+}
+
+attributeType "ats.Estimated Hours" extends FloatingPointAttribute {
+ guid "AAMFEdCSqBh+cPyadiwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "0.0"
+}
+
+attributeType "ats.Numeric1" extends FloatingPointAttribute {
+ guid "AABY2xxQsDm811kCViwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "0.0"
+}
+
+attributeType "ats.Numeric2" extends FloatingPointAttribute {
+ guid "AABiRtvZsAEkU4BS9qwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "0.0"
+}
+
+attributeType "ats.Weekly Benefit" extends FloatingPointAttribute {
+ guid "AAMFEdEnEU9AecOHMOwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "0"
+}
+
+attributeType "ats.Hours Per Work Day" extends FloatingPointAttribute {
+ guid "AAMFEdGlqFsZp22RMdAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ defaultValue "0.0"
+}
+
+attributeType "ats.Percent Rework" extends IntegerAttribute {
+ guid "AAMFEdKfjl2TII9+tuwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.Branch Metrics" extends StringAttribute {
+ guid "AAMFEQc7yxE0jUqVA7wA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.State" extends StringAttribute {
+ guid "AAMFEdMa3wzVvp60xLQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max unlimited
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Current State" extends StringAttribute {
+ guid "AAMFEdOWL3u6hmX2VbwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Problem" extends StringAttribute {
+ guid "AAMFEdQUxRyevvTu+bwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+ fileExtension "txt"
+}
+
+attributeType "ats.Proposed Resolution" extends StringAttribute {
+ guid "AAMFEdSSRDGgBQ5tctAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Resolution" extends StringAttribute {
+ guid "AAMFEdUMfV1KdbQNaKwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+ fileExtension "txt"
+}
+
+attributeType "ats.Description" extends StringAttribute {
+ guid "AAMFEdWJ_ChxX6+YKbwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+ fileExtension "txt"
+}
+
+attributeType "ats.Full Name" extends StringAttribute {
+ guid "AAMFEdZI9XLT34cTonAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Actionable Item" extends StringAttribute {
+ guid "AAMFEdbcR2zpGzFOLOQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max unlimited
+}
+
+attributeType "ats.Team Definition" extends StringAttribute {
+ guid "AAMFEdd5bFEe18bd0lQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.Log" extends StringAttribute {
+ guid "AAMFEdgB1DX3eJSZb0wA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+ fileExtension "xml"
+}
+
+attributeType "ats.State Notes" extends StringAttribute {
+ guid "AAMFEdiWPm7M_xV1EswA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ fileExtension "xml"
+}
+
+attributeType "ats.Related To State" extends StringAttribute {
+ guid "AAMFEdkwHULOmHbMbGgA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.SMA Note" extends StringAttribute {
+ guid "AAMFEdm7ywte8qayfbAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Work Package" extends StringAttribute {
+ guid "AAMFEdpJqRp2wvA2qvAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Goal Order Vote" extends StringAttribute {
+ guid "Aiecsz9pP1CRoQdaYRAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Category" extends StringAttribute {
+ guid "AAMFEdrYniOQYrYUKKQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Category2" extends StringAttribute {
+ guid "AAMFEdthBkolbJKLXuAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Category3" extends StringAttribute {
+ guid "AAMFEd06oxr8LMzZxdgA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Legacy PCR Id" extends StringAttribute {
+ guid "AAMFEd3TakphMtQX1zgA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Decision Review Options" extends StringAttribute {
+ guid "AAMFEd5hRy1+SRJRqfwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.Decision" extends StringAttribute {
+ guid "AAMFEd7uDXcmqq_FrCQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+}
+
+attributeType "ats.Review Defect" extends StringAttribute {
+ guid "AAMFEd+MSVAb8JQ6f5gA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max unlimited
+}
+
+attributeType "ats.Location" extends StringAttribute {
+ guid "AAMFEeAW4QBlesdfacwA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ taggerId DefaultAttributeTaggerProvider
+ fileExtension "txt"
+}
+
+attributeType "ats.Authors" extends StringAttribute {
+ guid "AAMFEQmzoyhG0QNbstQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+attributeType "ats.Role" extends StringAttribute {
+ guid "AAMFEeCqMz0XCSBJ+IQA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+}
+
+relationType "TeamLead" {
+ guid "AAMFE90HyTZPyHuQWOQA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "User"
+ sideBArtifactType "User"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_MANY
+}
+
+relationType "TeamMember" {
+ guid "AAMFE92A6gCO9WJ2ijQA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "User"
+ sideBArtifactType "User"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_MANY
+}
+
+relationType "PrivilegedMember" {
+ guid "AAMFE9XfiibyK1x2FiwA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "User"
+ sideBArtifactType "User"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_MANY
+}
+
+relationType "TeamActionableItem" {
+ guid "AAMFE939Ul9Oenq9wWgA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "Actionable Item"
+ sideBArtifactType "Actionable Item"
+ defaultOrderType Unordered
+ multiplicity ONE_TO_MANY
+}
+
+relationType "ActionToWorkflow" {
+ guid "AAMFE953ixQThusHUPwA"
+ sideAName "Action"
+ sideAArtifactType "Action"
+ sideBName "Team Workflow"
+ sideBArtifactType "Team Workflow"
+ defaultOrderType Unordered
+ multiplicity ONE_TO_MANY
+}
+
+relationType "SmaToTask" {
+ guid "AAMFE97xw1BM5l+GxKAA"
+ sideAName "State Machine Artifact"
+ sideAArtifactType "ats.Ats Artifact"
+ sideBName "Task"
+ sideBArtifactType "Task"
+ defaultOrderType Lexicographical_Ascending
+ multiplicity ONE_TO_MANY
+}
+
+relationType "TeamWorkflowTargetedForVersion" {
+ guid "AAMFE99pzm4zSibDT9gA"
+ sideAName "Team Workflow"
+ sideAArtifactType "Team Workflow"
+ sideBName "Version"
+ sideBArtifactType "Version"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_ONE
+}
+
+relationType "TeamDefinitionToVersion" {
+ guid "AAMFE9_i7zG3lR1kGWQA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "Version"
+ sideBArtifactType "Version"
+ defaultOrderType Lexicographical_Ascending
+ multiplicity ONE_TO_MANY
+}
+
+relationType "TeamDefinitionToWorkflowDiagram" {
+ guid "AAMFE+BpKTGewbN8c3gA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "General Document"
+ sideBArtifactType "General Document"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_ONE
+}
+
+relationType "TeamDefinitionToTaskWorkflowDiagram" {
+ guid "AAMFE+DkeQ9mRBPca0QA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "General Document"
+ sideBArtifactType "General Document"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_ONE
+}
+
+relationType "TeamDefinitionToDecisionReviewWorkflowDiagram" {
+ guid "AAMFE+Fg4RmKrda_jJQA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "General Document"
+ sideBArtifactType "General Document"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_ONE
+}
+
+relationType "TeamDefinitionToPeerToPeerReviewWorkflowDiagram" {
+ guid "AAMFE+HqYUG262IxMFwA"
+ sideAName "Team Definition"
+ sideAArtifactType "Team Definition"
+ sideBName "General Document"
+ sideBArtifactType "General Document"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_ONE
+}
+
+relationType "TeamWorkflowToReview" {
+ guid "AAMFE+JqDz+8tuRDdIwA"
+ sideAName "Team Workflow"
+ sideAArtifactType "Team Workflow"
+ sideBName "Review"
+ sideBArtifactType "ats.Review"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_MANY
+}
+
+relationType "SubscribedUser" {
+ guid "AAMFE+LkSAkfUWoTHdwA"
+ sideAName "Artifact"
+ sideAArtifactType "Artifact"
+ sideBName "User"
+ sideBArtifactType "User"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_MANY
+}
+
+relationType "FavoriteUser" {
+ guid "AAMFE+NegDLK1g2ph+AA"
+ sideAName "Artifact"
+ sideAArtifactType "Artifact"
+ sideBName "User"
+ sideBArtifactType "User"
+ defaultOrderType Unordered
+ multiplicity MANY_TO_MANY
+}
+
+relationType "ParallelVersion" {
+ guid "AAMFE_EJHSBGb9msPXQA"
+ sideAName "Parent"
+ sideAArtifactType "Version"
+ sideBName "Child"
+ sideBArtifactType "Version"
+ defaultOrderType Lexicographical_Ascending
+ multiplicity MANY_TO_MANY
+}
+
+relationType "Goal" {
+ guid "ABMn0wPKdyN+Mfo5nwgA"
+ sideAName "Goal"
+ sideAArtifactType "Goal"
+ sideBName "Member"
+ sideBArtifactType "ats.Ats Artifact"
+ defaultOrderType Lexicographical_Ascending
+ multiplicity MANY_TO_MANY
} \ No newline at end of file

Back to the top